|
| 1 | +;; Test if a potential indirect call target function which has internal linkage and |
| 2 | +;; address taken has its type ID emitted to callgraph section. |
| 3 | +;; This test also makes sure that callback functions which meet the above constraint |
| 4 | +;; are handled correctly. |
| 5 | + |
| 6 | +; RUN: llc -mtriple=arm-unknown-linux --call-graph-section -o - < %s | FileCheck %s |
| 7 | + |
| 8 | +declare !type !0 void @_Z6doWorkPFviE(ptr) |
| 9 | + |
| 10 | +define i32 @_Z4testv() !type !1 { |
| 11 | +entry: |
| 12 | + call void @_Z6doWorkPFviE(ptr nonnull @_ZL10myCallbacki) |
| 13 | + ret i32 0 |
| 14 | +} |
| 15 | + |
| 16 | +define internal void @_ZL10myCallbacki(i32 %value) !type !2 { |
| 17 | +entry: |
| 18 | + %sink = alloca i32, align 4 |
| 19 | + store volatile i32 %value, ptr %sink, align 4 |
| 20 | + %i1 = load volatile i32, ptr %sink, align 4 |
| 21 | + ret void |
| 22 | +} |
| 23 | + |
| 24 | +!0 = !{i64 0, !"_ZTSFvPFviEE.generalized"} |
| 25 | +!1 = !{i64 0, !"_ZTSFivE.generalized"} |
| 26 | +!2 = !{i64 0, !"_ZTSFviE.generalized"} |
| 27 | + |
| 28 | +; CHECK: .section .callgraph,"o",%progbits,.text |
| 29 | +;; Version |
| 30 | +; CHECK-NEXT: .byte 0 |
| 31 | +;; Flags -- Potential indirect target so LSB is set to 1. Other bits are 0. |
| 32 | +; CHECK-NEXT: .byte 1 |
| 33 | +;; Function Entry PC |
| 34 | +; CHECK-NEXT: .long [[LABEL_FUNC]] |
| 35 | +;; Function type ID -5212364466660467813 |
| 36 | +; CHECK-NEXT: .long 1154849691 |
| 37 | +; CHECK-NEXT: .long 3081369122 |
0 commit comments