Temporary revert of 175320.
[oota-llvm.git] / test / CodeGen / X86 / stack-protector.ll
1 ; RUN: llc -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck --check-prefix=LINUX-I386 %s
2 ; RUN: llc -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck --check-prefix=LINUX-X64 %s
3 ; RUN: llc -code-model=kernel -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck --check-prefix=LINUX-KERNEL-X64 %s
4 ; RUN: llc -mtriple=x86_64-apple-darwin < %s -o - | FileCheck --check-prefix=DARWIN-X64 %s
5
6 %struct.foo = type { [16 x i8] }
7 %struct.foo.0 = type { [4 x i8] }
8 %struct.pair = type { i32, i32 }
9 %struct.nest = type { %struct.pair, %struct.pair }
10 %struct.vec = type { <4 x i32> }
11 %class.A = type { [2 x i8] }
12 %struct.deep = type { %union.anon }
13 %union.anon = type { %struct.anon }
14 %struct.anon = type { %struct.anon.0 }
15 %struct.anon.0 = type { %union.anon.1 }
16 %union.anon.1 = type { [2 x i8] }
17 %struct.small = type { i8 }
18
19 @.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
20
21 ; test1a: array of [16 x i8] 
22 ;         no ssp attribute
23 ; Requires no protector.
24 define void @test1a(i8* %a) nounwind uwtable {
25 entry:
26 ; LINUX-I386: test1a:
27 ; LINUX-I386-NOT: calll __stack_chk_fail
28 ; LINUX-I386: .cfi_endproc
29
30 ; LINUX-X64: test1a:
31 ; LINUX-X64-NOT: callq __stack_chk_fail
32 ; LINUX-X64: .cfi_endproc
33
34 ; LINUX-KERNEL-X64: test1a:
35 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
36 ; LINUX-KERNEL-X64: .cfi_endproc
37
38 ; DARWIN-X64: test1a:
39 ; DARWIN-X64-NOT: callq ___stack_chk_fail
40 ; DARWIN-X64: .cfi_endproc
41   %a.addr = alloca i8*, align 8
42   %buf = alloca [16 x i8], align 16
43   store i8* %a, i8** %a.addr, align 8
44   %arraydecay = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0
45   %0 = load i8** %a.addr, align 8
46   %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
47   %arraydecay1 = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0
48   %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1)
49   ret void
50 }
51
52 ; test1b: array of [16 x i8] 
53 ;         ssp attribute
54 ; Requires protector.
55 define void @test1b(i8* %a) nounwind uwtable ssp {
56 entry:
57 ; LINUX-I386: test1b:
58 ; LINUX-I386: mov{{l|q}} %gs:
59 ; LINUX-I386: calll __stack_chk_fail
60
61 ; LINUX-X64: test1b:
62 ; LINUX-X64: mov{{l|q}} %fs:
63 ; LINUX-X64: callq __stack_chk_fail
64
65 ; LINUX-KERNEL-X64: test1b:
66 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
67 ; LINUX-KERNEL-X64: callq __stack_chk_fail
68
69 ; DARWIN-X64: test1b:
70 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
71 ; DARWIN-X64: callq ___stack_chk_fail
72   %a.addr = alloca i8*, align 8
73   %buf = alloca [16 x i8], align 16
74   store i8* %a, i8** %a.addr, align 8
75   %arraydecay = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0
76   %0 = load i8** %a.addr, align 8
77   %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
78   %arraydecay1 = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0
79   %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1)
80   ret void
81 }
82
83 ; test1c: array of [16 x i8] 
84 ;         sspstrong attribute
85 ; Requires protector.
86 define void @test1c(i8* %a) nounwind uwtable sspstrong {
87 entry:
88 ; LINUX-I386: test1c:
89 ; LINUX-I386: mov{{l|q}} %gs:
90 ; LINUX-I386: calll __stack_chk_fail
91
92 ; LINUX-X64: test1c:
93 ; LINUX-X64: mov{{l|q}} %fs:
94 ; LINUX-X64: callq __stack_chk_fail
95
96 ; LINUX-KERNEL-X64: test1c:
97 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
98 ; LINUX-KERNEL-X64: callq __stack_chk_fail
99
100 ; DARWIN-X64: test1c:
101 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
102 ; DARWIN-X64: callq ___stack_chk_fail
103   %a.addr = alloca i8*, align 8
104   %buf = alloca [16 x i8], align 16
105   store i8* %a, i8** %a.addr, align 8
106   %arraydecay = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0
107   %0 = load i8** %a.addr, align 8
108   %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
109   %arraydecay1 = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0
110   %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1)
111   ret void
112 }
113
114 ; test1d: array of [16 x i8] 
115 ;         sspreq attribute
116 ; Requires protector.
117 define void @test1d(i8* %a) nounwind uwtable sspreq {
118 entry:
119 ; LINUX-I386: test1d:
120 ; LINUX-I386: mov{{l|q}} %gs:
121 ; LINUX-I386: calll __stack_chk_fail
122
123 ; LINUX-X64: test1d:
124 ; LINUX-X64: mov{{l|q}} %fs:
125 ; LINUX-X64: callq __stack_chk_fail
126
127 ; LINUX-KERNEL-X64: test1d:
128 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
129 ; LINUX-KERNEL-X64: callq __stack_chk_fail
130
131 ; DARWIN-X64: test1d:
132 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
133 ; DARWIN-X64: callq ___stack_chk_fail
134   %a.addr = alloca i8*, align 8
135   %buf = alloca [16 x i8], align 16
136   store i8* %a, i8** %a.addr, align 8
137   %arraydecay = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0
138   %0 = load i8** %a.addr, align 8
139   %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
140   %arraydecay1 = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0
141   %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1)
142   ret void
143 }
144
145 ; test2a: struct { [16 x i8] }
146 ;         no ssp attribute
147 ; Requires no protector.
148 define void @test2a(i8* %a) nounwind uwtable {
149 entry:
150 ; LINUX-I386: test2a:
151 ; LINUX-I386-NOT: calll __stack_chk_fail
152 ; LINUX-I386: .cfi_endproc
153
154 ; LINUX-X64: test2a:
155 ; LINUX-X64-NOT: callq __stack_chk_fail
156 ; LINUX-X64: .cfi_endproc
157
158 ; LINUX-KERNEL-X64: test2a:
159 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
160 ; LINUX-KERNEL-X64: .cfi_endproc
161
162 ; DARWIN-X64: test2a:
163 ; DARWIN-X64-NOT: callq ___stack_chk_fail
164 ; DARWIN-X64: .cfi_endproc
165   %a.addr = alloca i8*, align 8
166   %b = alloca %struct.foo, align 1
167   store i8* %a, i8** %a.addr, align 8
168   %buf = getelementptr inbounds %struct.foo* %b, i32 0, i32 0
169   %arraydecay = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0
170   %0 = load i8** %a.addr, align 8
171   %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
172   %buf1 = getelementptr inbounds %struct.foo* %b, i32 0, i32 0
173   %arraydecay2 = getelementptr inbounds [16 x i8]* %buf1, i32 0, i32 0
174   %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2)
175   ret void
176 }
177
178 ; test2b: struct { [16 x i8] }
179 ;          ssp attribute
180 ; Requires protector.
181 define void @test2b(i8* %a) nounwind uwtable ssp {
182 entry:
183 ; LINUX-I386: test2b:
184 ; LINUX-I386: mov{{l|q}} %gs:
185 ; LINUX-I386: calll __stack_chk_fail
186
187 ; LINUX-X64: test2b:
188 ; LINUX-X64: mov{{l|q}} %fs:
189 ; LINUX-X64: callq __stack_chk_fail
190
191 ; LINUX-KERNEL-X64: test2b:
192 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
193 ; LINUX-KERNEL-X64: callq __stack_chk_fail
194
195 ; DARWIN-X64: test2b:
196 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
197 ; DARWIN-X64: callq ___stack_chk_fail
198   %a.addr = alloca i8*, align 8
199   %b = alloca %struct.foo, align 1
200   store i8* %a, i8** %a.addr, align 8
201   %buf = getelementptr inbounds %struct.foo* %b, i32 0, i32 0
202   %arraydecay = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0
203   %0 = load i8** %a.addr, align 8
204   %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
205   %buf1 = getelementptr inbounds %struct.foo* %b, i32 0, i32 0
206   %arraydecay2 = getelementptr inbounds [16 x i8]* %buf1, i32 0, i32 0
207   %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2)
208   ret void
209 }
210
211 ; test2c: struct { [16 x i8] }
212 ;          sspstrong attribute
213 ; Requires protector.
214 define void @test2c(i8* %a) nounwind uwtable sspstrong {
215 entry:
216 ; LINUX-I386: test2c:
217 ; LINUX-I386: mov{{l|q}} %gs:
218 ; LINUX-I386: calll __stack_chk_fail
219
220 ; LINUX-X64: test2c:
221 ; LINUX-X64: mov{{l|q}} %fs:
222 ; LINUX-X64: callq __stack_chk_fail
223
224 ; LINUX-KERNEL-X64: test2c:
225 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
226 ; LINUX-KERNEL-X64: callq __stack_chk_fail
227
228 ; DARWIN-X64: test2c:
229 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
230 ; DARWIN-X64: callq ___stack_chk_fail
231   %a.addr = alloca i8*, align 8
232   %b = alloca %struct.foo, align 1
233   store i8* %a, i8** %a.addr, align 8
234   %buf = getelementptr inbounds %struct.foo* %b, i32 0, i32 0
235   %arraydecay = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0
236   %0 = load i8** %a.addr, align 8
237   %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
238   %buf1 = getelementptr inbounds %struct.foo* %b, i32 0, i32 0
239   %arraydecay2 = getelementptr inbounds [16 x i8]* %buf1, i32 0, i32 0
240   %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2)
241   ret void
242 }
243
244 ; test2d: struct { [16 x i8] }
245 ;          sspreq attribute
246 ; Requires protector.
247 define void @test2d(i8* %a) nounwind uwtable sspreq {
248 entry:
249 ; LINUX-I386: test2d:
250 ; LINUX-I386: mov{{l|q}} %gs:
251 ; LINUX-I386: calll __stack_chk_fail
252
253 ; LINUX-X64: test2d:
254 ; LINUX-X64: mov{{l|q}} %fs:
255 ; LINUX-X64: callq __stack_chk_fail
256
257 ; LINUX-KERNEL-X64: test2d:
258 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
259 ; LINUX-KERNEL-X64: callq __stack_chk_fail
260
261 ; DARWIN-X64: test2d:
262 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
263 ; DARWIN-X64: callq ___stack_chk_fail
264   %a.addr = alloca i8*, align 8
265   %b = alloca %struct.foo, align 1
266   store i8* %a, i8** %a.addr, align 8
267   %buf = getelementptr inbounds %struct.foo* %b, i32 0, i32 0
268   %arraydecay = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0
269   %0 = load i8** %a.addr, align 8
270   %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
271   %buf1 = getelementptr inbounds %struct.foo* %b, i32 0, i32 0
272   %arraydecay2 = getelementptr inbounds [16 x i8]* %buf1, i32 0, i32 0
273   %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2)
274   ret void
275 }
276
277 ; test3a:  array of [4 x i8]
278 ;          no ssp attribute
279 ; Requires no protector.
280 define void @test3a(i8* %a) nounwind uwtable {
281 entry:
282 ; LINUX-I386: test3a:
283 ; LINUX-I386-NOT: calll __stack_chk_fail
284 ; LINUX-I386: .cfi_endproc
285
286 ; LINUX-X64: test3a:
287 ; LINUX-X64-NOT: callq __stack_chk_fail
288 ; LINUX-X64: .cfi_endproc
289
290 ; LINUX-KERNEL-X64: test3a:
291 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
292 ; LINUX-KERNEL-X64: .cfi_endproc
293
294 ; DARWIN-X64: test3a:
295 ; DARWIN-X64-NOT: callq ___stack_chk_fail
296 ; DARWIN-X64: .cfi_endproc
297   %a.addr = alloca i8*, align 8
298   %buf = alloca [4 x i8], align 1
299   store i8* %a, i8** %a.addr, align 8
300   %arraydecay = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0
301   %0 = load i8** %a.addr, align 8
302   %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
303   %arraydecay1 = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0
304   %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1)
305   ret void
306 }
307
308 ; test3b:  array [4 x i8]
309 ;          ssp attribute
310 ; Requires no protector.
311 define void @test3b(i8* %a) nounwind uwtable ssp {
312 entry:
313 ; LINUX-I386: test3b:
314 ; LINUX-I386-NOT: calll __stack_chk_fail
315 ; LINUX-I386: .cfi_endproc
316
317 ; LINUX-X64: test3b:
318 ; LINUX-X64-NOT: callq __stack_chk_fail
319 ; LINUX-X64: .cfi_endproc
320
321 ; LINUX-KERNEL-X64: test3b:
322 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
323 ; LINUX-KERNEL-X64: .cfi_endproc
324
325 ; DARWIN-X64: test3b:
326 ; DARWIN-X64-NOT: callq ___stack_chk_fail
327 ; DARWIN-X64: .cfi_endproc
328   %a.addr = alloca i8*, align 8
329   %buf = alloca [4 x i8], align 1
330   store i8* %a, i8** %a.addr, align 8
331   %arraydecay = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0
332   %0 = load i8** %a.addr, align 8
333   %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
334   %arraydecay1 = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0
335   %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1)
336   ret void
337 }
338
339 ; test3c:  array of [4 x i8]
340 ;          sspstrong attribute
341 ; Requires protector.
342 define void @test3c(i8* %a) nounwind uwtable sspstrong {
343 entry:
344 ; LINUX-I386: test3c:
345 ; LINUX-I386: mov{{l|q}} %gs:
346 ; LINUX-I386: calll __stack_chk_fail
347
348 ; LINUX-X64: test3c:
349 ; LINUX-X64: mov{{l|q}} %fs:
350 ; LINUX-X64: callq __stack_chk_fail
351
352 ; LINUX-KERNEL-X64: test3c:
353 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
354 ; LINUX-KERNEL-X64: callq __stack_chk_fail
355
356 ; DARWIN-X64: test3c:
357 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
358 ; DARWIN-X64: callq ___stack_chk_fail
359   %a.addr = alloca i8*, align 8
360   %buf = alloca [4 x i8], align 1
361   store i8* %a, i8** %a.addr, align 8
362   %arraydecay = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0
363   %0 = load i8** %a.addr, align 8
364   %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
365   %arraydecay1 = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0
366   %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1)
367   ret void
368 }
369
370 ; test3d:  array of [4 x i8]
371 ;          sspreq attribute
372 ; Requires protector.
373 define void @test3d(i8* %a) nounwind uwtable sspreq {
374 entry:
375 ; LINUX-I386: test3d:
376 ; LINUX-I386: mov{{l|q}} %gs:
377 ; LINUX-I386: calll __stack_chk_fail
378
379 ; LINUX-X64: test3d:
380 ; LINUX-X64: mov{{l|q}} %fs:
381 ; LINUX-X64: callq __stack_chk_fail
382
383 ; LINUX-KERNEL-X64: test3d:
384 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
385 ; LINUX-KERNEL-X64: callq __stack_chk_fail
386
387 ; DARWIN-X64: test3d:
388 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
389 ; DARWIN-X64: callq ___stack_chk_fail
390   %a.addr = alloca i8*, align 8
391   %buf = alloca [4 x i8], align 1
392   store i8* %a, i8** %a.addr, align 8
393   %arraydecay = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0
394   %0 = load i8** %a.addr, align 8
395   %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
396   %arraydecay1 = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0
397   %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1)
398   ret void
399 }
400
401 ; test4a:  struct { [4 x i8] }
402 ;          no ssp attribute
403 ; Requires no protector.
404 define void @test4a(i8* %a) nounwind uwtable {
405 entry:
406 ; LINUX-I386: test4a:
407 ; LINUX-I386-NOT: calll __stack_chk_fail
408 ; LINUX-I386: .cfi_endproc
409
410 ; LINUX-X64: test4a:
411 ; LINUX-X64-NOT: callq __stack_chk_fail
412 ; LINUX-X64: .cfi_endproc
413
414 ; LINUX-KERNEL-X64: test4a:
415 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
416 ; LINUX-KERNEL-X64: .cfi_endproc
417
418 ; DARWIN-X64: test4a:
419 ; DARWIN-X64-NOT: callq ___stack_chk_fail
420 ; DARWIN-X64: .cfi_endproc
421   %a.addr = alloca i8*, align 8
422   %b = alloca %struct.foo.0, align 1
423   store i8* %a, i8** %a.addr, align 8
424   %buf = getelementptr inbounds %struct.foo.0* %b, i32 0, i32 0
425   %arraydecay = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0
426   %0 = load i8** %a.addr, align 8
427   %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
428   %buf1 = getelementptr inbounds %struct.foo.0* %b, i32 0, i32 0
429   %arraydecay2 = getelementptr inbounds [4 x i8]* %buf1, i32 0, i32 0
430   %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2)
431   ret void
432 }
433
434 ; test4b:  struct { [4 x i8] }
435 ;          ssp attribute
436 ; Requires no protector.
437 define void @test4b(i8* %a) nounwind uwtable ssp {
438 entry:
439 ; LINUX-I386: test4b:
440 ; LINUX-I386-NOT: calll __stack_chk_fail
441 ; LINUX-I386: .cfi_endproc
442
443 ; LINUX-X64: test4b:
444 ; LINUX-X64-NOT: callq __stack_chk_fail
445 ; LINUX-X64: .cfi_endproc
446
447 ; LINUX-KERNEL-X64: test4b:
448 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
449 ; LINUX-KERNEL-X64: .cfi_endproc
450
451 ; DARWIN-X64: test4b:
452 ; DARWIN-X64-NOT: callq ___stack_chk_fail
453 ; DARWIN-X64: .cfi_endproc
454   %a.addr = alloca i8*, align 8
455   %b = alloca %struct.foo.0, align 1
456   store i8* %a, i8** %a.addr, align 8
457   %buf = getelementptr inbounds %struct.foo.0* %b, i32 0, i32 0
458   %arraydecay = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0
459   %0 = load i8** %a.addr, align 8
460   %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
461   %buf1 = getelementptr inbounds %struct.foo.0* %b, i32 0, i32 0
462   %arraydecay2 = getelementptr inbounds [4 x i8]* %buf1, i32 0, i32 0
463   %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2)
464   ret void
465 }
466
467 ; test4c:  struct { [4 x i8] }
468 ;          sspstrong attribute
469 ; Requires protector.
470 define void @test4c(i8* %a) nounwind uwtable sspstrong {
471 entry:
472 ; LINUX-I386: test4c:
473 ; LINUX-I386: mov{{l|q}} %gs:
474 ; LINUX-I386: calll __stack_chk_fail
475
476 ; LINUX-X64: test4c:
477 ; LINUX-X64: mov{{l|q}} %fs:
478 ; LINUX-X64: callq __stack_chk_fail
479
480 ; LINUX-KERNEL-X64: test4c:
481 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
482 ; LINUX-KERNEL-X64: callq __stack_chk_fail
483
484 ; DARWIN-X64: test4c:
485 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
486 ; DARWIN-X64: callq ___stack_chk_fail
487   %a.addr = alloca i8*, align 8
488   %b = alloca %struct.foo.0, align 1
489   store i8* %a, i8** %a.addr, align 8
490   %buf = getelementptr inbounds %struct.foo.0* %b, i32 0, i32 0
491   %arraydecay = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0
492   %0 = load i8** %a.addr, align 8
493   %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
494   %buf1 = getelementptr inbounds %struct.foo.0* %b, i32 0, i32 0
495   %arraydecay2 = getelementptr inbounds [4 x i8]* %buf1, i32 0, i32 0
496   %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2)
497   ret void
498 }
499
500 ; test4d:  struct { [4 x i8] }
501 ;          sspreq attribute
502 ; Requires protector.
503 define void @test4d(i8* %a) nounwind uwtable sspreq {
504 entry:
505 ; LINUX-I386: test4d:
506 ; LINUX-I386: mov{{l|q}} %gs:
507 ; LINUX-I386: calll __stack_chk_fail
508
509 ; LINUX-X64: test4d:
510 ; LINUX-X64: mov{{l|q}} %fs:
511 ; LINUX-X64: callq __stack_chk_fail
512
513 ; LINUX-KERNEL-X64: test4d:
514 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
515 ; LINUX-KERNEL-X64: callq __stack_chk_fail
516
517 ; DARWIN-X64: test4d:
518 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
519 ; DARWIN-X64: callq ___stack_chk_fail
520   %a.addr = alloca i8*, align 8
521   %b = alloca %struct.foo.0, align 1
522   store i8* %a, i8** %a.addr, align 8
523   %buf = getelementptr inbounds %struct.foo.0* %b, i32 0, i32 0
524   %arraydecay = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0
525   %0 = load i8** %a.addr, align 8
526   %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
527   %buf1 = getelementptr inbounds %struct.foo.0* %b, i32 0, i32 0
528   %arraydecay2 = getelementptr inbounds [4 x i8]* %buf1, i32 0, i32 0
529   %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2)
530   ret void
531 }
532
533 ; test5a:  no arrays / no nested arrays
534 ;          no ssp attribute
535 ; Requires no protector.
536 define void @test5a(i8* %a) nounwind uwtable {
537 entry:
538 ; LINUX-I386: test5a:
539 ; LINUX-I386-NOT: calll __stack_chk_fail
540 ; LINUX-I386: .cfi_endproc
541
542 ; LINUX-X64: test5a:
543 ; LINUX-X64-NOT: callq __stack_chk_fail
544 ; LINUX-X64: .cfi_endproc
545
546 ; LINUX-KERNEL-X64: test5a:
547 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
548 ; LINUX-KERNEL-X64: .cfi_endproc
549
550 ; DARWIN-X64: test5a:
551 ; DARWIN-X64-NOT: callq ___stack_chk_fail
552 ; DARWIN-X64: .cfi_endproc
553   %a.addr = alloca i8*, align 8
554   store i8* %a, i8** %a.addr, align 8
555   %0 = load i8** %a.addr, align 8
556   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %0)
557   ret void
558 }
559
560 ; test5b:  no arrays / no nested arrays
561 ;          ssp attribute
562 ; Requires no protector.
563 define void @test5b(i8* %a) nounwind uwtable ssp {
564 entry:
565 ; LINUX-I386: test5b:
566 ; LINUX-I386-NOT: calll __stack_chk_fail
567 ; LINUX-I386: .cfi_endproc
568
569 ; LINUX-X64: test5b:
570 ; LINUX-X64-NOT: callq __stack_chk_fail
571 ; LINUX-X64: .cfi_endproc
572
573 ; LINUX-KERNEL-X64: test5b:
574 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
575 ; LINUX-KERNEL-X64: .cfi_endproc
576
577 ; DARWIN-X64: test5b:
578 ; DARWIN-X64-NOT: callq ___stack_chk_fail
579 ; DARWIN-X64: .cfi_endproc
580   %a.addr = alloca i8*, align 8
581   store i8* %a, i8** %a.addr, align 8
582   %0 = load i8** %a.addr, align 8
583   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %0)
584   ret void
585 }
586
587 ; test5c:  no arrays / no nested arrays
588 ;          sspstrong attribute
589 ; Requires no protector.
590 define void @test5c(i8* %a) nounwind uwtable sspstrong {
591 entry:
592 ; LINUX-I386: test5c:
593 ; LINUX-I386-NOT: calll __stack_chk_fail
594 ; LINUX-I386: .cfi_endproc
595
596 ; LINUX-X64: test5c:
597 ; LINUX-X64-NOT: callq __stack_chk_fail
598 ; LINUX-X64: .cfi_endproc
599
600 ; LINUX-KERNEL-X64: test5c:
601 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
602 ; LINUX-KERNEL-X64: .cfi_endproc
603
604 ; DARWIN-X64: test5c:
605 ; DARWIN-X64-NOT: callq ___stack_chk_fail
606 ; DARWIN-X64: .cfi_endproc
607   %a.addr = alloca i8*, align 8
608   store i8* %a, i8** %a.addr, align 8
609   %0 = load i8** %a.addr, align 8
610   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %0)
611   ret void
612 }
613
614 ; test5d:  no arrays / no nested arrays
615 ;          sspreq attribute
616 ; Requires protector.
617 define void @test5d(i8* %a) nounwind uwtable sspreq {
618 entry:
619 ; LINUX-I386: test5d:
620 ; LINUX-I386: mov{{l|q}} %gs:
621 ; LINUX-I386: calll __stack_chk_fail
622
623 ; LINUX-X64: test5d:
624 ; LINUX-X64: mov{{l|q}} %fs:
625 ; LINUX-X64: callq __stack_chk_fail
626
627 ; LINUX-KERNEL-X64: test5d:
628 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
629 ; LINUX-KERNEL-X64: callq __stack_chk_fail
630
631 ; DARWIN-X64: test5d:
632 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
633 ; DARWIN-X64: callq ___stack_chk_fail
634   %a.addr = alloca i8*, align 8
635   store i8* %a, i8** %a.addr, align 8
636   %0 = load i8** %a.addr, align 8
637   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %0)
638   ret void
639 }
640
641 ; test6a:  Address-of local taken (j = &a)
642 ;          no ssp attribute
643 ; Requires no protector.
644 define void @test6a() nounwind uwtable {
645 entry:
646 ; LINUX-I386: test6a:
647 ; LINUX-I386-NOT: calll __stack_chk_fail
648 ; LINUX-I386: .cfi_endproc
649
650 ; LINUX-X64: test6a:
651 ; LINUX-X64-NOT: callq __stack_chk_fail
652 ; LINUX-X64: .cfi_endproc
653
654 ; LINUX-KERNEL-X64: test6a:
655 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
656 ; LINUX-KERNEL-X64: .cfi_endproc
657
658 ; DARWIN-X64: test6a:
659 ; DARWIN-X64-NOT: callq ___stack_chk_fail
660 ; DARWIN-X64: .cfi_endproc
661   %retval = alloca i32, align 4
662   %a = alloca i32, align 4
663   %j = alloca i32*, align 8
664   store i32 0, i32* %retval
665   %0 = load i32* %a, align 4
666   %add = add nsw i32 %0, 1
667   store i32 %add, i32* %a, align 4
668   store i32* %a, i32** %j, align 8
669   ret void
670 }
671
672 ; test6b:  Address-of local taken (j = &a)
673 ;          ssp attribute
674 ; Requires no protector.
675 define void @test6b() nounwind uwtable ssp {
676 entry:
677 ; LINUX-I386: test6b:
678 ; LINUX-I386-NOT: calll __stack_chk_fail
679 ; LINUX-I386: .cfi_endproc
680
681 ; LINUX-X64: test6b:
682 ; LINUX-X64-NOT: callq __stack_chk_fail
683 ; LINUX-X64: .cfi_endproc
684
685 ; LINUX-KERNEL-X64: test6b:
686 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
687 ; LINUX-KERNEL-X64: .cfi_endproc
688
689 ; DARWIN-X64: test6b:
690 ; DARWIN-X64-NOT: callq ___stack_chk_fail
691 ; DARWIN-X64: .cfi_endproc
692   %retval = alloca i32, align 4
693   %a = alloca i32, align 4
694   %j = alloca i32*, align 8
695   store i32 0, i32* %retval
696   %0 = load i32* %a, align 4
697   %add = add nsw i32 %0, 1
698   store i32 %add, i32* %a, align 4
699   store i32* %a, i32** %j, align 8
700   ret void
701 }
702
703 ; test6c:  Address-of local taken (j = &a)
704 ;          sspstrong attribute
705 ; Requires protector.
706 define void @test6c() nounwind uwtable sspstrong {
707 entry:
708 ; LINUX-I386: test6c:
709 ; LINUX-I386: mov{{l|q}} %gs:
710 ; LINUX-I386: calll __stack_chk_fail
711
712 ; LINUX-X64: test6c:
713 ; LINUX-X64: mov{{l|q}} %fs:
714 ; LINUX-X64: callq __stack_chk_fail
715
716 ; LINUX-KERNEL-X64: test6c:
717 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
718 ; LINUX-KERNEL-X64: callq __stack_chk_fail
719
720 ; DARWIN-X64: test6c:
721 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
722 ; DARWIN-X64: callq ___stack_chk_fail
723   %retval = alloca i32, align 4
724   %a = alloca i32, align 4
725   %j = alloca i32*, align 8
726   store i32 0, i32* %retval
727   %0 = load i32* %a, align 4
728   %add = add nsw i32 %0, 1
729   store i32 %add, i32* %a, align 4
730   store i32* %a, i32** %j, align 8
731   ret void
732 }
733
734 ; test6d:  Address-of local taken (j = &a)
735 ;          sspreq attribute
736 ; Requires protector.
737 define void @test6d() nounwind uwtable sspreq {
738 entry:
739 ; LINUX-I386: test6d:
740 ; LINUX-I386: mov{{l|q}} %gs:
741 ; LINUX-I386: calll __stack_chk_fail
742
743 ; LINUX-X64: test6d:
744 ; LINUX-X64: mov{{l|q}} %fs:
745 ; LINUX-X64: callq __stack_chk_fail
746
747 ; LINUX-KERNEL-X64: test6d:
748 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
749 ; LINUX-KERNEL-X64: callq __stack_chk_fail
750
751 ; DARWIN-X64: test6d:
752 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
753 ; DARWIN-X64: callq ___stack_chk_fail
754   %retval = alloca i32, align 4
755   %a = alloca i32, align 4
756   %j = alloca i32*, align 8
757   store i32 0, i32* %retval
758   %0 = load i32* %a, align 4
759   %add = add nsw i32 %0, 1
760   store i32 %add, i32* %a, align 4
761   store i32* %a, i32** %j, align 8
762   ret void
763 }
764
765 ; test7a:  PtrToInt Cast
766 ;          no ssp attribute
767 ; Requires no protector.
768 define void @test7a() nounwind uwtable readnone {
769 entry:
770 ; LINUX-I386: test7a:
771 ; LINUX-I386-NOT: calll __stack_chk_fail
772 ; LINUX-I386: .cfi_endproc
773
774 ; LINUX-X64: test7a:
775 ; LINUX-X64-NOT: callq __stack_chk_fail
776 ; LINUX-X64: .cfi_endproc
777
778 ; LINUX-KERNEL-X64: test7a:
779 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
780 ; LINUX-KERNEL-X64: .cfi_endproc
781
782 ; DARWIN-X64: test7a:
783 ; DARWIN-X64-NOT: callq ___stack_chk_fail
784 ; DARWIN-X64: .cfi_endproc
785   %a = alloca i32, align 4
786   %0 = ptrtoint i32* %a to i64
787   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %0)
788   ret void
789 }
790
791 ; test7b:  PtrToInt Cast
792 ;          ssp attribute
793 ; Requires no protector.
794 define void @test7b() nounwind uwtable readnone ssp {
795 entry:
796 ; LINUX-I386: test7b:
797 ; LINUX-I386-NOT: calll __stack_chk_fail
798 ; LINUX-I386: .cfi_endproc
799
800 ; LINUX-X64: test7b:
801 ; LINUX-X64-NOT: callq __stack_chk_fail
802 ; LINUX-X64: .cfi_endproc
803
804 ; LINUX-KERNEL-X64: test7b:
805 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
806 ; LINUX-KERNEL-X64: .cfi_endproc
807
808 ; DARWIN-X64: test7b:
809 ; DARWIN-X64-NOT: callq ___stack_chk_fail
810 ; DARWIN-X64: .cfi_endproc
811   %a = alloca i32, align 4
812   %0 = ptrtoint i32* %a to i64
813   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %0)
814   ret void
815 }
816
817 ; test7c:  PtrToInt Cast
818 ;          sspstrong attribute
819 ; Requires protector.
820 define void @test7c() nounwind uwtable readnone sspstrong {
821 entry:
822 ; LINUX-I386: test7c:
823 ; LINUX-I386: mov{{l|q}} %gs:
824 ; LINUX-I386: calll __stack_chk_fail
825
826 ; LINUX-X64: test7c:
827 ; LINUX-X64: mov{{l|q}} %fs:
828 ; LINUX-X64: callq __stack_chk_fail
829
830 ; LINUX-KERNEL-X64: test7c:
831 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
832 ; LINUX-KERNEL-X64: callq __stack_chk_fail
833
834 ; DARWIN-X64: test7c:
835 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
836 ; DARWIN-X64: callq ___stack_chk_fail
837   %a = alloca i32, align 4
838   %0 = ptrtoint i32* %a to i64
839   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %0)
840   ret void
841 }
842
843 ; test7d:  PtrToInt Cast
844 ;          sspreq attribute
845 ; Requires protector.
846 define void @test7d() nounwind uwtable readnone sspreq {
847 entry:
848 ; LINUX-I386: test7d:
849 ; LINUX-I386: mov{{l|q}} %gs:
850 ; LINUX-I386: calll __stack_chk_fail
851
852 ; LINUX-X64: test7d:
853 ; LINUX-X64: mov{{l|q}} %fs:
854 ; LINUX-X64: callq __stack_chk_fail
855
856 ; LINUX-KERNEL-X64: test7d:
857 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
858 ; LINUX-KERNEL-X64: callq __stack_chk_fail
859
860 ; DARWIN-X64: test7d:
861 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
862 ; DARWIN-X64: callq ___stack_chk_fail
863   %a = alloca i32, align 4
864   %0 = ptrtoint i32* %a to i64
865   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %0)
866   ret void
867 }
868
869 ; test8a:  Passing addr-of to function call
870 ;          no ssp attribute
871 ; Requires no protector.
872 define void @test8a() nounwind uwtable {
873 entry:
874 ; LINUX-I386: test8a:
875 ; LINUX-I386-NOT: calll __stack_chk_fail
876 ; LINUX-I386: .cfi_endproc
877
878 ; LINUX-X64: test8a:
879 ; LINUX-X64-NOT: callq __stack_chk_fail
880 ; LINUX-X64: .cfi_endproc
881
882 ; LINUX-KERNEL-X64: test8a:
883 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
884 ; LINUX-KERNEL-X64: .cfi_endproc
885
886 ; DARWIN-X64: test8a:
887 ; DARWIN-X64-NOT: callq ___stack_chk_fail
888 ; DARWIN-X64: .cfi_endproc
889   %b = alloca i32, align 4
890   call void @funcall(i32* %b) nounwind
891   ret void
892 }
893
894 ; test8b:  Passing addr-of to function call
895 ;          ssp attribute
896 ; Requires no protector.
897 define void @test8b() nounwind uwtable ssp {
898 entry:
899 ; LINUX-I386: test8b:
900 ; LINUX-I386-NOT: calll __stack_chk_fail
901 ; LINUX-I386: .cfi_endproc
902
903 ; LINUX-X64: test8b:
904 ; LINUX-X64-NOT: callq __stack_chk_fail
905 ; LINUX-X64: .cfi_endproc
906
907 ; LINUX-KERNEL-X64: test8b:
908 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
909 ; LINUX-KERNEL-X64: .cfi_endproc
910
911 ; DARWIN-X64: test8b:
912 ; DARWIN-X64-NOT: callq ___stack_chk_fail
913 ; DARWIN-X64: .cfi_endproc
914   %b = alloca i32, align 4
915   call void @funcall(i32* %b) nounwind
916   ret void
917 }
918
919 ; test8c:  Passing addr-of to function call
920 ;          sspstrong attribute
921 ; Requires protector.
922 define void @test8c() nounwind uwtable sspstrong {
923 entry:
924 ; LINUX-I386: test8c:
925 ; LINUX-I386: mov{{l|q}} %gs:
926 ; LINUX-I386: calll __stack_chk_fail
927
928 ; LINUX-X64: test8c:
929 ; LINUX-X64: mov{{l|q}} %fs:
930 ; LINUX-X64: callq __stack_chk_fail
931
932 ; LINUX-KERNEL-X64: test8c:
933 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
934 ; LINUX-KERNEL-X64: callq __stack_chk_fail
935
936 ; DARWIN-X64: test8c:
937 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
938 ; DARWIN-X64: callq ___stack_chk_fail
939   %b = alloca i32, align 4
940   call void @funcall(i32* %b) nounwind
941   ret void
942 }
943
944 ; test8d:  Passing addr-of to function call
945 ;          sspreq attribute
946 ; Requires protector.
947 define void @test8d() nounwind uwtable sspreq {
948 entry:
949 ; LINUX-I386: test8d:
950 ; LINUX-I386: mov{{l|q}} %gs:
951 ; LINUX-I386: calll __stack_chk_fail
952
953 ; LINUX-X64: test8d:
954 ; LINUX-X64: mov{{l|q}} %fs:
955 ; LINUX-X64: callq __stack_chk_fail
956
957 ; LINUX-KERNEL-X64: test8d:
958 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
959 ; LINUX-KERNEL-X64: callq __stack_chk_fail
960
961 ; DARWIN-X64: test8d:
962 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
963 ; DARWIN-X64: callq ___stack_chk_fail
964   %b = alloca i32, align 4
965   call void @funcall(i32* %b) nounwind
966   ret void
967 }
968
969 ; test9a:  Addr-of in select instruction
970 ;          no ssp attribute
971 ; Requires no protector.
972 define void @test9a() nounwind uwtable {
973 entry:
974 ; LINUX-I386: test9a:
975 ; LINUX-I386-NOT: calll __stack_chk_fail
976 ; LINUX-I386: .cfi_endproc
977
978 ; LINUX-X64: test9a:
979 ; LINUX-X64-NOT: callq __stack_chk_fail
980 ; LINUX-X64: .cfi_endproc
981
982 ; LINUX-KERNEL-X64: test9a:
983 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
984 ; LINUX-KERNEL-X64: .cfi_endproc
985
986 ; DARWIN-X64: test9a:
987 ; DARWIN-X64-NOT: callq ___stack_chk_fail
988 ; DARWIN-X64: .cfi_endproc
989   %x = alloca double, align 8
990   %call = call double @testi_aux() nounwind
991   store double %call, double* %x, align 8
992   %cmp2 = fcmp ogt double %call, 0.000000e+00
993   %y.1 = select i1 %cmp2, double* %x, double* null
994   %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), double* %y.1)
995   ret void
996 }
997
998 ; test9b:  Addr-of in select instruction
999 ;          ssp attribute
1000 ; Requires no protector.
1001 define void @test9b() nounwind uwtable ssp {
1002 entry:
1003 ; LINUX-I386: test9b:
1004 ; LINUX-I386-NOT: calll __stack_chk_fail
1005 ; LINUX-I386: .cfi_endproc
1006
1007 ; LINUX-X64: test9b:
1008 ; LINUX-X64-NOT: callq __stack_chk_fail
1009 ; LINUX-X64: .cfi_endproc
1010
1011 ; LINUX-KERNEL-X64: test9b:
1012 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1013 ; LINUX-KERNEL-X64: .cfi_endproc
1014
1015 ; DARWIN-X64: test9b:
1016 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1017 ; DARWIN-X64: .cfi_endproc
1018   %x = alloca double, align 8
1019   %call = call double @testi_aux() nounwind
1020   store double %call, double* %x, align 8
1021   %cmp2 = fcmp ogt double %call, 0.000000e+00
1022   %y.1 = select i1 %cmp2, double* %x, double* null
1023   %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), double* %y.1)
1024   ret void
1025 }
1026
1027 ; test9c:  Addr-of in select instruction
1028 ;          sspstrong attribute
1029 ; Requires protector.
1030 define void @test9c() nounwind uwtable sspstrong {
1031 entry:
1032 ; LINUX-I386: test9c:
1033 ; LINUX-I386: mov{{l|q}} %gs:
1034 ; LINUX-I386: calll __stack_chk_fail
1035
1036 ; LINUX-X64: test9c:
1037 ; LINUX-X64: mov{{l|q}} %fs:
1038 ; LINUX-X64: callq __stack_chk_fail
1039
1040 ; LINUX-KERNEL-X64: test9c:
1041 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1042 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1043
1044 ; DARWIN-X64: test9c:
1045 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1046 ; DARWIN-X64: callq ___stack_chk_fail
1047   %x = alloca double, align 8
1048   %call = call double @testi_aux() nounwind
1049   store double %call, double* %x, align 8
1050   %cmp2 = fcmp ogt double %call, 0.000000e+00
1051   %y.1 = select i1 %cmp2, double* %x, double* null
1052   %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), double* %y.1)
1053   ret void
1054 }
1055
1056 ; test9d:  Addr-of in select instruction
1057 ;          sspreq attribute
1058 ; Requires protector.
1059 define void @test9d() nounwind uwtable sspreq {
1060 entry:
1061 ; LINUX-I386: test9d:
1062 ; LINUX-I386: mov{{l|q}} %gs:
1063 ; LINUX-I386: calll __stack_chk_fail
1064
1065 ; LINUX-X64: test9d:
1066 ; LINUX-X64: mov{{l|q}} %fs:
1067 ; LINUX-X64: callq __stack_chk_fail
1068
1069 ; LINUX-KERNEL-X64: test9d:
1070 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1071 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1072
1073 ; DARWIN-X64: test9d:
1074 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1075 ; DARWIN-X64: callq ___stack_chk_fail
1076   %x = alloca double, align 8
1077   %call = call double @testi_aux() nounwind
1078   store double %call, double* %x, align 8
1079   %cmp2 = fcmp ogt double %call, 0.000000e+00
1080   %y.1 = select i1 %cmp2, double* %x, double* null
1081   %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), double* %y.1)
1082   ret void
1083 }
1084
1085 ; test10a: Addr-of in phi instruction
1086 ;          no ssp attribute
1087 ; Requires no protector.
1088 define void @test10a() nounwind uwtable {
1089 entry:
1090 ; LINUX-I386: test10a:
1091 ; LINUX-I386-NOT: calll __stack_chk_fail
1092 ; LINUX-I386: .cfi_endproc
1093
1094 ; LINUX-X64: test10a:
1095 ; LINUX-X64-NOT: callq __stack_chk_fail
1096 ; LINUX-X64: .cfi_endproc
1097
1098 ; LINUX-KERNEL-X64: test10a:
1099 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1100 ; LINUX-KERNEL-X64: .cfi_endproc
1101
1102 ; DARWIN-X64: test10a:
1103 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1104 ; DARWIN-X64: .cfi_endproc
1105   %x = alloca double, align 8
1106   %call = call double @testi_aux() nounwind
1107   store double %call, double* %x, align 8
1108   %cmp = fcmp ogt double %call, 3.140000e+00
1109   br i1 %cmp, label %if.then, label %if.else
1110
1111 if.then:                                          ; preds = %entry
1112   %call1 = call double @testi_aux() nounwind
1113   store double %call1, double* %x, align 8
1114   br label %if.end4
1115
1116 if.else:                                          ; preds = %entry
1117   %cmp2 = fcmp ogt double %call, 1.000000e+00
1118   br i1 %cmp2, label %if.then3, label %if.end4
1119
1120 if.then3:                                         ; preds = %if.else
1121   br label %if.end4
1122
1123 if.end4:                                          ; preds = %if.else, %if.then3, %if.then
1124   %y.0 = phi double* [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ]
1125   %call5 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), double* %y.0) nounwind
1126   ret void
1127 }
1128
1129 ; test10b: Addr-of in phi instruction
1130 ;          ssp attribute
1131 ; Requires no protector.
1132 define void @test10b() nounwind uwtable ssp {
1133 entry:
1134 ; LINUX-I386: test10b:
1135 ; LINUX-I386-NOT: calll __stack_chk_fail
1136 ; LINUX-I386: .cfi_endproc
1137
1138 ; LINUX-X64: test10b:
1139 ; LINUX-X64-NOT: callq __stack_chk_fail
1140 ; LINUX-X64: .cfi_endproc
1141
1142 ; LINUX-KERNEL-X64: test10b:
1143 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1144 ; LINUX-KERNEL-X64: .cfi_endproc
1145
1146 ; DARWIN-X64: test10b:
1147 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1148 ; DARWIN-X64: .cfi_endproc
1149   %x = alloca double, align 8
1150   %call = call double @testi_aux() nounwind
1151   store double %call, double* %x, align 8
1152   %cmp = fcmp ogt double %call, 3.140000e+00
1153   br i1 %cmp, label %if.then, label %if.else
1154
1155 if.then:                                          ; preds = %entry
1156   %call1 = call double @testi_aux() nounwind
1157   store double %call1, double* %x, align 8
1158   br label %if.end4
1159
1160 if.else:                                          ; preds = %entry
1161   %cmp2 = fcmp ogt double %call, 1.000000e+00
1162   br i1 %cmp2, label %if.then3, label %if.end4
1163
1164 if.then3:                                         ; preds = %if.else
1165   br label %if.end4
1166
1167 if.end4:                                          ; preds = %if.else, %if.then3, %if.then
1168   %y.0 = phi double* [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ]
1169   %call5 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), double* %y.0) nounwind
1170   ret void
1171 }
1172
1173 ; test10c: Addr-of in phi instruction
1174 ;          sspstrong attribute
1175 ; Requires protector.
1176 define void @test10c() nounwind uwtable sspstrong {
1177 entry:
1178 ; LINUX-I386: test10c:
1179 ; LINUX-I386: mov{{l|q}} %gs:
1180 ; LINUX-I386: calll __stack_chk_fail
1181
1182 ; LINUX-X64: test10c:
1183 ; LINUX-X64: mov{{l|q}} %fs:
1184 ; LINUX-X64: callq __stack_chk_fail
1185
1186 ; LINUX-KERNEL-X64: test10c:
1187 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1188 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1189
1190 ; DARWIN-X64: test10c:
1191 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1192 ; DARWIN-X64: callq ___stack_chk_fail
1193   %x = alloca double, align 8
1194   %call = call double @testi_aux() nounwind
1195   store double %call, double* %x, align 8
1196   %cmp = fcmp ogt double %call, 3.140000e+00
1197   br i1 %cmp, label %if.then, label %if.else
1198
1199 if.then:                                          ; preds = %entry
1200   %call1 = call double @testi_aux() nounwind
1201   store double %call1, double* %x, align 8
1202   br label %if.end4
1203
1204 if.else:                                          ; preds = %entry
1205   %cmp2 = fcmp ogt double %call, 1.000000e+00
1206   br i1 %cmp2, label %if.then3, label %if.end4
1207
1208 if.then3:                                         ; preds = %if.else
1209   br label %if.end4
1210
1211 if.end4:                                          ; preds = %if.else, %if.then3, %if.then
1212   %y.0 = phi double* [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ]
1213   %call5 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), double* %y.0) nounwind
1214   ret void
1215 }
1216
1217 ; test10d: Addr-of in phi instruction
1218 ;          sspreq attribute
1219 ; Requires protector.
1220 define void @test10d() nounwind uwtable sspreq {
1221 entry:
1222 ; LINUX-I386: test10d:
1223 ; LINUX-I386: mov{{l|q}} %gs:
1224 ; LINUX-I386: calll __stack_chk_fail
1225
1226 ; LINUX-X64: test10d:
1227 ; LINUX-X64: mov{{l|q}} %fs:
1228 ; LINUX-X64: callq __stack_chk_fail
1229
1230 ; LINUX-KERNEL-X64: test10d:
1231 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1232 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1233
1234 ; DARWIN-X64: test10d:
1235 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1236 ; DARWIN-X64: callq ___stack_chk_fail
1237   %x = alloca double, align 8
1238   %call = call double @testi_aux() nounwind
1239   store double %call, double* %x, align 8
1240   %cmp = fcmp ogt double %call, 3.140000e+00
1241   br i1 %cmp, label %if.then, label %if.else
1242
1243 if.then:                                          ; preds = %entry
1244   %call1 = call double @testi_aux() nounwind
1245   store double %call1, double* %x, align 8
1246   br label %if.end4
1247
1248 if.else:                                          ; preds = %entry
1249   %cmp2 = fcmp ogt double %call, 1.000000e+00
1250   br i1 %cmp2, label %if.then3, label %if.end4
1251
1252 if.then3:                                         ; preds = %if.else
1253   br label %if.end4
1254
1255 if.end4:                                          ; preds = %if.else, %if.then3, %if.then
1256   %y.0 = phi double* [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ]
1257   %call5 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), double* %y.0) nounwind
1258   ret void
1259 }
1260
1261 ; test11a: Addr-of struct element. (GEP followed by store).
1262 ;          no ssp attribute
1263 ; Requires no protector.
1264 define void @test11a() nounwind uwtable {
1265 entry:
1266 ; LINUX-I386: test11a:
1267 ; LINUX-I386-NOT: calll __stack_chk_fail
1268 ; LINUX-I386: .cfi_endproc
1269
1270 ; LINUX-X64: test11a:
1271 ; LINUX-X64-NOT: callq __stack_chk_fail
1272 ; LINUX-X64: .cfi_endproc
1273
1274 ; LINUX-KERNEL-X64: test11a:
1275 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1276 ; LINUX-KERNEL-X64: .cfi_endproc
1277
1278 ; DARWIN-X64: test11a:
1279 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1280 ; DARWIN-X64: .cfi_endproc
1281   %c = alloca %struct.pair, align 4
1282   %b = alloca i32*, align 8
1283   %y = getelementptr inbounds %struct.pair* %c, i32 0, i32 1
1284   store i32* %y, i32** %b, align 8
1285   %0 = load i32** %b, align 8
1286   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i32* %0)
1287   ret void
1288 }
1289
1290 ; test11b: Addr-of struct element. (GEP followed by store).
1291 ;          ssp attribute
1292 ; Requires no protector.
1293 define void @test11b() nounwind uwtable ssp {
1294 entry:
1295 ; LINUX-I386: test11b:
1296 ; LINUX-I386-NOT: calll __stack_chk_fail
1297 ; LINUX-I386: .cfi_endproc
1298
1299 ; LINUX-X64: test11b:
1300 ; LINUX-X64-NOT: callq __stack_chk_fail
1301 ; LINUX-X64: .cfi_endproc
1302
1303 ; LINUX-KERNEL-X64: test11b:
1304 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1305 ; LINUX-KERNEL-X64: .cfi_endproc
1306
1307 ; DARWIN-X64: test11b:
1308 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1309 ; DARWIN-X64: .cfi_endproc
1310   %c = alloca %struct.pair, align 4
1311   %b = alloca i32*, align 8
1312   %y = getelementptr inbounds %struct.pair* %c, i32 0, i32 1
1313   store i32* %y, i32** %b, align 8
1314   %0 = load i32** %b, align 8
1315   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i32* %0)
1316   ret void
1317 }
1318
1319 ; test11c: Addr-of struct element. (GEP followed by store).
1320 ;          sspstrong attribute
1321 ; Requires protector.
1322 define void @test11c() nounwind uwtable sspstrong {
1323 entry:
1324 ; LINUX-I386: test11c:
1325 ; LINUX-I386: mov{{l|q}} %gs:
1326 ; LINUX-I386: calll __stack_chk_fail
1327
1328 ; LINUX-X64: test11c:
1329 ; LINUX-X64: mov{{l|q}} %fs:
1330 ; LINUX-X64: callq __stack_chk_fail
1331
1332 ; LINUX-KERNEL-X64: test11c:
1333 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1334 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1335
1336 ; DARWIN-X64: test11c:
1337 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1338 ; DARWIN-X64: callq ___stack_chk_fail
1339   %c = alloca %struct.pair, align 4
1340   %b = alloca i32*, align 8
1341   %y = getelementptr inbounds %struct.pair* %c, i32 0, i32 1
1342   store i32* %y, i32** %b, align 8
1343   %0 = load i32** %b, align 8
1344   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i32* %0)
1345   ret void
1346 }
1347
1348 ; test11d: Addr-of struct element. (GEP followed by store).
1349 ;          sspreq attribute
1350 ; Requires protector.
1351 define void @test11d() nounwind uwtable sspreq {
1352 entry:
1353 ; LINUX-I386: test11d:
1354 ; LINUX-I386: mov{{l|q}} %gs:
1355 ; LINUX-I386: calll __stack_chk_fail
1356
1357 ; LINUX-X64: test11d:
1358 ; LINUX-X64: mov{{l|q}} %fs:
1359 ; LINUX-X64: callq __stack_chk_fail
1360
1361 ; LINUX-KERNEL-X64: test11d:
1362 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1363 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1364
1365 ; DARWIN-X64: test11d:
1366 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1367 ; DARWIN-X64: callq ___stack_chk_fail
1368   %c = alloca %struct.pair, align 4
1369   %b = alloca i32*, align 8
1370   %y = getelementptr inbounds %struct.pair* %c, i32 0, i32 1
1371   store i32* %y, i32** %b, align 8
1372   %0 = load i32** %b, align 8
1373   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i32* %0)
1374   ret void
1375 }
1376
1377 ; test12a: Addr-of struct element, GEP followed by ptrtoint.
1378 ;          no ssp attribute
1379 ; Requires no protector.
1380 define void @test12a() nounwind uwtable {
1381 entry:
1382 ; LINUX-I386: test12a:
1383 ; LINUX-I386-NOT: calll __stack_chk_fail
1384 ; LINUX-I386: .cfi_endproc
1385
1386 ; LINUX-X64: test12a:
1387 ; LINUX-X64-NOT: callq __stack_chk_fail
1388 ; LINUX-X64: .cfi_endproc
1389
1390 ; LINUX-KERNEL-X64: test12a:
1391 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1392 ; LINUX-KERNEL-X64: .cfi_endproc
1393
1394 ; DARWIN-X64: test12a:
1395 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1396 ; DARWIN-X64: .cfi_endproc
1397   %c = alloca %struct.pair, align 4
1398   %b = alloca i32*, align 8
1399   %y = getelementptr inbounds %struct.pair* %c, i32 0, i32 1
1400   %0 = ptrtoint i32* %y to i64
1401   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %0)
1402   ret void
1403 }
1404
1405 ; test12b: Addr-of struct element, GEP followed by ptrtoint.
1406 ;          ssp attribute
1407 ; Requires no protector.
1408 define void @test12b() nounwind uwtable ssp {
1409 entry:
1410 ; LINUX-I386: test12b:
1411 ; LINUX-I386-NOT: calll __stack_chk_fail
1412 ; LINUX-I386: .cfi_endproc
1413
1414 ; LINUX-X64: test12b:
1415 ; LINUX-X64-NOT: callq __stack_chk_fail
1416 ; LINUX-X64: .cfi_endproc
1417
1418 ; LINUX-KERNEL-X64: test12b:
1419 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1420 ; LINUX-KERNEL-X64: .cfi_endproc
1421
1422 ; DARWIN-X64: test12b:
1423 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1424 ; DARWIN-X64: .cfi_endproc
1425   %c = alloca %struct.pair, align 4
1426   %b = alloca i32*, align 8
1427   %y = getelementptr inbounds %struct.pair* %c, i32 0, i32 1
1428   %0 = ptrtoint i32* %y to i64
1429   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %0)
1430   ret void
1431 }
1432
1433 ; test12c: Addr-of struct element, GEP followed by ptrtoint.
1434 ;          sspstrong attribute
1435 ; Requires protector.
1436 define void @test12c() nounwind uwtable sspstrong {
1437 entry:
1438 ; LINUX-I386: test12c:
1439 ; LINUX-I386: mov{{l|q}} %gs:
1440 ; LINUX-I386: calll __stack_chk_fail
1441
1442 ; LINUX-X64: test12c:
1443 ; LINUX-X64: mov{{l|q}} %fs:
1444 ; LINUX-X64: callq __stack_chk_fail
1445
1446 ; LINUX-KERNEL-X64: test12c:
1447 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1448 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1449
1450 ; DARWIN-X64: test12c:
1451 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1452 ; DARWIN-X64: callq ___stack_chk_fail
1453   %c = alloca %struct.pair, align 4
1454   %b = alloca i32*, align 8
1455   %y = getelementptr inbounds %struct.pair* %c, i32 0, i32 1
1456   %0 = ptrtoint i32* %y to i64
1457   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %0)
1458   ret void
1459 }
1460
1461 ; test12d: Addr-of struct element, GEP followed by ptrtoint.
1462 ;          sspreq attribute
1463 ; Requires protector.
1464 define void @test12d() nounwind uwtable sspreq {
1465 entry:
1466 ; LINUX-I386: test12d:
1467 ; LINUX-I386: mov{{l|q}} %gs:
1468 ; LINUX-I386: calll __stack_chk_fail
1469
1470 ; LINUX-X64: test12d:
1471 ; LINUX-X64: mov{{l|q}} %fs:
1472 ; LINUX-X64: callq __stack_chk_fail
1473
1474 ; LINUX-KERNEL-X64: test12d:
1475 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1476 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1477
1478 ; DARWIN-X64: test12d:
1479 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1480 ; DARWIN-X64: callq ___stack_chk_fail
1481   %c = alloca %struct.pair, align 4
1482   %b = alloca i32*, align 8
1483   %y = getelementptr inbounds %struct.pair* %c, i32 0, i32 1
1484   %0 = ptrtoint i32* %y to i64
1485   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %0)
1486   ret void
1487 }
1488
1489 ; test13a: Addr-of struct element, GEP followed by callinst.
1490 ;          no ssp attribute
1491 ; Requires no protector.
1492 define void @test13a() nounwind uwtable {
1493 entry:
1494 ; LINUX-I386: test13a:
1495 ; LINUX-I386-NOT: calll __stack_chk_fail
1496 ; LINUX-I386: .cfi_endproc
1497
1498 ; LINUX-X64: test13a:
1499 ; LINUX-X64-NOT: callq __stack_chk_fail
1500 ; LINUX-X64: .cfi_endproc
1501
1502 ; LINUX-KERNEL-X64: test13a:
1503 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1504 ; LINUX-KERNEL-X64: .cfi_endproc
1505
1506 ; DARWIN-X64: test13a:
1507 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1508 ; DARWIN-X64: .cfi_endproc
1509   %c = alloca %struct.pair, align 4
1510   %y = getelementptr inbounds %struct.pair* %c, i64 0, i32 1
1511   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32* %y) nounwind
1512   ret void
1513 }
1514
1515 ; test13b: Addr-of struct element, GEP followed by callinst.
1516 ;          ssp attribute
1517 ; Requires no protector.
1518 define void @test13b() nounwind uwtable ssp {
1519 entry:
1520 ; LINUX-I386: test13b:
1521 ; LINUX-I386-NOT: calll __stack_chk_fail
1522 ; LINUX-I386: .cfi_endproc
1523
1524 ; LINUX-X64: test13b:
1525 ; LINUX-X64-NOT: callq __stack_chk_fail
1526 ; LINUX-X64: .cfi_endproc
1527
1528 ; LINUX-KERNEL-X64: test13b:
1529 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1530 ; LINUX-KERNEL-X64: .cfi_endproc
1531
1532 ; DARWIN-X64: test13b:
1533 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1534 ; DARWIN-X64: .cfi_endproc
1535   %c = alloca %struct.pair, align 4
1536   %y = getelementptr inbounds %struct.pair* %c, i64 0, i32 1
1537   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32* %y) nounwind
1538   ret void
1539 }
1540
1541 ; test13c: Addr-of struct element, GEP followed by callinst.
1542 ;          sspstrong attribute
1543 ; Requires protector.
1544 define void @test13c() nounwind uwtable sspstrong {
1545 entry:
1546 ; LINUX-I386: test13c:
1547 ; LINUX-I386: mov{{l|q}} %gs:
1548 ; LINUX-I386: calll __stack_chk_fail
1549
1550 ; LINUX-X64: test13c:
1551 ; LINUX-X64: mov{{l|q}} %fs:
1552 ; LINUX-X64: callq __stack_chk_fail
1553
1554 ; LINUX-KERNEL-X64: test13c:
1555 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1556 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1557
1558 ; DARWIN-X64: test13c:
1559 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1560 ; DARWIN-X64: callq ___stack_chk_fail
1561   %c = alloca %struct.pair, align 4
1562   %y = getelementptr inbounds %struct.pair* %c, i64 0, i32 1
1563   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32* %y) nounwind
1564   ret void
1565 }
1566
1567 ; test13d: Addr-of struct element, GEP followed by callinst.
1568 ;          sspreq attribute
1569 ; Requires protector.
1570 define void @test13d() nounwind uwtable sspreq {
1571 entry:
1572 ; LINUX-I386: test13d:
1573 ; LINUX-I386: mov{{l|q}} %gs:
1574 ; LINUX-I386: calll __stack_chk_fail
1575
1576 ; LINUX-X64: test13d:
1577 ; LINUX-X64: mov{{l|q}} %fs:
1578 ; LINUX-X64: callq __stack_chk_fail
1579
1580 ; LINUX-KERNEL-X64: test13d:
1581 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1582 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1583
1584 ; DARWIN-X64: test13d:
1585 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1586 ; DARWIN-X64: callq ___stack_chk_fail
1587   %c = alloca %struct.pair, align 4
1588   %y = getelementptr inbounds %struct.pair* %c, i64 0, i32 1
1589   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32* %y) nounwind
1590   ret void
1591 }
1592
1593 ; test14a: Addr-of a local, optimized into a GEP (e.g., &a - 12)
1594 ;          no ssp attribute
1595 ; Requires no protector.
1596 define void @test14a() nounwind uwtable {
1597 entry:
1598 ; LINUX-I386: test14a:
1599 ; LINUX-I386-NOT: calll __stack_chk_fail
1600 ; LINUX-I386: .cfi_endproc
1601
1602 ; LINUX-X64: test14a:
1603 ; LINUX-X64-NOT: callq __stack_chk_fail
1604 ; LINUX-X64: .cfi_endproc
1605
1606 ; LINUX-KERNEL-X64: test14a:
1607 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1608 ; LINUX-KERNEL-X64: .cfi_endproc
1609
1610 ; DARWIN-X64: test14a:
1611 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1612 ; DARWIN-X64: .cfi_endproc
1613   %a = alloca i32, align 4
1614   %add.ptr5 = getelementptr inbounds i32* %a, i64 -12
1615   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32* %add.ptr5) nounwind
1616   ret void
1617 }
1618
1619 ; test14b: Addr-of a local, optimized into a GEP (e.g., &a - 12)
1620 ;          ssp attribute
1621 ; Requires no protector.
1622 define void @test14b() nounwind uwtable ssp {
1623 entry:
1624 ; LINUX-I386: test14b:
1625 ; LINUX-I386-NOT: calll __stack_chk_fail
1626 ; LINUX-I386: .cfi_endproc
1627
1628 ; LINUX-X64: test14b:
1629 ; LINUX-X64-NOT: callq __stack_chk_fail
1630 ; LINUX-X64: .cfi_endproc
1631
1632 ; LINUX-KERNEL-X64: test14b:
1633 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1634 ; LINUX-KERNEL-X64: .cfi_endproc
1635
1636 ; DARWIN-X64: test14b:
1637 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1638 ; DARWIN-X64: .cfi_endproc
1639   %a = alloca i32, align 4
1640   %add.ptr5 = getelementptr inbounds i32* %a, i64 -12
1641   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32* %add.ptr5) nounwind
1642   ret void
1643 }
1644
1645 ; test14c: Addr-of a local, optimized into a GEP (e.g., &a - 12)
1646 ;          sspstrong attribute
1647 ; Requires protector.
1648 define void @test14c() nounwind uwtable sspstrong {
1649 entry:
1650 ; LINUX-I386: test14c:
1651 ; LINUX-I386: mov{{l|q}} %gs:
1652 ; LINUX-I386: calll __stack_chk_fail
1653
1654 ; LINUX-X64: test14c:
1655 ; LINUX-X64: mov{{l|q}} %fs:
1656 ; LINUX-X64: callq __stack_chk_fail
1657
1658 ; LINUX-KERNEL-X64: test14c:
1659 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1660 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1661
1662 ; DARWIN-X64: test14c:
1663 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1664 ; DARWIN-X64: callq ___stack_chk_fail
1665   %a = alloca i32, align 4
1666   %add.ptr5 = getelementptr inbounds i32* %a, i64 -12
1667   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32* %add.ptr5) nounwind
1668   ret void
1669 }
1670
1671 ; test14d: Addr-of a local, optimized into a GEP (e.g., &a - 12)
1672 ;          sspreq  attribute
1673 ; Requires protector.
1674 define void @test14d() nounwind uwtable sspreq {
1675 entry:
1676 ; LINUX-I386: test14d:
1677 ; LINUX-I386: mov{{l|q}} %gs:
1678 ; LINUX-I386: calll __stack_chk_fail
1679
1680 ; LINUX-X64: test14d:
1681 ; LINUX-X64: mov{{l|q}} %fs:
1682 ; LINUX-X64: callq __stack_chk_fail
1683
1684 ; LINUX-KERNEL-X64: test14d:
1685 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1686 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1687
1688 ; DARWIN-X64: test14d:
1689 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1690 ; DARWIN-X64: callq ___stack_chk_fail
1691   %a = alloca i32, align 4
1692   %add.ptr5 = getelementptr inbounds i32* %a, i64 -12
1693   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32* %add.ptr5) nounwind
1694   ret void
1695 }
1696
1697 ; test15a: Addr-of a local cast to a ptr of a different type
1698 ;           (e.g., int a; ... ; float *b = &a;)
1699 ;          no ssp attribute
1700 ; Requires no protector.
1701 define void @test15a() nounwind uwtable {
1702 entry:
1703 ; LINUX-I386: test15a:
1704 ; LINUX-I386-NOT: calll __stack_chk_fail
1705 ; LINUX-I386: .cfi_endproc
1706
1707 ; LINUX-X64: test15a:
1708 ; LINUX-X64-NOT: callq __stack_chk_fail
1709 ; LINUX-X64: .cfi_endproc
1710
1711 ; LINUX-KERNEL-X64: test15a:
1712 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1713 ; LINUX-KERNEL-X64: .cfi_endproc
1714
1715 ; DARWIN-X64: test15a:
1716 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1717 ; DARWIN-X64: .cfi_endproc
1718   %a = alloca i32, align 4
1719   %b = alloca float*, align 8
1720   store i32 0, i32* %a, align 4
1721   %0 = bitcast i32* %a to float*
1722   store float* %0, float** %b, align 8
1723   %1 = load float** %b, align 8
1724   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), float* %1)
1725   ret void
1726 }
1727
1728 ; test15b: Addr-of a local cast to a ptr of a different type
1729 ;           (e.g., int a; ... ; float *b = &a;)
1730 ;          ssp attribute
1731 ; Requires no protector.
1732 define void @test15b() nounwind uwtable ssp {
1733 entry:
1734 ; LINUX-I386: test15b:
1735 ; LINUX-I386-NOT: calll __stack_chk_fail
1736 ; LINUX-I386: .cfi_endproc
1737
1738 ; LINUX-X64: test15b:
1739 ; LINUX-X64-NOT: callq __stack_chk_fail
1740 ; LINUX-X64: .cfi_endproc
1741
1742 ; LINUX-KERNEL-X64: test15b:
1743 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1744 ; LINUX-KERNEL-X64: .cfi_endproc
1745
1746 ; DARWIN-X64: test15b:
1747 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1748 ; DARWIN-X64: .cfi_endproc
1749   %a = alloca i32, align 4
1750   %b = alloca float*, align 8
1751   store i32 0, i32* %a, align 4
1752   %0 = bitcast i32* %a to float*
1753   store float* %0, float** %b, align 8
1754   %1 = load float** %b, align 8
1755   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), float* %1)
1756   ret void
1757 }
1758
1759 ; test15c: Addr-of a local cast to a ptr of a different type
1760 ;           (e.g., int a; ... ; float *b = &a;)
1761 ;          sspstrong attribute
1762 ; Requires protector.
1763 define void @test15c() nounwind uwtable sspstrong {
1764 entry:
1765 ; LINUX-I386: test15c:
1766 ; LINUX-I386: mov{{l|q}} %gs:
1767 ; LINUX-I386: calll __stack_chk_fail
1768
1769 ; LINUX-X64: test15c:
1770 ; LINUX-X64: mov{{l|q}} %fs:
1771 ; LINUX-X64: callq __stack_chk_fail
1772
1773 ; LINUX-KERNEL-X64: test15c:
1774 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1775 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1776
1777 ; DARWIN-X64: test15c:
1778 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1779 ; DARWIN-X64: callq ___stack_chk_fail
1780   %a = alloca i32, align 4
1781   %b = alloca float*, align 8
1782   store i32 0, i32* %a, align 4
1783   %0 = bitcast i32* %a to float*
1784   store float* %0, float** %b, align 8
1785   %1 = load float** %b, align 8
1786   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), float* %1)
1787   ret void
1788 }
1789
1790 ; test15d: Addr-of a local cast to a ptr of a different type
1791 ;           (e.g., int a; ... ; float *b = &a;)
1792 ;          sspreq attribute
1793 ; Requires protector.
1794 define void @test15d() nounwind uwtable sspreq {
1795 entry:
1796 ; LINUX-I386: test15d:
1797 ; LINUX-I386: mov{{l|q}} %gs:
1798 ; LINUX-I386: calll __stack_chk_fail
1799
1800 ; LINUX-X64: test15d:
1801 ; LINUX-X64: mov{{l|q}} %fs:
1802 ; LINUX-X64: callq __stack_chk_fail
1803
1804 ; LINUX-KERNEL-X64: test15d:
1805 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1806 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1807
1808 ; DARWIN-X64: test15d:
1809 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1810 ; DARWIN-X64: callq ___stack_chk_fail
1811   %a = alloca i32, align 4
1812   %b = alloca float*, align 8
1813   store i32 0, i32* %a, align 4
1814   %0 = bitcast i32* %a to float*
1815   store float* %0, float** %b, align 8
1816   %1 = load float** %b, align 8
1817   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), float* %1)
1818   ret void
1819 }
1820
1821 ; test16a: Addr-of a local cast to a ptr of a different type (optimized)
1822 ;           (e.g., int a; ... ; float *b = &a;)
1823 ;          no ssp attribute
1824 ; Requires no protector.
1825 define void @test16a() nounwind uwtable {
1826 entry:
1827 ; LINUX-I386: test16a:
1828 ; LINUX-I386-NOT: calll __stack_chk_fail
1829 ; LINUX-I386: .cfi_endproc
1830
1831 ; LINUX-X64: test16a:
1832 ; LINUX-X64-NOT: callq __stack_chk_fail
1833 ; LINUX-X64: .cfi_endproc
1834
1835 ; LINUX-KERNEL-X64: test16a:
1836 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1837 ; LINUX-KERNEL-X64: .cfi_endproc
1838
1839 ; DARWIN-X64: test16a:
1840 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1841 ; DARWIN-X64: .cfi_endproc
1842   %a = alloca i32, align 4
1843   store i32 0, i32* %a, align 4
1844   %0 = bitcast i32* %a to float*
1845   call void @funfloat(float* %0) nounwind
1846   ret void
1847 }
1848
1849 ; test16b: Addr-of a local cast to a ptr of a different type (optimized)
1850 ;           (e.g., int a; ... ; float *b = &a;)
1851 ;          ssp attribute
1852 ; Requires no protector.
1853 define void @test16b() nounwind uwtable ssp {
1854 entry:
1855 ; LINUX-I386: test16b:
1856 ; LINUX-I386-NOT: calll __stack_chk_fail
1857 ; LINUX-I386: .cfi_endproc
1858
1859 ; LINUX-X64: test16b:
1860 ; LINUX-X64-NOT: callq __stack_chk_fail
1861 ; LINUX-X64: .cfi_endproc
1862
1863 ; LINUX-KERNEL-X64: test16b:
1864 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1865 ; LINUX-KERNEL-X64: .cfi_endproc
1866
1867 ; DARWIN-X64: test16b:
1868 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1869 ; DARWIN-X64: .cfi_endproc
1870   %a = alloca i32, align 4
1871   store i32 0, i32* %a, align 4
1872   %0 = bitcast i32* %a to float*
1873   call void @funfloat(float* %0) nounwind
1874   ret void
1875 }
1876
1877 ; test16c: Addr-of a local cast to a ptr of a different type (optimized)
1878 ;           (e.g., int a; ... ; float *b = &a;)
1879 ;          sspstrong attribute
1880 ; Requires protector.
1881 define void @test16c() nounwind uwtable sspstrong {
1882 entry:
1883 ; LINUX-I386: test16c:
1884 ; LINUX-I386: mov{{l|q}} %gs:
1885 ; LINUX-I386: calll __stack_chk_fail
1886
1887 ; LINUX-X64: test16c:
1888 ; LINUX-X64: mov{{l|q}} %fs:
1889 ; LINUX-X64: callq __stack_chk_fail
1890
1891 ; LINUX-KERNEL-X64: test16c:
1892 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1893 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1894
1895 ; DARWIN-X64: test16c:
1896 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1897 ; DARWIN-X64: callq ___stack_chk_fail
1898   %a = alloca i32, align 4
1899   store i32 0, i32* %a, align 4
1900   %0 = bitcast i32* %a to float*
1901   call void @funfloat(float* %0) nounwind
1902   ret void
1903 }
1904
1905 ; test16d: Addr-of a local cast to a ptr of a different type (optimized)
1906 ;           (e.g., int a; ... ; float *b = &a;)
1907 ;          sspreq attribute
1908 ; Requires protector.
1909 define void @test16d() nounwind uwtable sspreq {
1910 entry:
1911 ; LINUX-I386: test16d:
1912 ; LINUX-I386: mov{{l|q}} %gs:
1913 ; LINUX-I386: calll __stack_chk_fail
1914
1915 ; LINUX-X64: test16d:
1916 ; LINUX-X64: mov{{l|q}} %fs:
1917 ; LINUX-X64: callq __stack_chk_fail
1918
1919 ; LINUX-KERNEL-X64: test16d:
1920 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1921 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1922
1923 ; DARWIN-X64: test16d:
1924 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1925 ; DARWIN-X64: callq ___stack_chk_fail
1926   %a = alloca i32, align 4
1927   store i32 0, i32* %a, align 4
1928   %0 = bitcast i32* %a to float*
1929   call void @funfloat(float* %0) nounwind
1930   ret void
1931 }
1932
1933 ; test17a: Addr-of a vector nested in a struct
1934 ;          no ssp attribute
1935 ; Requires no protector.
1936 define void @test17a() nounwind uwtable {
1937 entry:
1938 ; LINUX-I386: test17a:
1939 ; LINUX-I386-NOT: calll __stack_chk_fail
1940 ; LINUX-I386: .cfi_endproc
1941
1942 ; LINUX-X64: test17a:
1943 ; LINUX-X64-NOT: callq __stack_chk_fail
1944 ; LINUX-X64: .cfi_endproc
1945
1946 ; LINUX-KERNEL-X64: test17a:
1947 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1948 ; LINUX-KERNEL-X64: .cfi_endproc
1949
1950 ; DARWIN-X64: test17a:
1951 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1952 ; DARWIN-X64: .cfi_endproc
1953   %c = alloca %struct.vec, align 16
1954   %y = getelementptr inbounds %struct.vec* %c, i64 0, i32 0
1955   %add.ptr = getelementptr inbounds <4 x i32>* %y, i64 -12
1956   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), <4 x i32>* %add.ptr) nounwind
1957   ret void
1958 }
1959
1960 ; test17b: Addr-of a vector nested in a struct
1961 ;          ssp attribute
1962 ; Requires no protector.
1963 define void @test17b() nounwind uwtable ssp {
1964 entry:
1965 ; LINUX-I386: test17b:
1966 ; LINUX-I386-NOT: calll __stack_chk_fail
1967 ; LINUX-I386: .cfi_endproc
1968
1969 ; LINUX-X64: test17b:
1970 ; LINUX-X64-NOT: callq __stack_chk_fail
1971 ; LINUX-X64: .cfi_endproc
1972
1973 ; LINUX-KERNEL-X64: test17b:
1974 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1975 ; LINUX-KERNEL-X64: .cfi_endproc
1976
1977 ; DARWIN-X64: test17b:
1978 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1979 ; DARWIN-X64: .cfi_endproc
1980   %c = alloca %struct.vec, align 16
1981   %y = getelementptr inbounds %struct.vec* %c, i64 0, i32 0
1982   %add.ptr = getelementptr inbounds <4 x i32>* %y, i64 -12
1983   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), <4 x i32>* %add.ptr) nounwind
1984   ret void
1985 }
1986
1987 ; test17c: Addr-of a vector nested in a struct
1988 ;          sspstrong attribute
1989 ; Requires protector.
1990 define void @test17c() nounwind uwtable sspstrong {
1991 entry:
1992 ; LINUX-I386: test17c:
1993 ; LINUX-I386: mov{{l|q}} %gs:
1994 ; LINUX-I386: calll __stack_chk_fail
1995
1996 ; LINUX-X64: test17c:
1997 ; LINUX-X64: mov{{l|q}} %fs:
1998 ; LINUX-X64: callq __stack_chk_fail
1999
2000 ; LINUX-KERNEL-X64: test17c:
2001 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2002 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2003
2004 ; DARWIN-X64: test17c:
2005 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2006 ; DARWIN-X64: callq ___stack_chk_fail
2007   %c = alloca %struct.vec, align 16
2008   %y = getelementptr inbounds %struct.vec* %c, i64 0, i32 0
2009   %add.ptr = getelementptr inbounds <4 x i32>* %y, i64 -12
2010   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), <4 x i32>* %add.ptr) nounwind
2011   ret void
2012 }
2013
2014 ; test17d: Addr-of a vector nested in a struct
2015 ;          sspreq attribute
2016 ; Requires protector.
2017 define void @test17d() nounwind uwtable sspreq {
2018 entry:
2019 ; LINUX-I386: test17d:
2020 ; LINUX-I386: mov{{l|q}} %gs:
2021 ; LINUX-I386: calll __stack_chk_fail
2022
2023 ; LINUX-X64: test17d:
2024 ; LINUX-X64: mov{{l|q}} %fs:
2025 ; LINUX-X64: callq __stack_chk_fail
2026
2027 ; LINUX-KERNEL-X64: test17d:
2028 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2029 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2030
2031 ; DARWIN-X64: test17d:
2032 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2033 ; DARWIN-X64: callq ___stack_chk_fail
2034   %c = alloca %struct.vec, align 16
2035   %y = getelementptr inbounds %struct.vec* %c, i64 0, i32 0
2036   %add.ptr = getelementptr inbounds <4 x i32>* %y, i64 -12
2037   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), <4 x i32>* %add.ptr) nounwind
2038   ret void
2039 }
2040
2041 ; test18a: Addr-of a variable passed into an invoke instruction.
2042 ;          no ssp attribute
2043 ; Requires no protector.
2044 define i32 @test18a() uwtable {
2045 entry:
2046 ; LINUX-I386: test18a:
2047 ; LINUX-I386-NOT: calll __stack_chk_fail
2048 ; LINUX-I386: .cfi_endproc
2049
2050 ; LINUX-X64: test18a:
2051 ; LINUX-X64-NOT: callq __stack_chk_fail
2052 ; LINUX-X64: .cfi_endproc
2053
2054 ; LINUX-KERNEL-X64: test18a:
2055 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2056 ; LINUX-KERNEL-X64: .cfi_endproc
2057
2058 ; DARWIN-X64: test18a:
2059 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2060 ; DARWIN-X64: .cfi_endproc
2061   %a = alloca i32, align 4
2062   %exn.slot = alloca i8*
2063   %ehselector.slot = alloca i32
2064   store i32 0, i32* %a, align 4
2065   invoke void @_Z3exceptPi(i32* %a)
2066           to label %invoke.cont unwind label %lpad
2067
2068 invoke.cont:
2069   ret i32 0
2070
2071 lpad:
2072   %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
2073           catch i8* null
2074   ret i32 0
2075 }
2076
2077 ; test18b: Addr-of a variable passed into an invoke instruction.
2078 ;          ssp attribute
2079 ; Requires no protector.
2080 define i32 @test18b() uwtable ssp {
2081 entry:
2082 ; LINUX-I386: test18b:
2083 ; LINUX-I386-NOT: calll __stack_chk_fail
2084 ; LINUX-I386: .cfi_endproc
2085
2086 ; LINUX-X64: test18b:
2087 ; LINUX-X64-NOT: callq __stack_chk_fail
2088 ; LINUX-X64: .cfi_endproc
2089
2090 ; LINUX-KERNEL-X64: test18b:
2091 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2092 ; LINUX-KERNEL-X64: .cfi_endproc
2093
2094 ; DARWIN-X64: test18b:
2095 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2096 ; DARWIN-X64: .cfi_endproc
2097   %a = alloca i32, align 4
2098   %exn.slot = alloca i8*
2099   %ehselector.slot = alloca i32
2100   store i32 0, i32* %a, align 4
2101   invoke void @_Z3exceptPi(i32* %a)
2102           to label %invoke.cont unwind label %lpad
2103
2104 invoke.cont:
2105   ret i32 0
2106
2107 lpad:
2108   %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
2109           catch i8* null
2110   ret i32 0
2111 }
2112
2113 ; test18c: Addr-of a variable passed into an invoke instruction.
2114 ;          sspstrong attribute
2115 ; Requires protector.
2116 define i32 @test18c() uwtable sspstrong {
2117 entry:
2118 ; LINUX-I386: test18c:
2119 ; LINUX-I386: mov{{l|q}} %gs:
2120 ; LINUX-I386: calll __stack_chk_fail
2121
2122 ; LINUX-X64: test18c:
2123 ; LINUX-X64: mov{{l|q}} %fs:
2124 ; LINUX-X64: callq __stack_chk_fail
2125
2126 ; LINUX-KERNEL-X64: test18c:
2127 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2128 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2129
2130 ; DARWIN-X64: test18c:
2131 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2132 ; DARWIN-X64: callq ___stack_chk_fail
2133   %a = alloca i32, align 4
2134   %exn.slot = alloca i8*
2135   %ehselector.slot = alloca i32
2136   store i32 0, i32* %a, align 4
2137   invoke void @_Z3exceptPi(i32* %a)
2138           to label %invoke.cont unwind label %lpad
2139
2140 invoke.cont:
2141   ret i32 0
2142
2143 lpad:
2144   %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
2145           catch i8* null
2146   ret i32 0
2147 }
2148
2149 ; test18d: Addr-of a variable passed into an invoke instruction.
2150 ;          sspreq attribute
2151 ; Requires protector.
2152 define i32 @test18d() uwtable sspreq {
2153 entry:
2154 ; LINUX-I386: test18d:
2155 ; LINUX-I386: mov{{l|q}} %gs:
2156 ; LINUX-I386: calll __stack_chk_fail
2157
2158 ; LINUX-X64: test18d:
2159 ; LINUX-X64: mov{{l|q}} %fs:
2160 ; LINUX-X64: callq __stack_chk_fail
2161
2162 ; LINUX-KERNEL-X64: test18d:
2163 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2164 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2165
2166 ; DARWIN-X64: test18d:
2167 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2168 ; DARWIN-X64: callq ___stack_chk_fail
2169   %a = alloca i32, align 4
2170   %exn.slot = alloca i8*
2171   %ehselector.slot = alloca i32
2172   store i32 0, i32* %a, align 4
2173   invoke void @_Z3exceptPi(i32* %a)
2174           to label %invoke.cont unwind label %lpad
2175
2176 invoke.cont:
2177   ret i32 0
2178
2179 lpad:
2180   %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
2181           catch i8* null
2182   ret i32 0
2183 }
2184
2185 ; test19a: Addr-of a struct element passed into an invoke instruction.
2186 ;           (GEP followed by an invoke)
2187 ;          no ssp attribute
2188 ; Requires no protector.
2189 define i32 @test19a() uwtable {
2190 entry:
2191 ; LINUX-I386: test19a:
2192 ; LINUX-I386-NOT: calll __stack_chk_fail
2193 ; LINUX-I386: .cfi_endproc
2194
2195 ; LINUX-X64: test19a:
2196 ; LINUX-X64-NOT: callq __stack_chk_fail
2197 ; LINUX-X64: .cfi_endproc
2198
2199 ; LINUX-KERNEL-X64: test19a:
2200 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2201 ; LINUX-KERNEL-X64: .cfi_endproc
2202
2203 ; DARWIN-X64: test19a:
2204 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2205 ; DARWIN-X64: .cfi_endproc
2206   %c = alloca %struct.pair, align 4
2207   %exn.slot = alloca i8*
2208   %ehselector.slot = alloca i32
2209   %a = getelementptr inbounds %struct.pair* %c, i32 0, i32 0
2210   store i32 0, i32* %a, align 4
2211   %a1 = getelementptr inbounds %struct.pair* %c, i32 0, i32 0
2212   invoke void @_Z3exceptPi(i32* %a1)
2213           to label %invoke.cont unwind label %lpad
2214
2215 invoke.cont:
2216   ret i32 0
2217
2218 lpad:
2219   %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
2220           catch i8* null
2221   ret i32 0
2222 }
2223
2224 ; test19b: Addr-of a struct element passed into an invoke instruction.
2225 ;           (GEP followed by an invoke)
2226 ;          ssp attribute
2227 ; Requires no protector.
2228 define i32 @test19b() uwtable ssp {
2229 entry:
2230 ; LINUX-I386: test19b:
2231 ; LINUX-I386-NOT: calll __stack_chk_fail
2232 ; LINUX-I386: .cfi_endproc
2233
2234 ; LINUX-X64: test19b:
2235 ; LINUX-X64-NOT: callq __stack_chk_fail
2236 ; LINUX-X64: .cfi_endproc
2237
2238 ; LINUX-KERNEL-X64: test19b:
2239 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2240 ; LINUX-KERNEL-X64: .cfi_endproc
2241
2242 ; DARWIN-X64: test19b:
2243 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2244 ; DARWIN-X64: .cfi_endproc
2245   %c = alloca %struct.pair, align 4
2246   %exn.slot = alloca i8*
2247   %ehselector.slot = alloca i32
2248   %a = getelementptr inbounds %struct.pair* %c, i32 0, i32 0
2249   store i32 0, i32* %a, align 4
2250   %a1 = getelementptr inbounds %struct.pair* %c, i32 0, i32 0
2251   invoke void @_Z3exceptPi(i32* %a1)
2252           to label %invoke.cont unwind label %lpad
2253
2254 invoke.cont:
2255   ret i32 0
2256
2257 lpad:
2258   %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
2259           catch i8* null
2260   ret i32 0
2261 }
2262
2263 ; test19c: Addr-of a struct element passed into an invoke instruction.
2264 ;           (GEP followed by an invoke)
2265 ;          sspstrong attribute
2266 ; Requires protector.
2267 define i32 @test19c() uwtable sspstrong {
2268 entry:
2269 ; LINUX-I386: test19c:
2270 ; LINUX-I386: mov{{l|q}} %gs:
2271 ; LINUX-I386: calll __stack_chk_fail
2272
2273 ; LINUX-X64: test19c:
2274 ; LINUX-X64: mov{{l|q}} %fs:
2275 ; LINUX-X64: callq __stack_chk_fail
2276
2277 ; LINUX-KERNEL-X64: test19c:
2278 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2279 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2280
2281 ; DARWIN-X64: test19c:
2282 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2283 ; DARWIN-X64: callq ___stack_chk_fail
2284   %c = alloca %struct.pair, align 4
2285   %exn.slot = alloca i8*
2286   %ehselector.slot = alloca i32
2287   %a = getelementptr inbounds %struct.pair* %c, i32 0, i32 0
2288   store i32 0, i32* %a, align 4
2289   %a1 = getelementptr inbounds %struct.pair* %c, i32 0, i32 0
2290   invoke void @_Z3exceptPi(i32* %a1)
2291           to label %invoke.cont unwind label %lpad
2292
2293 invoke.cont:
2294   ret i32 0
2295
2296 lpad:
2297   %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
2298           catch i8* null
2299   ret i32 0
2300 }
2301
2302 ; test19d: Addr-of a struct element passed into an invoke instruction.
2303 ;           (GEP followed by an invoke)
2304 ;          sspreq attribute
2305 ; Requires protector.
2306 define i32 @test19d() uwtable sspreq {
2307 entry:
2308 ; LINUX-I386: test19d:
2309 ; LINUX-I386: mov{{l|q}} %gs:
2310 ; LINUX-I386: calll __stack_chk_fail
2311
2312 ; LINUX-X64: test19d:
2313 ; LINUX-X64: mov{{l|q}} %fs:
2314 ; LINUX-X64: callq __stack_chk_fail
2315
2316 ; LINUX-KERNEL-X64: test19d:
2317 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2318 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2319
2320 ; DARWIN-X64: test19d:
2321 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2322 ; DARWIN-X64: callq ___stack_chk_fail
2323   %c = alloca %struct.pair, align 4
2324   %exn.slot = alloca i8*
2325   %ehselector.slot = alloca i32
2326   %a = getelementptr inbounds %struct.pair* %c, i32 0, i32 0
2327   store i32 0, i32* %a, align 4
2328   %a1 = getelementptr inbounds %struct.pair* %c, i32 0, i32 0
2329   invoke void @_Z3exceptPi(i32* %a1)
2330           to label %invoke.cont unwind label %lpad
2331
2332 invoke.cont:
2333   ret i32 0
2334
2335 lpad:
2336   %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
2337           catch i8* null
2338   ret i32 0
2339 }
2340
2341 ; test20a: Addr-of a pointer
2342 ;          no ssp attribute
2343 ; Requires no protector.
2344 define void @test20a() nounwind uwtable {
2345 entry:
2346 ; LINUX-I386: test20a:
2347 ; LINUX-I386-NOT: calll __stack_chk_fail
2348 ; LINUX-I386: .cfi_endproc
2349
2350 ; LINUX-X64: test20a:
2351 ; LINUX-X64-NOT: callq __stack_chk_fail
2352 ; LINUX-X64: .cfi_endproc
2353
2354 ; LINUX-KERNEL-X64: test20a:
2355 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2356 ; LINUX-KERNEL-X64: .cfi_endproc
2357
2358 ; DARWIN-X64: test20a:
2359 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2360 ; DARWIN-X64: .cfi_endproc
2361   %a = alloca i32*, align 8
2362   %b = alloca i32**, align 8
2363   %call = call i32* @getp()
2364   store i32* %call, i32** %a, align 8
2365   store i32** %a, i32*** %b, align 8
2366   %0 = load i32*** %b, align 8
2367   call void @funcall2(i32** %0)
2368   ret void
2369 }
2370
2371 ; test20b: Addr-of a pointer
2372 ;          ssp attribute
2373 ; Requires no protector.
2374 define void @test20b() nounwind uwtable ssp {
2375 entry:
2376 ; LINUX-I386: test20b:
2377 ; LINUX-I386-NOT: calll __stack_chk_fail
2378 ; LINUX-I386: .cfi_endproc
2379
2380 ; LINUX-X64: test20b:
2381 ; LINUX-X64-NOT: callq __stack_chk_fail
2382 ; LINUX-X64: .cfi_endproc
2383
2384 ; LINUX-KERNEL-X64: test20b:
2385 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2386 ; LINUX-KERNEL-X64: .cfi_endproc
2387
2388 ; DARWIN-X64: test20b:
2389 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2390 ; DARWIN-X64: .cfi_endproc
2391   %a = alloca i32*, align 8
2392   %b = alloca i32**, align 8
2393   %call = call i32* @getp()
2394   store i32* %call, i32** %a, align 8
2395   store i32** %a, i32*** %b, align 8
2396   %0 = load i32*** %b, align 8
2397   call void @funcall2(i32** %0)
2398   ret void
2399 }
2400
2401 ; test20c: Addr-of a pointer
2402 ;          sspstrong attribute
2403 ; Requires protector.
2404 define void @test20c() nounwind uwtable sspstrong {
2405 entry:
2406 ; LINUX-I386: test20c:
2407 ; LINUX-I386: mov{{l|q}} %gs:
2408 ; LINUX-I386: calll __stack_chk_fail
2409
2410 ; LINUX-X64: test20c:
2411 ; LINUX-X64: mov{{l|q}} %fs:
2412 ; LINUX-X64: callq __stack_chk_fail
2413
2414 ; LINUX-KERNEL-X64: test20c:
2415 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2416 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2417
2418 ; DARWIN-X64: test20c:
2419 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2420 ; DARWIN-X64: callq ___stack_chk_fail
2421   %a = alloca i32*, align 8
2422   %b = alloca i32**, align 8
2423   %call = call i32* @getp()
2424   store i32* %call, i32** %a, align 8
2425   store i32** %a, i32*** %b, align 8
2426   %0 = load i32*** %b, align 8
2427   call void @funcall2(i32** %0)
2428   ret void
2429 }
2430
2431 ; test20d: Addr-of a pointer
2432 ;          sspreq attribute
2433 ; Requires protector.
2434 define void @test20d() nounwind uwtable sspreq {
2435 entry:
2436 ; LINUX-I386: test20d:
2437 ; LINUX-I386: mov{{l|q}} %gs:
2438 ; LINUX-I386: calll __stack_chk_fail
2439
2440 ; LINUX-X64: test20d:
2441 ; LINUX-X64: mov{{l|q}} %fs:
2442 ; LINUX-X64: callq __stack_chk_fail
2443
2444 ; LINUX-KERNEL-X64: test20d:
2445 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2446 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2447
2448 ; DARWIN-X64: test20d:
2449 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2450 ; DARWIN-X64: callq ___stack_chk_fail
2451   %a = alloca i32*, align 8
2452   %b = alloca i32**, align 8
2453   %call = call i32* @getp()
2454   store i32* %call, i32** %a, align 8
2455   store i32** %a, i32*** %b, align 8
2456   %0 = load i32*** %b, align 8
2457   call void @funcall2(i32** %0)
2458   ret void
2459 }
2460
2461 ; test21a: Addr-of a casted pointer
2462 ;          no ssp attribute
2463 ; Requires no protector.
2464 define void @test21a() nounwind uwtable {
2465 entry:
2466 ; LINUX-I386: test21a:
2467 ; LINUX-I386-NOT: calll __stack_chk_fail
2468 ; LINUX-I386: .cfi_endproc
2469
2470 ; LINUX-X64: test21a:
2471 ; LINUX-X64-NOT: callq __stack_chk_fail
2472 ; LINUX-X64: .cfi_endproc
2473
2474 ; LINUX-KERNEL-X64: test21a:
2475 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2476 ; LINUX-KERNEL-X64: .cfi_endproc
2477
2478 ; DARWIN-X64: test21a:
2479 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2480 ; DARWIN-X64: .cfi_endproc
2481   %a = alloca i32*, align 8
2482   %b = alloca float**, align 8
2483   %call = call i32* @getp()
2484   store i32* %call, i32** %a, align 8
2485   %0 = bitcast i32** %a to float**
2486   store float** %0, float*** %b, align 8
2487   %1 = load float*** %b, align 8
2488   call void @funfloat2(float** %1)
2489   ret void
2490 }
2491
2492 ; test21b: Addr-of a casted pointer
2493 ;          ssp attribute
2494 ; Requires no protector.
2495 define void @test21b() nounwind uwtable ssp {
2496 entry:
2497 ; LINUX-I386: test21b:
2498 ; LINUX-I386-NOT: calll __stack_chk_fail
2499 ; LINUX-I386: .cfi_endproc
2500
2501 ; LINUX-X64: test21b:
2502 ; LINUX-X64-NOT: callq __stack_chk_fail
2503 ; LINUX-X64: .cfi_endproc
2504
2505 ; LINUX-KERNEL-X64: test21b:
2506 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2507 ; LINUX-KERNEL-X64: .cfi_endproc
2508
2509 ; DARWIN-X64: test21b:
2510 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2511 ; DARWIN-X64: .cfi_endproc
2512   %a = alloca i32*, align 8
2513   %b = alloca float**, align 8
2514   %call = call i32* @getp()
2515   store i32* %call, i32** %a, align 8
2516   %0 = bitcast i32** %a to float**
2517   store float** %0, float*** %b, align 8
2518   %1 = load float*** %b, align 8
2519   call void @funfloat2(float** %1)
2520   ret void
2521 }
2522
2523 ; test21c: Addr-of a casted pointer
2524 ;          sspstrong attribute
2525 ; Requires protector.
2526 define void @test21c() nounwind uwtable sspstrong {
2527 entry:
2528 ; LINUX-I386: test21c:
2529 ; LINUX-I386: mov{{l|q}} %gs:
2530 ; LINUX-I386: calll __stack_chk_fail
2531
2532 ; LINUX-X64: test21c:
2533 ; LINUX-X64: mov{{l|q}} %fs:
2534 ; LINUX-X64: callq __stack_chk_fail
2535
2536 ; LINUX-KERNEL-X64: test21c:
2537 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2538 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2539
2540 ; DARWIN-X64: test21c:
2541 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2542 ; DARWIN-X64: callq ___stack_chk_fail
2543   %a = alloca i32*, align 8
2544   %b = alloca float**, align 8
2545   %call = call i32* @getp()
2546   store i32* %call, i32** %a, align 8
2547   %0 = bitcast i32** %a to float**
2548   store float** %0, float*** %b, align 8
2549   %1 = load float*** %b, align 8
2550   call void @funfloat2(float** %1)
2551   ret void
2552 }
2553
2554 ; test21d: Addr-of a casted pointer
2555 ;          sspreq attribute
2556 ; Requires protector.
2557 define void @test21d() nounwind uwtable sspreq {
2558 entry:
2559 ; LINUX-I386: test21d:
2560 ; LINUX-I386: mov{{l|q}} %gs:
2561 ; LINUX-I386: calll __stack_chk_fail
2562
2563 ; LINUX-X64: test21d:
2564 ; LINUX-X64: mov{{l|q}} %fs:
2565 ; LINUX-X64: callq __stack_chk_fail
2566
2567 ; LINUX-KERNEL-X64: test21d:
2568 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2569 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2570
2571 ; DARWIN-X64: test21d:
2572 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2573 ; DARWIN-X64: callq ___stack_chk_fail
2574   %a = alloca i32*, align 8
2575   %b = alloca float**, align 8
2576   %call = call i32* @getp()
2577   store i32* %call, i32** %a, align 8
2578   %0 = bitcast i32** %a to float**
2579   store float** %0, float*** %b, align 8
2580   %1 = load float*** %b, align 8
2581   call void @funfloat2(float** %1)
2582   ret void
2583 }
2584
2585 ; test22a: [2 x i8] in a class
2586 ;          no ssp attribute
2587 ; Requires no protector.
2588 define signext i8 @test22a() nounwind uwtable {
2589 entry:
2590 ; LINUX-I386: test22a:
2591 ; LINUX-I386-NOT: calll __stack_chk_fail
2592 ; LINUX-I386: .cfi_endproc
2593
2594 ; LINUX-X64: test22a:
2595 ; LINUX-X64-NOT: callq __stack_chk_fail
2596 ; LINUX-X64: .cfi_endproc
2597
2598 ; LINUX-KERNEL-X64: test22a:
2599 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2600 ; LINUX-KERNEL-X64: .cfi_endproc
2601
2602 ; DARWIN-X64: test22a:
2603 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2604 ; DARWIN-X64: .cfi_endproc
2605   %a = alloca %class.A, align 1
2606   %array = getelementptr inbounds %class.A* %a, i32 0, i32 0
2607   %arrayidx = getelementptr inbounds [2 x i8]* %array, i32 0, i64 0
2608   %0 = load i8* %arrayidx, align 1
2609   ret i8 %0
2610 }
2611
2612 ; test22b: [2 x i8] in a class
2613 ;          ssp attribute
2614 ; Requires no protector.
2615 define signext i8 @test22b() nounwind uwtable ssp {
2616 entry:
2617 ; LINUX-I386: test22b:
2618 ; LINUX-I386-NOT: calll __stack_chk_fail
2619 ; LINUX-I386: .cfi_endproc
2620
2621 ; LINUX-X64: test22b:
2622 ; LINUX-X64-NOT: callq __stack_chk_fail
2623 ; LINUX-X64: .cfi_endproc
2624
2625 ; LINUX-KERNEL-X64: test22b:
2626 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2627 ; LINUX-KERNEL-X64: .cfi_endproc
2628
2629 ; DARWIN-X64: test22b:
2630 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2631 ; DARWIN-X64: .cfi_endproc
2632   %a = alloca %class.A, align 1
2633   %array = getelementptr inbounds %class.A* %a, i32 0, i32 0
2634   %arrayidx = getelementptr inbounds [2 x i8]* %array, i32 0, i64 0
2635   %0 = load i8* %arrayidx, align 1
2636   ret i8 %0
2637 }
2638
2639 ; test22c: [2 x i8] in a class
2640 ;          sspstrong attribute
2641 ; Requires protector.
2642 define signext i8 @test22c() nounwind uwtable sspstrong {
2643 entry:
2644 ; LINUX-I386: test22c:
2645 ; LINUX-I386: mov{{l|q}} %gs:
2646 ; LINUX-I386: calll __stack_chk_fail
2647
2648 ; LINUX-X64: test22c:
2649 ; LINUX-X64: mov{{l|q}} %fs:
2650 ; LINUX-X64: callq __stack_chk_fail
2651
2652 ; LINUX-KERNEL-X64: test22c:
2653 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2654 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2655
2656 ; DARWIN-X64: test22c:
2657 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2658 ; DARWIN-X64: callq ___stack_chk_fail
2659   %a = alloca %class.A, align 1
2660   %array = getelementptr inbounds %class.A* %a, i32 0, i32 0
2661   %arrayidx = getelementptr inbounds [2 x i8]* %array, i32 0, i64 0
2662   %0 = load i8* %arrayidx, align 1
2663   ret i8 %0
2664 }
2665
2666 ; test22d: [2 x i8] in a class
2667 ;          sspreq attribute
2668 ; Requires protector.
2669 define signext i8 @test22d() nounwind uwtable sspreq {
2670 entry:
2671 ; LINUX-I386: test22d:
2672 ; LINUX-I386: mov{{l|q}} %gs:
2673 ; LINUX-I386: calll __stack_chk_fail
2674
2675 ; LINUX-X64: test22d:
2676 ; LINUX-X64: mov{{l|q}} %fs:
2677 ; LINUX-X64: callq __stack_chk_fail
2678
2679 ; LINUX-KERNEL-X64: test22d:
2680 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2681 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2682
2683 ; DARWIN-X64: test22d:
2684 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2685 ; DARWIN-X64: callq ___stack_chk_fail
2686   %a = alloca %class.A, align 1
2687   %array = getelementptr inbounds %class.A* %a, i32 0, i32 0
2688   %arrayidx = getelementptr inbounds [2 x i8]* %array, i32 0, i64 0
2689   %0 = load i8* %arrayidx, align 1
2690   ret i8 %0
2691 }
2692
2693 ; test23a: [2 x i8] nested in several layers of structs and unions
2694 ;          no ssp attribute
2695 ; Requires no protector.
2696 define signext i8 @test23a() nounwind uwtable {
2697 entry:
2698 ; LINUX-I386: test23a:
2699 ; LINUX-I386-NOT: calll __stack_chk_fail
2700 ; LINUX-I386: .cfi_endproc
2701
2702 ; LINUX-X64: test23a:
2703 ; LINUX-X64-NOT: callq __stack_chk_fail
2704 ; LINUX-X64: .cfi_endproc
2705
2706 ; LINUX-KERNEL-X64: test23a:
2707 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2708 ; LINUX-KERNEL-X64: .cfi_endproc
2709
2710 ; DARWIN-X64: test23a:
2711 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2712 ; DARWIN-X64: .cfi_endproc
2713   %x = alloca %struct.deep, align 1
2714   %b = getelementptr inbounds %struct.deep* %x, i32 0, i32 0
2715   %c = bitcast %union.anon* %b to %struct.anon*
2716   %d = getelementptr inbounds %struct.anon* %c, i32 0, i32 0
2717   %e = getelementptr inbounds %struct.anon.0* %d, i32 0, i32 0
2718   %array = bitcast %union.anon.1* %e to [2 x i8]*
2719   %arrayidx = getelementptr inbounds [2 x i8]* %array, i32 0, i64 0
2720   %0 = load i8* %arrayidx, align 1
2721   ret i8 %0
2722 }
2723
2724 ; test23b: [2 x i8] nested in several layers of structs and unions
2725 ;          ssp attribute
2726 ; Requires no protector.
2727 define signext i8 @test23b() nounwind uwtable ssp {
2728 entry:
2729 ; LINUX-I386: test23b:
2730 ; LINUX-I386-NOT: calll __stack_chk_fail
2731 ; LINUX-I386: .cfi_endproc
2732
2733 ; LINUX-X64: test23b:
2734 ; LINUX-X64-NOT: callq __stack_chk_fail
2735 ; LINUX-X64: .cfi_endproc
2736
2737 ; LINUX-KERNEL-X64: test23b:
2738 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2739 ; LINUX-KERNEL-X64: .cfi_endproc
2740
2741 ; DARWIN-X64: test23b:
2742 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2743 ; DARWIN-X64: .cfi_endproc
2744   %x = alloca %struct.deep, align 1
2745   %b = getelementptr inbounds %struct.deep* %x, i32 0, i32 0
2746   %c = bitcast %union.anon* %b to %struct.anon*
2747   %d = getelementptr inbounds %struct.anon* %c, i32 0, i32 0
2748   %e = getelementptr inbounds %struct.anon.0* %d, i32 0, i32 0
2749   %array = bitcast %union.anon.1* %e to [2 x i8]*
2750   %arrayidx = getelementptr inbounds [2 x i8]* %array, i32 0, i64 0
2751   %0 = load i8* %arrayidx, align 1
2752   ret i8 %0
2753 }
2754
2755 ; test23c: [2 x i8] nested in several layers of structs and unions
2756 ;          sspstrong attribute
2757 ; Requires protector.
2758 define signext i8 @test23c() nounwind uwtable sspstrong {
2759 entry:
2760 ; LINUX-I386: test23c:
2761 ; LINUX-I386: mov{{l|q}} %gs:
2762 ; LINUX-I386: calll __stack_chk_fail
2763
2764 ; LINUX-X64: test23c:
2765 ; LINUX-X64: mov{{l|q}} %fs:
2766 ; LINUX-X64: callq __stack_chk_fail
2767
2768 ; LINUX-KERNEL-X64: test23c:
2769 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2770 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2771
2772 ; DARWIN-X64: test23c:
2773 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2774 ; DARWIN-X64: callq ___stack_chk_fail
2775   %x = alloca %struct.deep, align 1
2776   %b = getelementptr inbounds %struct.deep* %x, i32 0, i32 0
2777   %c = bitcast %union.anon* %b to %struct.anon*
2778   %d = getelementptr inbounds %struct.anon* %c, i32 0, i32 0
2779   %e = getelementptr inbounds %struct.anon.0* %d, i32 0, i32 0
2780   %array = bitcast %union.anon.1* %e to [2 x i8]*
2781   %arrayidx = getelementptr inbounds [2 x i8]* %array, i32 0, i64 0
2782   %0 = load i8* %arrayidx, align 1
2783   ret i8 %0
2784 }
2785
2786 ; test23d: [2 x i8] nested in several layers of structs and unions
2787 ;          sspreq attribute
2788 ; Requires protector.
2789 define signext i8 @test23d() nounwind uwtable sspreq {
2790 entry:
2791 ; LINUX-I386: test23d:
2792 ; LINUX-I386: mov{{l|q}} %gs:
2793 ; LINUX-I386: calll __stack_chk_fail
2794
2795 ; LINUX-X64: test23d:
2796 ; LINUX-X64: mov{{l|q}} %fs:
2797 ; LINUX-X64: callq __stack_chk_fail
2798
2799 ; LINUX-KERNEL-X64: test23d:
2800 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2801 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2802
2803 ; DARWIN-X64: test23d:
2804 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2805 ; DARWIN-X64: callq ___stack_chk_fail
2806   %x = alloca %struct.deep, align 1
2807   %b = getelementptr inbounds %struct.deep* %x, i32 0, i32 0
2808   %c = bitcast %union.anon* %b to %struct.anon*
2809   %d = getelementptr inbounds %struct.anon* %c, i32 0, i32 0
2810   %e = getelementptr inbounds %struct.anon.0* %d, i32 0, i32 0
2811   %array = bitcast %union.anon.1* %e to [2 x i8]*
2812   %arrayidx = getelementptr inbounds [2 x i8]* %array, i32 0, i64 0
2813   %0 = load i8* %arrayidx, align 1
2814   ret i8 %0
2815 }
2816
2817 ; test24a: Variable sized alloca
2818 ;          no ssp attribute
2819 ; Requires no protector.
2820 define void @test24a(i32 %n) nounwind uwtable {
2821 entry:
2822 ; LINUX-I386: test24a:
2823 ; LINUX-I386-NOT: calll __stack_chk_fail
2824 ; LINUX-I386: .cfi_endproc
2825
2826 ; LINUX-X64: test24a:
2827 ; LINUX-X64-NOT: callq __stack_chk_fail
2828 ; LINUX-X64: .cfi_endproc
2829
2830 ; LINUX-KERNEL-X64: test24a:
2831 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2832 ; LINUX-KERNEL-X64: .cfi_endproc
2833
2834 ; DARWIN-X64: test24a:
2835 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2836 ; DARWIN-X64: .cfi_endproc
2837   %n.addr = alloca i32, align 4
2838   %a = alloca i32*, align 8
2839   store i32 %n, i32* %n.addr, align 4
2840   %0 = load i32* %n.addr, align 4
2841   %conv = sext i32 %0 to i64
2842   %1 = alloca i8, i64 %conv
2843   %2 = bitcast i8* %1 to i32*
2844   store i32* %2, i32** %a, align 8
2845   ret void
2846 }
2847
2848 ; test24b: Variable sized alloca
2849 ;          ssp attribute
2850 ; Requires protector.
2851 define void @test24b(i32 %n) nounwind uwtable ssp {
2852 entry:
2853 ; LINUX-I386: test24b:
2854 ; LINUX-I386: mov{{l|q}} %gs:
2855 ; LINUX-I386: calll __stack_chk_fail
2856
2857 ; LINUX-X64: test24b:
2858 ; LINUX-X64: mov{{l|q}} %fs:
2859 ; LINUX-X64: callq __stack_chk_fail
2860
2861 ; LINUX-KERNEL-X64: test24b:
2862 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2863 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2864
2865 ; DARWIN-X64: test24b:
2866 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2867 ; DARWIN-X64: callq ___stack_chk_fail
2868   %n.addr = alloca i32, align 4
2869   %a = alloca i32*, align 8
2870   store i32 %n, i32* %n.addr, align 4
2871   %0 = load i32* %n.addr, align 4
2872   %conv = sext i32 %0 to i64
2873   %1 = alloca i8, i64 %conv
2874   %2 = bitcast i8* %1 to i32*
2875   store i32* %2, i32** %a, align 8
2876   ret void
2877 }
2878
2879 ; test24c: Variable sized alloca
2880 ;          sspstrong attribute
2881 ; Requires protector.
2882 define void @test24c(i32 %n) nounwind uwtable sspstrong {
2883 entry:
2884 ; LINUX-I386: test24c:
2885 ; LINUX-I386: mov{{l|q}} %gs:
2886 ; LINUX-I386: calll __stack_chk_fail
2887
2888 ; LINUX-X64: test24c:
2889 ; LINUX-X64: mov{{l|q}} %fs:
2890 ; LINUX-X64: callq __stack_chk_fail
2891
2892 ; LINUX-KERNEL-X64: test24c:
2893 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2894 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2895
2896 ; DARWIN-X64: test24c:
2897 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2898 ; DARWIN-X64: callq ___stack_chk_fail
2899   %n.addr = alloca i32, align 4
2900   %a = alloca i32*, align 8
2901   store i32 %n, i32* %n.addr, align 4
2902   %0 = load i32* %n.addr, align 4
2903   %conv = sext i32 %0 to i64
2904   %1 = alloca i8, i64 %conv
2905   %2 = bitcast i8* %1 to i32*
2906   store i32* %2, i32** %a, align 8
2907   ret void
2908 }
2909
2910 ; test24d: Variable sized alloca
2911 ;          sspreq attribute
2912 ; Requires protector.
2913 define void @test24d(i32 %n) nounwind uwtable sspreq  {
2914 entry:
2915 ; LINUX-I386: test24d:
2916 ; LINUX-I386: mov{{l|q}} %gs:
2917 ; LINUX-I386: calll __stack_chk_fail
2918
2919 ; LINUX-X64: test24d:
2920 ; LINUX-X64: mov{{l|q}} %fs:
2921 ; LINUX-X64: callq __stack_chk_fail
2922
2923 ; LINUX-KERNEL-X64: test24d:
2924 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2925 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2926
2927 ; DARWIN-X64: test24d:
2928 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2929 ; DARWIN-X64: callq ___stack_chk_fail
2930   %n.addr = alloca i32, align 4
2931   %a = alloca i32*, align 8
2932   store i32 %n, i32* %n.addr, align 4
2933   %0 = load i32* %n.addr, align 4
2934   %conv = sext i32 %0 to i64
2935   %1 = alloca i8, i64 %conv
2936   %2 = bitcast i8* %1 to i32*
2937   store i32* %2, i32** %a, align 8
2938   ret void
2939 }
2940
2941 ; test25a: array of [4 x i32]
2942 ;          no ssp attribute
2943 ; Requires no protector.
2944 define i32 @test25a() nounwind uwtable {
2945 entry:
2946 ; LINUX-I386: test25a:
2947 ; LINUX-I386-NOT: calll __stack_chk_fail
2948 ; LINUX-I386: .cfi_endproc
2949
2950 ; LINUX-X64: test25a:
2951 ; LINUX-X64-NOT: callq __stack_chk_fail
2952 ; LINUX-X64: .cfi_endproc
2953
2954 ; LINUX-KERNEL-X64: test25a:
2955 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2956 ; LINUX-KERNEL-X64: .cfi_endproc
2957
2958 ; DARWIN-X64: test25a:
2959 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2960 ; DARWIN-X64: .cfi_endproc
2961   %a = alloca [4 x i32], align 16
2962   %arrayidx = getelementptr inbounds [4 x i32]* %a, i32 0, i64 0
2963   %0 = load i32* %arrayidx, align 4
2964   ret i32 %0
2965 }
2966
2967 ; test25b: array of [4 x i32]
2968 ;          ssp attribute
2969 ; Requires no protector, except for Darwin which _does_ require a protector.
2970 define i32 @test25b() nounwind uwtable ssp {
2971 entry:
2972 ; LINUX-I386: test25b:
2973 ; LINUX-I386-NOT: calll __stack_chk_fail
2974 ; LINUX-I386: .cfi_endproc
2975
2976 ; LINUX-X64: test25b:
2977 ; LINUX-X64-NOT: callq __stack_chk_fail
2978 ; LINUX-X64: .cfi_endproc
2979
2980 ; LINUX-KERNEL-X64: test25b:
2981 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2982 ; LINUX-KERNEL-X64: .cfi_endproc
2983
2984 ; DARWIN-X64: test25b:
2985 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2986 ; DARWIN-X64: callq ___stack_chk_fail
2987   %a = alloca [4 x i32], align 16
2988   %arrayidx = getelementptr inbounds [4 x i32]* %a, i32 0, i64 0
2989   %0 = load i32* %arrayidx, align 4
2990   ret i32 %0
2991 }
2992
2993 ; test25c: array of [4 x i32]
2994 ;          sspstrong attribute
2995 ; Requires protector.
2996 define i32 @test25c() nounwind uwtable sspstrong {
2997 entry:
2998 ; LINUX-I386: test25c:
2999 ; LINUX-I386: mov{{l|q}} %gs:
3000 ; LINUX-I386: calll __stack_chk_fail
3001
3002 ; LINUX-X64: test25c:
3003 ; LINUX-X64: mov{{l|q}} %fs:
3004 ; LINUX-X64: callq __stack_chk_fail
3005
3006 ; LINUX-KERNEL-X64: test25c:
3007 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
3008 ; LINUX-KERNEL-X64: callq __stack_chk_fail
3009
3010 ; DARWIN-X64: test25c:
3011 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
3012 ; DARWIN-X64: callq ___stack_chk_fail
3013   %a = alloca [4 x i32], align 16
3014   %arrayidx = getelementptr inbounds [4 x i32]* %a, i32 0, i64 0
3015   %0 = load i32* %arrayidx, align 4
3016   ret i32 %0
3017 }
3018
3019 ; test25d: array of [4 x i32]
3020 ;          sspreq attribute
3021 ; Requires protector.
3022 define i32 @test25d() nounwind uwtable sspreq {
3023 entry:
3024 ; LINUX-I386: test25d:
3025 ; LINUX-I386: mov{{l|q}} %gs:
3026 ; LINUX-I386: calll __stack_chk_fail
3027
3028 ; LINUX-X64: test25d:
3029 ; LINUX-X64: mov{{l|q}} %fs:
3030 ; LINUX-X64: callq __stack_chk_fail
3031
3032 ; LINUX-KERNEL-X64: test25d:
3033 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
3034 ; LINUX-KERNEL-X64: callq __stack_chk_fail
3035
3036 ; DARWIN-X64: test25d:
3037 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
3038 ; DARWIN-X64: callq ___stack_chk_fail
3039   %a = alloca [4 x i32], align 16
3040   %arrayidx = getelementptr inbounds [4 x i32]* %a, i32 0, i64 0
3041   %0 = load i32* %arrayidx, align 4
3042   ret i32 %0
3043 }
3044
3045 ; test26: Nested structure, no arrays, no address-of expressions.
3046 ;         Verify that the resulting gep-of-gep does not incorrectly trigger
3047 ;         a stack protector.
3048 ;         ssptrong attribute
3049 ; Requires no protector.
3050 define void @test26() nounwind uwtable sspstrong {
3051 entry:
3052 ; LINUX-I386: test26:
3053 ; LINUX-I386-NOT: calll __stack_chk_fail
3054 ; LINUX-I386: .cfi_endproc
3055
3056 ; LINUX-X64: test26:
3057 ; LINUX-X64-NOT: callq __stack_chk_fail
3058 ; LINUX-X64: .cfi_endproc
3059
3060 ; LINUX-KERNEL-X64: test26:
3061 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
3062 ; LINUX-KERNEL-X64: .cfi_endproc
3063
3064 ; DARWIN-X64: test26:
3065 ; DARWIN-X64-NOT: callq ___stack_chk_fail
3066 ; DARWIN-X64: .cfi_endproc
3067   %c = alloca %struct.nest, align 4
3068   %b = getelementptr inbounds %struct.nest* %c, i32 0, i32 1
3069   %_a = getelementptr inbounds %struct.pair* %b, i32 0, i32 0
3070   %0 = load i32* %_a, align 4
3071   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i32 %0)
3072   ret void
3073 }
3074
3075 ; test27: Address-of a structure taken in a function with a loop where
3076 ;         the alloca is an incoming value to a PHI node and a use of that PHI 
3077 ;         node is also an incoming value.
3078 ;         Verify that the address-of analysis does not get stuck in infinite
3079 ;         recursion when chasing the alloca through the PHI nodes.
3080 ; Requires protector.
3081 define i32 @test27(i32 %arg) nounwind uwtable sspstrong {
3082 bb:
3083 ; LINUX-I386: test27:
3084 ; LINUX-I386: mov{{l|q}} %gs:
3085 ; LINUX-I386: calll __stack_chk_fail
3086
3087 ; LINUX-X64: test27:
3088 ; LINUX-X64: mov{{l|q}} %fs:
3089 ; LINUX-X64: callq __stack_chk_fail
3090
3091 ; LINUX-KERNEL-X64: test27:
3092 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
3093 ; LINUX-KERNEL-X64: callq __stack_chk_fail
3094
3095 ; DARWIN-X64: test27:
3096 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
3097 ; DARWIN-X64: callq ___stack_chk_fail
3098   %tmp = alloca %struct.small*, align 8
3099   %tmp1 = call i32 (...)* @dummy(%struct.small** %tmp) nounwind
3100   %tmp2 = load %struct.small** %tmp, align 8
3101   %tmp3 = ptrtoint %struct.small* %tmp2 to i64
3102   %tmp4 = trunc i64 %tmp3 to i32
3103   %tmp5 = icmp sgt i32 %tmp4, 0
3104   br i1 %tmp5, label %bb6, label %bb21
3105
3106 bb6:                                              ; preds = %bb17, %bb
3107   %tmp7 = phi %struct.small* [ %tmp19, %bb17 ], [ %tmp2, %bb ]
3108   %tmp8 = phi i64 [ %tmp20, %bb17 ], [ 1, %bb ]
3109   %tmp9 = phi i32 [ %tmp14, %bb17 ], [ %tmp1, %bb ]
3110   %tmp10 = getelementptr inbounds %struct.small* %tmp7, i64 0, i32 0
3111   %tmp11 = load i8* %tmp10, align 1
3112   %tmp12 = icmp eq i8 %tmp11, 1
3113   %tmp13 = add nsw i32 %tmp9, 8
3114   %tmp14 = select i1 %tmp12, i32 %tmp13, i32 %tmp9
3115   %tmp15 = trunc i64 %tmp8 to i32
3116   %tmp16 = icmp eq i32 %tmp15, %tmp4
3117   br i1 %tmp16, label %bb21, label %bb17
3118
3119 bb17:                                             ; preds = %bb6
3120   %tmp18 = getelementptr inbounds %struct.small** %tmp, i64 %tmp8
3121   %tmp19 = load %struct.small** %tmp18, align 8
3122   %tmp20 = add i64 %tmp8, 1
3123   br label %bb6
3124
3125 bb21:                                             ; preds = %bb6, %bb
3126   %tmp22 = phi i32 [ %tmp1, %bb ], [ %tmp14, %bb6 ]
3127   %tmp23 = call i32 (...)* @dummy(i32 %tmp22) nounwind
3128   ret i32 undef
3129 }
3130
3131 declare double @testi_aux()
3132 declare i8* @strcpy(i8*, i8*)
3133 declare i32 @printf(i8*, ...)
3134 declare void @funcall(i32*)
3135 declare void @funcall2(i32**)
3136 declare void @funfloat(float*)
3137 declare void @funfloat2(float**)
3138 declare void @_Z3exceptPi(i32*)
3139 declare i32 @__gxx_personality_v0(...)
3140 declare i32* @getp()
3141 declare i32 @dummy(...)