Skip to content

Commit 43d6eed

Browse files
committed
Rebase on parent.
Created using spr 1.3.6-beta.1
2 parents 839da25 + 5b36796 commit 43d6eed

File tree

5 files changed

+70
-11
lines changed

5 files changed

+70
-11
lines changed

llvm/test/CodeGen/MIR/X86/call-site-info-ambiguous-indirect-call-typeid.mir

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@
4949
name: main
5050
callSites:
5151
- { bb: 0, offset: 0, fwdArgRegs: [] }
52-
- { bb: 0, offset: 2, fwdArgRegs: [], calleeTypeIds:
53-
[ 1234567890 ] }
52+
- { bb: 0, offset: 2, fwdArgRegs: [], calleeTypeIds: [ 1234567890 ] }
5453
body: |
5554
bb.0.entry:
5655
CALL64pcrel32 @_Z13get_operationb, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit-def $rsp, implicit-def $ssp, implicit-def $rax

llvm/test/CodeGen/MIR/X86/call-site-info-typeid.mir

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
---
2626
name: main
2727
callSites:
28-
- { bb: 0, offset: 1, fwdArgRegs: [], calleeTypeIds:
29-
[ 123456789 ] }
28+
- { bb: 0, offset: 1, fwdArgRegs: [], calleeTypeIds: [ 123456789 ] }
3029
body: |
3130
bb.0.entry:
3231
%0:gr64 = MOV32ri64 @foo
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
;; Test .callgraph section in assembly.
2+
;; Test if temporary labels are generated for each indirect callsite with a callee_type metadata.
3+
;; Test if the .callgraph section contains the numerical callee type id for each of the temporary
4+
;; labels generated.
5+
6+
; RUN: llc -mtriple=x86_64-unknown-linux --call-graph-section -o - < %s | FileCheck %s
7+
8+
declare !type !0 void @foo()
9+
10+
declare !type !1 i32 @bar(i8 signext)
11+
12+
declare !type !2 ptr @baz(ptr)
13+
14+
; CHECK: ball:
15+
; CHECK-NEXT: .Lfunc_begin0:
16+
define void @ball() {
17+
entry:
18+
%retval = alloca i32, align 4
19+
%fp_foo = alloca ptr, align 8
20+
%a = alloca i8, align 1
21+
%fp_bar = alloca ptr, align 8
22+
%fp_baz = alloca ptr, align 8
23+
store i32 0, ptr %retval, align 4
24+
store ptr @foo, ptr %fp_foo, align 8
25+
%fp_foo_val = load ptr, ptr %fp_foo, align 8
26+
; CHECK: .Ltmp0:
27+
call void (...) %fp_foo_val(), !callee_type !1
28+
store ptr @bar, ptr %fp_bar, align 8
29+
%fp_bar_val = load ptr, ptr %fp_bar, align 8
30+
%a_val = load i8, ptr %a, align 1
31+
; CHECK: .Ltmp1:
32+
%call_fp_bar = call i32 %fp_bar_val(i8 signext %a_val), !callee_type !3
33+
store ptr @baz, ptr %fp_baz, align 8
34+
%fp_baz_val = load ptr, ptr %fp_baz, align 8
35+
; CHECK: .Ltmp2:
36+
%call_fp_baz = call ptr %fp_baz_val(ptr %a), !callee_type !5
37+
call void @foo()
38+
%a_val_2 = load i8, ptr %a, align 1
39+
%call_bar = call i32 @bar(i8 signext %a_val_2)
40+
%call_baz = call ptr @baz(ptr %a)
41+
ret void
42+
}
43+
44+
; CHECK: .section .callgraph,"o",@progbits,.text
45+
46+
; CHECK-NEXT: .quad 0
47+
; CHECK-NEXT: .quad .Lfunc_begin0
48+
; CHECK-NEXT: .quad 1
49+
; CHECK-NEXT: .quad 3
50+
; CHECK-NEXT: .quad 4524972987496481828
51+
; CHECK-NEXT: .quad .Ltmp0
52+
!0 = !{i64 0, !"_ZTSFvE.generalized"}
53+
!1 = !{!0}
54+
; CHECK-NEXT: .quad 3498816979441845844
55+
; CHECK-NEXT: .quad .Ltmp1
56+
!2 = !{i64 0, !"_ZTSFicE.generalized"}
57+
!3 = !{!2}
58+
; CHECK-NEXT: .quad 8646233951371320954
59+
; CHECK-NEXT: .quad .Ltmp2
60+
!4 = !{i64 0, !"_ZTSFPvS_E.generalized"}
61+
!5 = !{!4}

llvm/test/CodeGen/X86/call-graph-section-tailcall.ll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55

66
define i32 @_Z13call_indirectPFicEc(ptr %func, i8 %x) local_unnamed_addr !type !0 {
77
entry:
8-
%call = tail call noundef i32 %func(i8 noundef signext %x), !callee_type !1
8+
%call = tail call i32 %func(i8 signext %x), !callee_type !1
99
ret i32 %call
1010
}
1111

12-
define dso_local noundef i32 @main(i32 noundef %argc) local_unnamed_addr !type !3 {
12+
define dso_local i32 @main(i32 %argc) local_unnamed_addr !type !3 {
1313
entry:
1414
%0 = and i32 %argc, 1
1515
%cmp = icmp eq i32 %0, 0
1616
%_Z3fooc._Z3barc = select i1 %cmp, ptr @_Z3fooc, ptr @_Z3barc
17-
%call.i = tail call noundef i32 %_Z3fooc._Z3barc(i8 noundef signext 97), !callee_type !1
17+
%call.i = tail call i32 %_Z3fooc._Z3barc(i8 signext 97), !callee_type !1
1818
ret i32 %call.i
1919
}
2020

21-
declare !type !2 noundef i32 @_Z3fooc(i8 noundef signext) local_unnamed_addr
21+
declare !type !2 i32 @_Z3fooc(i8 signext) local_unnamed_addr
2222

23-
declare !type !2 noundef i32 @_Z3barc(i8 noundef signext) local_unnamed_addr
23+
declare !type !2 i32 @_Z3barc(i8 signext) local_unnamed_addr
2424

2525
;; Check that the numeric type id (md5 hash) for the below type ids are emitted
2626
;; to the callgraph section.

llvm/test/CodeGen/X86/call-graph-section.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
declare !type !0 void @foo()
77

8-
declare !type !1 noundef i32 @bar(i8 signext)
8+
declare !type !1 i32 @bar(i8 signext)
99

10-
declare !type !2 noundef ptr @baz(ptr)
10+
declare !type !2 ptr @baz(ptr)
1111

1212
define dso_local void @main() {
1313
entry:

0 commit comments

Comments
 (0)