1 ; RUN: opt -inline %s -S | FileCheck %s
2 ; Ensure SSP attributes are propagated correctly when inlining.
4 @.str = private unnamed_addr constant [11 x i8] c"fun_nossp\0A\00", align 1
5 @.str1 = private unnamed_addr constant [9 x i8] c"fun_ssp\0A\00", align 1
6 @.str2 = private unnamed_addr constant [15 x i8] c"fun_sspstrong\0A\00", align 1
7 @.str3 = private unnamed_addr constant [12 x i8] c"fun_sspreq\0A\00", align 1
9 ; These first four functions (@fun_sspreq, @fun_sspstrong, @fun_ssp, @fun_nossp)
10 ; are used by the remaining functions to ensure that the SSP attributes are
11 ; propagated correctly. The caller should have its SSP attribute set as:
12 ; strictest(caller-ssp-attr, callee-ssp-attr), where strictness is ordered as:
13 ; sspreq > sspstrong > ssp > [no ssp]
14 define internal void @fun_sspreq() nounwind sspreq uwtable {
16 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([12 x i8]* @.str3, i32 0, i32 0))
20 define internal void @fun_sspstrong() nounwind sspstrong uwtable {
22 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str2, i32 0, i32 0))
26 define internal void @fun_ssp() nounwind ssp uwtable {
28 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([9 x i8]* @.str1, i32 0, i32 0))
32 define internal void @fun_nossp() nounwind uwtable {
34 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([11 x i8]* @.str, i32 0, i32 0))
40 define void @inline_req_req() nounwind sspreq uwtable {
42 ; CHECK: @inline_req_req() #0
43 call void @fun_sspreq()
47 define void @inline_req_strong() nounwind sspstrong uwtable {
49 ; CHECK: @inline_req_strong() #0
50 call void @fun_sspreq()
54 define void @inline_req_ssp() nounwind ssp uwtable {
56 ; CHECK: @inline_req_ssp() #0
57 call void @fun_sspreq()
61 define void @inline_req_nossp() nounwind uwtable {
63 ; CHECK: @inline_req_nossp() #0
64 call void @fun_sspreq()
68 define void @inline_strong_req() nounwind sspreq uwtable {
70 ; CHECK: @inline_strong_req() #0
71 call void @fun_sspstrong()
76 define void @inline_strong_strong() nounwind sspstrong uwtable {
78 ; CHECK: @inline_strong_strong() #1
79 call void @fun_sspstrong()
83 define void @inline_strong_ssp() nounwind ssp uwtable {
85 ; CHECK: @inline_strong_ssp() #1
86 call void @fun_sspstrong()
90 define void @inline_strong_nossp() nounwind uwtable {
92 ; CHECK: @inline_strong_nossp() #1
93 call void @fun_sspstrong()
97 define void @inline_ssp_req() nounwind sspreq uwtable {
99 ; CHECK: @inline_ssp_req() #0
105 define void @inline_ssp_strong() nounwind sspstrong uwtable {
107 ; CHECK: @inline_ssp_strong() #1
112 define void @inline_ssp_ssp() nounwind ssp uwtable {
114 ; CHECK: @inline_ssp_ssp() #2
119 define void @inline_ssp_nossp() nounwind uwtable {
121 ; CHECK: @inline_ssp_nossp() #2
126 define void @inline_nossp_req() nounwind uwtable sspreq {
128 ; CHECK: @inline_nossp_req() #0
129 call void @fun_nossp()
134 define void @inline_nossp_strong() nounwind sspstrong uwtable {
136 ; CHECK: @inline_nossp_strong() #1
137 call void @fun_nossp()
141 define void @inline_nossp_ssp() nounwind ssp uwtable {
143 ; CHECK: @inline_nossp_ssp() #2
144 call void @fun_nossp()
148 define void @inline_nossp_nossp() nounwind uwtable {
150 ; CHECK: @inline_nossp_nossp() #3
151 call void @fun_nossp()
155 declare i32 @printf(i8*, ...)
157 ; CHECK: attributes #0 = { nounwind sspreq uwtable }
158 ; CHECK: attributes #1 = { nounwind sspstrong uwtable }
159 ; CHECK: attributes #2 = { nounwind ssp uwtable }
160 ; CHECK: attributes #3 = { nounwind uwtable }