1 ; RUN: opt -passes=inline %s -S | FileCheck %s
2 ; RUN: opt -passes='cgscc(inline)' %s -S | FileCheck %s
3 ; Ensure SSP attributes are propagated correctly when inlining.
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
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. If the caller had an SSP attribute before inlining, it
13 ; should have its new SSP attribute set as:
14 ; strictest(caller-ssp-attr, callee-ssp-attr), where strictness is ordered as:
15 ; sspreq > sspstrong > ssp
17 define internal void @fun_sspreq() sspreq {
19 %call = call i32 (ptr, ...) @printf(ptr @.str3)
23 define internal void @fun_sspreq_alwaysinline() sspreq alwaysinline {
25 %call = call i32 (ptr, ...) @printf(ptr @.str3)
29 define internal void @fun_sspstrong() sspstrong {
31 %call = call i32 (ptr, ...) @printf(ptr @.str2)
35 define internal void @fun_ssp() ssp {
37 %call = call i32 (ptr, ...) @printf(ptr @.str1)
41 define internal void @fun_nossp() {
43 %call = call i32 (ptr, ...) @printf(ptr @.str)
49 define void @inline_req_req() sspreq {
51 ; CHECK: @inline_req_req() #[[SSPREQ:[0-9]]]
52 call void @fun_sspreq()
56 define void @inline_req_strong() sspstrong {
58 ; CHECK: @inline_req_strong() #[[SSPREQ]]
59 call void @fun_sspreq()
63 define void @inline_req_ssp() ssp {
65 ; CHECK: @inline_req_ssp() #[[SSPREQ]]
66 call void @fun_sspreq()
70 define void @inline_req_nossp() {
72 ; CHECK: @inline_req_nossp() {
73 call void @fun_sspreq()
77 define void @alwaysinline_req_nossp() {
79 ; CHECK: @alwaysinline_req_nossp() {
80 call void @fun_sspreq_alwaysinline()
84 define void @inline_strong_req() sspreq {
86 ; CHECK: @inline_strong_req() #[[SSPREQ]]
87 call void @fun_sspstrong()
92 define void @inline_strong_strong() sspstrong {
94 ; CHECK: @inline_strong_strong() #[[SSPSTRONG:[0-9]]]
95 call void @fun_sspstrong()
99 define void @inline_strong_ssp() ssp {
101 ; CHECK: @inline_strong_ssp() #[[SSPSTRONG]]
102 call void @fun_sspstrong()
106 define void @inline_strong_nossp() {
108 ; CHECK: @inline_strong_nossp() {
109 call void @fun_sspstrong()
113 define void @inline_ssp_req() sspreq {
115 ; CHECK: @inline_ssp_req() #[[SSPREQ]]
121 define void @inline_ssp_strong() sspstrong {
123 ; CHECK: @inline_ssp_strong() #[[SSPSTRONG]]
128 define void @inline_ssp_ssp() ssp {
130 ; CHECK: @inline_ssp_ssp() #[[SSP:[0-9]]]
135 define void @inline_ssp_nossp() {
137 ; CHECK: @inline_ssp_nossp() {
142 define void @inline_nossp_req() sspreq {
144 ; CHECK: @inline_nossp_req() #[[SSPREQ]]
145 call void @fun_nossp()
150 define void @inline_nossp_strong() sspstrong {
152 ; CHECK: @inline_nossp_strong() #[[SSPSTRONG]]
153 call void @fun_nossp()
157 define void @inline_nossp_ssp() ssp {
159 ; CHECK: @inline_nossp_ssp() #[[SSP]]
160 call void @fun_nossp()
164 define void @inline_nossp_nossp() {
166 ; CHECK: @inline_nossp_nossp() {
167 call void @fun_nossp()
171 declare i32 @printf(ptr, ...)
173 ; CHECK: attributes #[[SSPREQ]] = { sspreq }
174 ; CHECK: attributes #[[SSPSTRONG]] = { sspstrong }
175 ; CHECK: attributes #[[SSP]] = { ssp }