blob: e3835e0d9454d78cef72e319251b7db4aa116d93 [file] [log] [blame]
Bill Wendlingd154e2832013-01-23 06:41:41 +00001; RUN: opt -inline %s -S | FileCheck %s
2; Ensure SSP attributes are propagated correctly when inlining.
3
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
8
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]
Bill Wendling1c7cc8a2013-01-31 23:16:25 +000014define internal void @fun_sspreq() nounwind sspreq uwtable {
Bill Wendlingd154e2832013-01-23 06:41:41 +000015entry:
16 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([12 x i8]* @.str3, i32 0, i32 0))
17 ret void
18}
19
Bill Wendling1c7cc8a2013-01-31 23:16:25 +000020define internal void @fun_sspstrong() nounwind sspstrong uwtable {
Bill Wendlingd154e2832013-01-23 06:41:41 +000021entry:
22 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str2, i32 0, i32 0))
23 ret void
24}
25
Bill Wendling1c7cc8a2013-01-31 23:16:25 +000026define internal void @fun_ssp() nounwind ssp uwtable {
Bill Wendlingd154e2832013-01-23 06:41:41 +000027entry:
28 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([9 x i8]* @.str1, i32 0, i32 0))
29 ret void
30}
31
32define internal void @fun_nossp() nounwind uwtable {
33entry:
34 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([11 x i8]* @.str, i32 0, i32 0))
35 ret void
36}
37
38; Tests start below
39
Bill Wendling1c7cc8a2013-01-31 23:16:25 +000040define void @inline_req_req() nounwind sspreq uwtable {
Bill Wendlingd154e2832013-01-23 06:41:41 +000041entry:
Bill Wendlingf2955aa2013-01-29 03:20:31 +000042; CHECK: @inline_req_req() nounwind sspreq uwtable
Bill Wendlingd154e2832013-01-23 06:41:41 +000043 call void @fun_sspreq()
44 ret void
45}
46
Bill Wendling1c7cc8a2013-01-31 23:16:25 +000047define void @inline_req_strong() nounwind sspstrong uwtable {
Bill Wendlingd154e2832013-01-23 06:41:41 +000048entry:
Bill Wendlingf2955aa2013-01-29 03:20:31 +000049; CHECK: @inline_req_strong() nounwind sspreq uwtable
Bill Wendlingd154e2832013-01-23 06:41:41 +000050 call void @fun_sspreq()
51 ret void
52}
53
Bill Wendling1c7cc8a2013-01-31 23:16:25 +000054define void @inline_req_ssp() nounwind ssp uwtable {
Bill Wendlingd154e2832013-01-23 06:41:41 +000055entry:
Bill Wendlingf2955aa2013-01-29 03:20:31 +000056; CHECK: @inline_req_ssp() nounwind sspreq uwtable
Bill Wendlingd154e2832013-01-23 06:41:41 +000057 call void @fun_sspreq()
58 ret void
59}
60
61define void @inline_req_nossp() nounwind uwtable {
62entry:
Bill Wendlingf2955aa2013-01-29 03:20:31 +000063; CHECK: @inline_req_nossp() nounwind sspreq uwtable
Bill Wendlingd154e2832013-01-23 06:41:41 +000064 call void @fun_sspreq()
65 ret void
66}
67
Bill Wendling1c7cc8a2013-01-31 23:16:25 +000068define void @inline_strong_req() nounwind sspreq uwtable {
Bill Wendlingd154e2832013-01-23 06:41:41 +000069entry:
Bill Wendlingf2955aa2013-01-29 03:20:31 +000070; CHECK: @inline_strong_req() nounwind sspreq uwtable
Bill Wendlingd154e2832013-01-23 06:41:41 +000071 call void @fun_sspstrong()
72 ret void
73}
74
75
Bill Wendling1c7cc8a2013-01-31 23:16:25 +000076define void @inline_strong_strong() nounwind sspstrong uwtable {
Bill Wendlingd154e2832013-01-23 06:41:41 +000077entry:
Bill Wendling1c7cc8a2013-01-31 23:16:25 +000078; CHECK: @inline_strong_strong() nounwind sspstrong uwtable
Bill Wendlingd154e2832013-01-23 06:41:41 +000079 call void @fun_sspstrong()
80 ret void
81}
82
Bill Wendling1c7cc8a2013-01-31 23:16:25 +000083define void @inline_strong_ssp() nounwind ssp uwtable {
Bill Wendlingd154e2832013-01-23 06:41:41 +000084entry:
Bill Wendling1c7cc8a2013-01-31 23:16:25 +000085; CHECK: @inline_strong_ssp() nounwind sspstrong uwtable
Bill Wendlingd154e2832013-01-23 06:41:41 +000086 call void @fun_sspstrong()
87 ret void
88}
89
90define void @inline_strong_nossp() nounwind uwtable {
91entry:
Bill Wendling1c7cc8a2013-01-31 23:16:25 +000092; CHECK: @inline_strong_nossp() nounwind sspstrong uwtable
Bill Wendlingd154e2832013-01-23 06:41:41 +000093 call void @fun_sspstrong()
94 ret void
95}
96
Bill Wendling1c7cc8a2013-01-31 23:16:25 +000097define void @inline_ssp_req() nounwind sspreq uwtable {
Bill Wendlingd154e2832013-01-23 06:41:41 +000098entry:
Bill Wendlingf2955aa2013-01-29 03:20:31 +000099; CHECK: @inline_ssp_req() nounwind sspreq uwtable
Bill Wendlingd154e2832013-01-23 06:41:41 +0000100 call void @fun_ssp()
101 ret void
102}
103
104
Bill Wendling1c7cc8a2013-01-31 23:16:25 +0000105define void @inline_ssp_strong() nounwind sspstrong uwtable {
Bill Wendlingd154e2832013-01-23 06:41:41 +0000106entry:
Bill Wendling1c7cc8a2013-01-31 23:16:25 +0000107; CHECK: @inline_ssp_strong() nounwind sspstrong uwtable
Bill Wendlingd154e2832013-01-23 06:41:41 +0000108 call void @fun_ssp()
109 ret void
110}
111
Bill Wendling1c7cc8a2013-01-31 23:16:25 +0000112define void @inline_ssp_ssp() nounwind ssp uwtable {
Bill Wendlingd154e2832013-01-23 06:41:41 +0000113entry:
Bill Wendlingf2955aa2013-01-29 03:20:31 +0000114; CHECK: @inline_ssp_ssp() nounwind ssp uwtable
Bill Wendlingd154e2832013-01-23 06:41:41 +0000115 call void @fun_ssp()
116 ret void
117}
118
119define void @inline_ssp_nossp() nounwind uwtable {
120entry:
Bill Wendlingf2955aa2013-01-29 03:20:31 +0000121; CHECK: @inline_ssp_nossp() nounwind ssp uwtable
Bill Wendlingd154e2832013-01-23 06:41:41 +0000122 call void @fun_ssp()
123 ret void
124}
125
126define void @inline_nossp_req() nounwind uwtable sspreq {
127entry:
Bill Wendlingf2955aa2013-01-29 03:20:31 +0000128; CHECK: @inline_nossp_req() nounwind sspreq uwtable
Bill Wendlingd154e2832013-01-23 06:41:41 +0000129 call void @fun_nossp()
130 ret void
131}
132
133
Bill Wendling1c7cc8a2013-01-31 23:16:25 +0000134define void @inline_nossp_strong() nounwind sspstrong uwtable {
Bill Wendlingd154e2832013-01-23 06:41:41 +0000135entry:
Bill Wendling1c7cc8a2013-01-31 23:16:25 +0000136; CHECK: @inline_nossp_strong() nounwind sspstrong uwtable
Bill Wendlingd154e2832013-01-23 06:41:41 +0000137 call void @fun_nossp()
138 ret void
139}
140
Bill Wendling1c7cc8a2013-01-31 23:16:25 +0000141define void @inline_nossp_ssp() nounwind ssp uwtable {
Bill Wendlingd154e2832013-01-23 06:41:41 +0000142entry:
Bill Wendlingf2955aa2013-01-29 03:20:31 +0000143; CHECK: @inline_nossp_ssp() nounwind ssp uwtable
Bill Wendlingd154e2832013-01-23 06:41:41 +0000144 call void @fun_nossp()
145 ret void
146}
147
148define void @inline_nossp_nossp() nounwind uwtable {
149entry:
150; CHECK: @inline_nossp_nossp() nounwind uwtable
151 call void @fun_nossp()
152 ret void
153}
154
155declare i32 @printf(i8*, ...)