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.
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. 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]
15 define internal void @fun_sspreq() nounwind sspreq uwtable {
17 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str3, i32 0, i32 0))
21 define internal void @fun_sspstrong() nounwind sspstrong uwtable {
23 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str2, i32 0, i32 0))
27 define internal void @fun_ssp() nounwind ssp uwtable {
29 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str1, i32 0, i32 0))
33 define internal void @fun_nossp() nounwind uwtable {
35 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i32 0, i32 0))
41 define void @inline_req_req() nounwind sspreq uwtable {
43 ; CHECK: @inline_req_req() #0
44 call void @fun_sspreq()
48 define void @inline_req_strong() nounwind sspstrong uwtable {
50 ; CHECK: @inline_req_strong() #0
51 call void @fun_sspreq()
55 define void @inline_req_ssp() nounwind ssp uwtable {
57 ; CHECK: @inline_req_ssp() #0
58 call void @fun_sspreq()
62 define void @inline_req_nossp() nounwind uwtable {
64 ; CHECK: @inline_req_nossp() #3
65 call void @fun_sspreq()
69 define void @inline_strong_req() nounwind sspreq uwtable {
71 ; CHECK: @inline_strong_req() #0
72 call void @fun_sspstrong()
77 define void @inline_strong_strong() nounwind sspstrong uwtable {
79 ; CHECK: @inline_strong_strong() #1
80 call void @fun_sspstrong()
84 define void @inline_strong_ssp() nounwind ssp uwtable {
86 ; CHECK: @inline_strong_ssp() #1
87 call void @fun_sspstrong()
91 define void @inline_strong_nossp() nounwind uwtable {
93 ; CHECK: @inline_strong_nossp() #3
94 call void @fun_sspstrong()
98 define void @inline_ssp_req() nounwind sspreq uwtable {
100 ; CHECK: @inline_ssp_req() #0
106 define void @inline_ssp_strong() nounwind sspstrong uwtable {
108 ; CHECK: @inline_ssp_strong() #1
113 define void @inline_ssp_ssp() nounwind ssp uwtable {
115 ; CHECK: @inline_ssp_ssp() #2
120 define void @inline_ssp_nossp() nounwind uwtable {
122 ; CHECK: @inline_ssp_nossp() #3
127 define void @inline_nossp_req() nounwind uwtable sspreq {
129 ; CHECK: @inline_nossp_req() #0
130 call void @fun_nossp()
135 define void @inline_nossp_strong() nounwind sspstrong uwtable {
137 ; CHECK: @inline_nossp_strong() #1
138 call void @fun_nossp()
142 define void @inline_nossp_ssp() nounwind ssp uwtable {
144 ; CHECK: @inline_nossp_ssp() #2
145 call void @fun_nossp()
149 define void @inline_nossp_nossp() nounwind uwtable {
151 ; CHECK: @inline_nossp_nossp() #3
152 call void @fun_nossp()
156 declare i32 @printf(i8*, ...)
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 }