1- ;; Test if temporary labels are generated for each indirect callsite with a callee_type metadata.
2- ;; Test if the .callgraph section contains the MD5 hash of callee type ids generated from
3- ;; generalized type id strings.
1+ ;; Test if temporary labels are generated for each callsite.
2+ ;; Test if the .callgraph section contains the MD5 hash of callees' type (type id)
3+ ;; is correctly paired with its corresponding temporary label generated for indirect
4+ ;; call sites annotated with !callee_type metadata.
5+ ;; Test if the .callgraph section contains direct callsite temporary labels paired
6+ ;; correctly with the corresponding callee symbol.
47
58; RUN: llc -mtriple=x86_64-unknown-linux --call-graph-section -o - < %s | FileCheck %s
69
10+ declare !type !0 void @direct_foo ()
11+ declare !type !1 i32 @direct_bar (i8 )
12+ declare !type !2 ptr @direct_baz (ptr )
13+
714; CHECK: ball:
815; CHECK-NEXT: [[LABEL_FUNC:\.Lfunc_begin[0-9]+]]:
916define ptr @ball () {
1017entry:
1118 %fp_foo_val = load ptr , ptr null , align 8
1219 ; CHECK: [[LABEL_TMP0:\.L.*]]:
1320 call void (...) %fp_foo_val (), !callee_type !0
21+ ; CHECK: [[LABEL_TMP_DIRECT0:\.L.*]]:
22+ call void @direct_foo ()
1423 %fp_bar_val = load ptr , ptr null , align 8
1524 ; CHECK: [[LABEL_TMP1:\.L.*]]:
1625 %call_fp_bar = call i32 %fp_bar_val (i8 0 ), !callee_type !2
26+ ; CHECK: [[LABEL_TMP_DIRECT1:\.L.*]]:
27+ %call_fp_bar_direct = call i32 @direct_bar (i8 1 )
1728 %fp_baz_val = load ptr , ptr null , align 8
1829 ; CHECK: [[LABEL_TMP2:\.L.*]]:
1930 %call_fp_baz = call ptr %fp_baz_val (ptr null ), !callee_type !4
31+ ; CHECK: [[LABEL_TMP_DIRECT2:\.L.*]]:
32+ %call_fp_baz_direct = call ptr @direct_baz (ptr null )
2033 ret ptr %call_fp_baz
2134}
2235
@@ -41,3 +54,11 @@ entry:
4154;; Test for MD5 hash of _ZTSFPvS_E.generalized and the generated temporary callsite label.
4255; CHECK-NEXT: .quad 8646233951371320954
4356; CHECK-NEXT: .quad [[LABEL_TMP2]]
57+ ;; Test for number of direct calls and {callsite_label, callee} pairs.
58+ ; CHECK-NEXT: .quad 3
59+ ; CHECK-NEXT: .quad [[LABEL_TMP_DIRECT0]]
60+ ; CHECK-NEXT: .quad direct_foo
61+ ; CHECK-NEXT: .quad [[LABEL_TMP_DIRECT1]]
62+ ; CHECK-NEXT: .quad direct_bar
63+ ; CHECK-NEXT: .quad [[LABEL_TMP_DIRECT2]]
64+ ; CHECK-NEXT: .quad direct_baz
0 commit comments