• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -inline %s -S | FileCheck %s
2; RUN: opt -passes='cgscc(inline)' %s -S | FileCheck %s
3; Ensure SSP attributes are propagated correctly when inlining.
4
5@.str = private unnamed_addr constant [11 x i8] c"fun_nossp\0A\00", align 1
6@.str1 = private unnamed_addr constant [9 x i8] c"fun_ssp\0A\00", align 1
7@.str2 = private unnamed_addr constant [15 x i8] c"fun_sspstrong\0A\00", align 1
8@.str3 = private unnamed_addr constant [12 x i8] c"fun_sspreq\0A\00", align 1
9
10; These first four functions (@fun_sspreq, @fun_sspstrong, @fun_ssp, @fun_nossp)
11; are used by the remaining functions to ensure that the SSP attributes are
12; propagated correctly.  The caller should have its SSP attribute set as:
13; strictest(caller-ssp-attr, callee-ssp-attr), where strictness is ordered as:
14;  sspreq > sspstrong > ssp > [no ssp]
15define internal void @fun_sspreq() nounwind sspreq uwtable {
16entry:
17  %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str3, i32 0, i32 0))
18  ret void
19}
20
21define internal void @fun_sspstrong() nounwind sspstrong uwtable {
22entry:
23  %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str2, i32 0, i32 0))
24  ret void
25}
26
27define internal void @fun_ssp() nounwind ssp uwtable {
28entry:
29  %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str1, i32 0, i32 0))
30  ret void
31}
32
33define internal void @fun_nossp() nounwind uwtable {
34entry:
35  %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i32 0, i32 0))
36  ret void
37}
38
39; Tests start below
40
41define void @inline_req_req() nounwind sspreq uwtable {
42entry:
43; CHECK: @inline_req_req() #0
44  call void @fun_sspreq()
45  ret void
46}
47
48define void @inline_req_strong() nounwind sspstrong uwtable {
49entry:
50; CHECK: @inline_req_strong() #0
51  call void @fun_sspreq()
52  ret void
53}
54
55define void @inline_req_ssp() nounwind ssp uwtable {
56entry:
57; CHECK: @inline_req_ssp() #0
58  call void @fun_sspreq()
59  ret void
60}
61
62define void @inline_req_nossp() nounwind uwtable {
63entry:
64; CHECK: @inline_req_nossp() #3
65  call void @fun_sspreq()
66  ret void
67}
68
69define void @inline_strong_req() nounwind sspreq uwtable {
70entry:
71; CHECK: @inline_strong_req() #0
72  call void @fun_sspstrong()
73  ret void
74}
75
76
77define void @inline_strong_strong() nounwind sspstrong uwtable {
78entry:
79; CHECK: @inline_strong_strong() #1
80  call void @fun_sspstrong()
81  ret void
82}
83
84define void @inline_strong_ssp() nounwind ssp uwtable {
85entry:
86; CHECK: @inline_strong_ssp() #1
87  call void @fun_sspstrong()
88  ret void
89}
90
91define void @inline_strong_nossp() nounwind uwtable {
92entry:
93; CHECK: @inline_strong_nossp() #3
94  call void @fun_sspstrong()
95  ret void
96}
97
98define void @inline_ssp_req() nounwind sspreq uwtable {
99entry:
100; CHECK: @inline_ssp_req() #0
101  call void @fun_ssp()
102  ret void
103}
104
105
106define void @inline_ssp_strong() nounwind sspstrong uwtable {
107entry:
108; CHECK: @inline_ssp_strong() #1
109  call void @fun_ssp()
110  ret void
111}
112
113define void @inline_ssp_ssp() nounwind ssp uwtable {
114entry:
115; CHECK: @inline_ssp_ssp() #2
116  call void @fun_ssp()
117  ret void
118}
119
120define void @inline_ssp_nossp() nounwind uwtable {
121entry:
122; CHECK: @inline_ssp_nossp() #3
123  call void @fun_ssp()
124  ret void
125}
126
127define void @inline_nossp_req() nounwind uwtable sspreq {
128entry:
129; CHECK: @inline_nossp_req() #0
130  call void @fun_nossp()
131  ret void
132}
133
134
135define void @inline_nossp_strong() nounwind sspstrong uwtable {
136entry:
137; CHECK: @inline_nossp_strong() #1
138  call void @fun_nossp()
139  ret void
140}
141
142define void @inline_nossp_ssp() nounwind ssp uwtable {
143entry:
144; CHECK: @inline_nossp_ssp() #2
145  call void @fun_nossp()
146  ret void
147}
148
149define void @inline_nossp_nossp() nounwind uwtable {
150entry:
151; CHECK: @inline_nossp_nossp() #3
152  call void @fun_nossp()
153  ret void
154}
155
156declare i32 @printf(i8*, ...)
157
158; CHECK: attributes #0 = { nounwind sspreq uwtable }
159; CHECK: attributes #1 = { nounwind sspstrong uwtable }
160; CHECK: attributes #2 = { nounwind ssp uwtable }
161; CHECK: attributes #3 = { nounwind uwtable }
162