38 lines · plain
1;; Test if a potential indirect call target function which has internal linkage and2;; address taken has its type ID emitted to callgraph section.3;; This test also makes sure that callback functions which meet the above constraint4;; are handled correctly.5 6; RUN: llc -mtriple=x86_64-unknown-linux --call-graph-section -o - < %s | FileCheck %s7 8declare !type !0 void @_Z6doWorkPFviE(ptr)9 10define i32 @_Z4testv() !type !1 {11entry:12 call void @_Z6doWorkPFviE(ptr nonnull @_ZL10myCallbacki)13 ret i32 014}15 16; CHECK: _ZL10myCallbacki:17define internal void @_ZL10myCallbacki(i32 %value) !type !2 {18entry:19 %sink = alloca i32, align 420 store volatile i32 %value, ptr %sink, align 421 %i1 = load volatile i32, ptr %sink, align 422 ret void23}24 25!0 = !{i64 0, !"_ZTSFvPFviEE.generalized"}26!1 = !{i64 0, !"_ZTSFivE.generalized"}27!2 = !{i64 0, !"_ZTSFviE.generalized"}28 29; CHECK: .section .llvm.callgraph,"o",@llvm_call_graph,.text30;; Version31; CHECK-NEXT: .byte 032;; Flags -- Potential indirect target so LSB is set to 1. Other bits are 0.33; CHECK-NEXT: .byte 134;; Function Entry PC35; CHECK-NEXT: .quad _ZL10myCallbacki36;; Function type ID37; CHECK-NEXT: .quad -521236446666046781338