brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 49cc335 Raw
39 lines · plain
1;; Tests that we store the type identifiers in .llvm.callgraph section of the object file for tailcalls.2 3; REQUIRES: x86-registered-target4; REQUIRES: arm-registered-target5 6; RUN: llc -mtriple=x86_64-unknown-linux --call-graph-section -filetype=obj -o - < %s | \7; RUN: llvm-readelf -x .llvm.callgraph - | FileCheck %s8 9define i32 @check_tailcall(ptr %func, i8 %x) !type !0 {10entry:11  %call = tail call i32 %func(i8 signext %x), !callee_type !112  ret i32 %call13}14 15define i32 @main(i32 %argc) !type !3 {16entry:17  %andop = and i32 %argc, 118  %cmp = icmp eq i32 %andop, 019  %foo.bar = select i1 %cmp, ptr @foo, ptr @bar20  %call.i = tail call i32 %foo.bar(i8 signext 97), !callee_type !121  ret i32 %call.i22}23 24declare !type !2 i32 @foo(i8 signext)25 26declare !type !2 i32 @bar(i8 signext)27 28!0 = !{i64 0, !"_ZTSFiPvcE.generalized"}29!1 = !{!2}30!2 = !{i64 0, !"_ZTSFicE.generalized"}31!3 = !{i64 0, !"_ZTSFiiE.generalized"}32 33; CHECK: Hex dump of section '.llvm.callgraph':34; CHECK-NEXT: 0x00000000 00050000 00000000 00008e19 0b7f332635; CHECK-NEXT: 0x00000010 e3000154 86bc5981 4b8e3000 0500000036;; Verify that the type id 0x308e4b8159bc8654 is in section.37; CHECK-NEXT: 0x00000020 00000000 00a150b8 3e0cfe3c b201548638; CHECK-NEXT: 0x00000030 bc59814b 8e3039