xref: /llvm-project/llvm/test/Transforms/Inline/inline-sign-return-address.ll (revision 1782810b8440144a0141c24192acbaeb55a1545d)
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
4define internal void @foo_all() #0 {
5  ret void
6}
7
8define internal void @foo_nonleaf() #1 {
9  ret void
10}
11
12define internal void @foo_none() {
13  ret void
14}
15
16define internal void @foo_lr() #3 {
17  ret void
18}
19
20define internal void @foo_bkey() #4 {
21  ret void
22}
23
24define 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
39define 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
54define dso_local void @bar_none()  {
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
69define 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
84define 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
100attributes #0 = { "sign-return-address"="all" }
101attributes #1 = { "sign-return-address"="non-leaf" }
102attributes #3 = { "branch-protection-pauth-lr" "sign-return-address"="non-leaf" }
103attributes #4 = { "branch-protection-pauth-lr" "sign-return-address"="non-leaf" "sign-return-address-key"="b_key" }
104