1
+ ; Check the inliner doesn't inline a function with different sign return address schemes.
2
+ ; RUN: opt < %s -passes=inline -S | FileCheck %s
3
+
4
+ define internal void @foo_all () #0 {
5
+ ret void
6
+ }
7
+
8
+ define internal void @foo_nonleaf () #1 {
9
+ ret void
10
+ }
11
+
12
+ define internal void @foo_none () #2 {
13
+ ret void
14
+ }
15
+
16
+ define internal void @foo_lr () #3 {
17
+ ret void
18
+ }
19
+
20
+ define internal void @foo_bkey () #4 {
21
+ ret void
22
+ }
23
+
24
+ define dso_local void @bar_all () #0 {
25
+ ; CHECK-LABEL: bar_all
26
+ ; CHECK-NOT: call void @foo_all()
27
+ ; CHECK-NEXT: call void @foo_nonleaf()
28
+ ; CHECK-NEXT: call void @foo_none()
29
+ ; CHECK-NEXT: call void @foo_lr()
30
+ ; CHECK-NEXT: call void @foo_bkey()
31
+ call void @foo_all ()
32
+ call void @foo_nonleaf ()
33
+ call void @foo_none ()
34
+ call void @foo_lr ()
35
+ call void @foo_bkey ()
36
+ ret void
37
+ }
38
+
39
+ define dso_local void @bar_nonleaf () #1 {
40
+ ; CHECK-LABEL: bar_nonleaf
41
+ ; CHECK-NEXT: call void @foo_all()
42
+ ; CHECK-NOT: call void @foo_nonleaf()
43
+ ; CHECK-NEXT: call void @foo_none()
44
+ ; CHECK-NEXT: call void @foo_lr()
45
+ ; CHECK-NEXT: call void @foo_bkey()
46
+ call void @foo_all ()
47
+ call void @foo_nonleaf ()
48
+ call void @foo_none ()
49
+ call void @foo_lr ()
50
+ call void @foo_bkey ()
51
+ ret void
52
+ }
53
+
54
+ define dso_local void @bar_none () #2 {
55
+ ; CHECK-LABEL: bar_none
56
+ ; CHECK-NEXT: call void @foo_all()
57
+ ; CHECK-NEXT: call void @foo_nonleaf()
58
+ ; CHECK-NOT: call void @foo_none()
59
+ ; CHECK-NEXT: call void @foo_lr()
60
+ ; CHECK-NEXT: call void @foo_bkey()
61
+ call void @foo_all ()
62
+ call void @foo_nonleaf ()
63
+ call void @foo_none ()
64
+ call void @foo_lr ()
65
+ call void @foo_bkey ()
66
+ ret void
67
+ }
68
+
69
+ define dso_local void @bar_lr () #3 {
70
+ ; CHECK-LABEL: bar_lr
71
+ ; CHECK-NEXT: call void @foo_all()
72
+ ; CHECK-NEXT: call void @foo_nonleaf()
73
+ ; CHECK-NEXT: call void @foo_none()
74
+ ; CHECK-NOT: call void @foo_lr()
75
+ ; CHECK-NEXT: call void @foo_bkey()
76
+ call void @foo_all ()
77
+ call void @foo_nonleaf ()
78
+ call void @foo_none ()
79
+ call void @foo_lr ()
80
+ call void @foo_bkey ()
81
+ ret void
82
+ }
83
+
84
+ define dso_local void @bar_bkey () #4 {
85
+ ; CHECK-LABEL: bar_bkey
86
+ ; CHECK-NEXT: call void @foo_all()
87
+ ; CHECK-NEXT: call void @foo_nonleaf()
88
+ ; CHECK-NEXT: call void @foo_none()
89
+ ; CHECK-NEXT: call void @foo_lr()
90
+ ; CHECK-NOT: call void @foo_bkey()
91
+ call void @foo_all ()
92
+ call void @foo_nonleaf ()
93
+ call void @foo_none ()
94
+ call void @foo_lr ()
95
+ call void @foo_bkey ()
96
+ ret void
97
+ }
98
+
99
+
100
+ attributes #0 = { "branch-protection-pauth-lr" ="false" "sign-return-address" ="all" }
101
+ attributes #1 = { "branch-protection-pauth-lr" ="false" "sign-return-address" ="non-leaf" }
102
+ attributes #2 = { "branch-protection-pauth-lr" ="false" "sign-return-address" ="none" }
103
+ attributes #3 = { "branch-protection-pauth-lr" ="true" "sign-return-address" ="non-leaf" }
104
+ attributes #4 = { "branch-protection-pauth-lr" ="true" "sign-return-address" ="non-leaf" "sign-return-address-key" ="b_key" }
0 commit comments