Mercurial > hg > CbC > CbC_llvm
comparison test/CodeGen/X86/stack-protector.ll @ 95:afa8332a0e37 LLVM3.8
LLVM 3.8
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 13 Oct 2015 17:48:58 +0900 |
parents | 54457678186b |
children | 1172e4bd9c6f |
comparison
equal
deleted
inserted
replaced
84:f3e34b893a5f | 95:afa8332a0e37 |
---|---|
41 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 41 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
42 ; DARWIN-X64: .cfi_endproc | 42 ; DARWIN-X64: .cfi_endproc |
43 %a.addr = alloca i8*, align 8 | 43 %a.addr = alloca i8*, align 8 |
44 %buf = alloca [16 x i8], align 16 | 44 %buf = alloca [16 x i8], align 16 |
45 store i8* %a, i8** %a.addr, align 8 | 45 store i8* %a, i8** %a.addr, align 8 |
46 %arraydecay = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0 | 46 %arraydecay = getelementptr inbounds [16 x i8], [16 x i8]* %buf, i32 0, i32 0 |
47 %0 = load i8** %a.addr, align 8 | 47 %0 = load i8*, i8** %a.addr, align 8 |
48 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) | 48 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) |
49 %arraydecay1 = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0 | 49 %arraydecay1 = getelementptr inbounds [16 x i8], [16 x i8]* %buf, i32 0, i32 0 |
50 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1) | 50 %call2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1) |
51 ret void | 51 ret void |
52 } | 52 } |
53 | 53 |
54 ; test1b: array of [16 x i8] | 54 ; test1b: array of [16 x i8] |
55 ; ssp attribute | 55 ; ssp attribute |
77 ; OPENBSD-AMD64: movq __guard_local(%rip) | 77 ; OPENBSD-AMD64: movq __guard_local(%rip) |
78 ; OPENBSD-AMD64: callq __stack_smash_handler | 78 ; OPENBSD-AMD64: callq __stack_smash_handler |
79 %a.addr = alloca i8*, align 8 | 79 %a.addr = alloca i8*, align 8 |
80 %buf = alloca [16 x i8], align 16 | 80 %buf = alloca [16 x i8], align 16 |
81 store i8* %a, i8** %a.addr, align 8 | 81 store i8* %a, i8** %a.addr, align 8 |
82 %arraydecay = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0 | 82 %arraydecay = getelementptr inbounds [16 x i8], [16 x i8]* %buf, i32 0, i32 0 |
83 %0 = load i8** %a.addr, align 8 | 83 %0 = load i8*, i8** %a.addr, align 8 |
84 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) | 84 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) |
85 %arraydecay1 = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0 | 85 %arraydecay1 = getelementptr inbounds [16 x i8], [16 x i8]* %buf, i32 0, i32 0 |
86 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1) | 86 %call2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1) |
87 ret void | 87 ret void |
88 } | 88 } |
89 | 89 |
90 ; test1c: array of [16 x i8] | 90 ; test1c: array of [16 x i8] |
91 ; sspstrong attribute | 91 ; sspstrong attribute |
109 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 109 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
110 ; DARWIN-X64: callq ___stack_chk_fail | 110 ; DARWIN-X64: callq ___stack_chk_fail |
111 %a.addr = alloca i8*, align 8 | 111 %a.addr = alloca i8*, align 8 |
112 %buf = alloca [16 x i8], align 16 | 112 %buf = alloca [16 x i8], align 16 |
113 store i8* %a, i8** %a.addr, align 8 | 113 store i8* %a, i8** %a.addr, align 8 |
114 %arraydecay = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0 | 114 %arraydecay = getelementptr inbounds [16 x i8], [16 x i8]* %buf, i32 0, i32 0 |
115 %0 = load i8** %a.addr, align 8 | 115 %0 = load i8*, i8** %a.addr, align 8 |
116 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) | 116 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) |
117 %arraydecay1 = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0 | 117 %arraydecay1 = getelementptr inbounds [16 x i8], [16 x i8]* %buf, i32 0, i32 0 |
118 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1) | 118 %call2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1) |
119 ret void | 119 ret void |
120 } | 120 } |
121 | 121 |
122 ; test1d: array of [16 x i8] | 122 ; test1d: array of [16 x i8] |
123 ; sspreq attribute | 123 ; sspreq attribute |
141 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 141 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
142 ; DARWIN-X64: callq ___stack_chk_fail | 142 ; DARWIN-X64: callq ___stack_chk_fail |
143 %a.addr = alloca i8*, align 8 | 143 %a.addr = alloca i8*, align 8 |
144 %buf = alloca [16 x i8], align 16 | 144 %buf = alloca [16 x i8], align 16 |
145 store i8* %a, i8** %a.addr, align 8 | 145 store i8* %a, i8** %a.addr, align 8 |
146 %arraydecay = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0 | 146 %arraydecay = getelementptr inbounds [16 x i8], [16 x i8]* %buf, i32 0, i32 0 |
147 %0 = load i8** %a.addr, align 8 | 147 %0 = load i8*, i8** %a.addr, align 8 |
148 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) | 148 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) |
149 %arraydecay1 = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0 | 149 %arraydecay1 = getelementptr inbounds [16 x i8], [16 x i8]* %buf, i32 0, i32 0 |
150 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1) | 150 %call2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1) |
151 ret void | 151 ret void |
152 } | 152 } |
153 | 153 |
154 ; test2a: struct { [16 x i8] } | 154 ; test2a: struct { [16 x i8] } |
155 ; no ssp attribute | 155 ; no ssp attribute |
172 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 172 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
173 ; DARWIN-X64: .cfi_endproc | 173 ; DARWIN-X64: .cfi_endproc |
174 %a.addr = alloca i8*, align 8 | 174 %a.addr = alloca i8*, align 8 |
175 %b = alloca %struct.foo, align 1 | 175 %b = alloca %struct.foo, align 1 |
176 store i8* %a, i8** %a.addr, align 8 | 176 store i8* %a, i8** %a.addr, align 8 |
177 %buf = getelementptr inbounds %struct.foo* %b, i32 0, i32 0 | 177 %buf = getelementptr inbounds %struct.foo, %struct.foo* %b, i32 0, i32 0 |
178 %arraydecay = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0 | 178 %arraydecay = getelementptr inbounds [16 x i8], [16 x i8]* %buf, i32 0, i32 0 |
179 %0 = load i8** %a.addr, align 8 | 179 %0 = load i8*, i8** %a.addr, align 8 |
180 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) | 180 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) |
181 %buf1 = getelementptr inbounds %struct.foo* %b, i32 0, i32 0 | 181 %buf1 = getelementptr inbounds %struct.foo, %struct.foo* %b, i32 0, i32 0 |
182 %arraydecay2 = getelementptr inbounds [16 x i8]* %buf1, i32 0, i32 0 | 182 %arraydecay2 = getelementptr inbounds [16 x i8], [16 x i8]* %buf1, i32 0, i32 0 |
183 %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2) | 183 %call3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2) |
184 ret void | 184 ret void |
185 } | 185 } |
186 | 186 |
187 ; test2b: struct { [16 x i8] } | 187 ; test2b: struct { [16 x i8] } |
188 ; ssp attribute | 188 ; ssp attribute |
206 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 206 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
207 ; DARWIN-X64: callq ___stack_chk_fail | 207 ; DARWIN-X64: callq ___stack_chk_fail |
208 %a.addr = alloca i8*, align 8 | 208 %a.addr = alloca i8*, align 8 |
209 %b = alloca %struct.foo, align 1 | 209 %b = alloca %struct.foo, align 1 |
210 store i8* %a, i8** %a.addr, align 8 | 210 store i8* %a, i8** %a.addr, align 8 |
211 %buf = getelementptr inbounds %struct.foo* %b, i32 0, i32 0 | 211 %buf = getelementptr inbounds %struct.foo, %struct.foo* %b, i32 0, i32 0 |
212 %arraydecay = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0 | 212 %arraydecay = getelementptr inbounds [16 x i8], [16 x i8]* %buf, i32 0, i32 0 |
213 %0 = load i8** %a.addr, align 8 | 213 %0 = load i8*, i8** %a.addr, align 8 |
214 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) | 214 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) |
215 %buf1 = getelementptr inbounds %struct.foo* %b, i32 0, i32 0 | 215 %buf1 = getelementptr inbounds %struct.foo, %struct.foo* %b, i32 0, i32 0 |
216 %arraydecay2 = getelementptr inbounds [16 x i8]* %buf1, i32 0, i32 0 | 216 %arraydecay2 = getelementptr inbounds [16 x i8], [16 x i8]* %buf1, i32 0, i32 0 |
217 %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2) | 217 %call3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2) |
218 ret void | 218 ret void |
219 } | 219 } |
220 | 220 |
221 ; test2c: struct { [16 x i8] } | 221 ; test2c: struct { [16 x i8] } |
222 ; sspstrong attribute | 222 ; sspstrong attribute |
240 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 240 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
241 ; DARWIN-X64: callq ___stack_chk_fail | 241 ; DARWIN-X64: callq ___stack_chk_fail |
242 %a.addr = alloca i8*, align 8 | 242 %a.addr = alloca i8*, align 8 |
243 %b = alloca %struct.foo, align 1 | 243 %b = alloca %struct.foo, align 1 |
244 store i8* %a, i8** %a.addr, align 8 | 244 store i8* %a, i8** %a.addr, align 8 |
245 %buf = getelementptr inbounds %struct.foo* %b, i32 0, i32 0 | 245 %buf = getelementptr inbounds %struct.foo, %struct.foo* %b, i32 0, i32 0 |
246 %arraydecay = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0 | 246 %arraydecay = getelementptr inbounds [16 x i8], [16 x i8]* %buf, i32 0, i32 0 |
247 %0 = load i8** %a.addr, align 8 | 247 %0 = load i8*, i8** %a.addr, align 8 |
248 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) | 248 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) |
249 %buf1 = getelementptr inbounds %struct.foo* %b, i32 0, i32 0 | 249 %buf1 = getelementptr inbounds %struct.foo, %struct.foo* %b, i32 0, i32 0 |
250 %arraydecay2 = getelementptr inbounds [16 x i8]* %buf1, i32 0, i32 0 | 250 %arraydecay2 = getelementptr inbounds [16 x i8], [16 x i8]* %buf1, i32 0, i32 0 |
251 %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2) | 251 %call3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2) |
252 ret void | 252 ret void |
253 } | 253 } |
254 | 254 |
255 ; test2d: struct { [16 x i8] } | 255 ; test2d: struct { [16 x i8] } |
256 ; sspreq attribute | 256 ; sspreq attribute |
274 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 274 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
275 ; DARWIN-X64: callq ___stack_chk_fail | 275 ; DARWIN-X64: callq ___stack_chk_fail |
276 %a.addr = alloca i8*, align 8 | 276 %a.addr = alloca i8*, align 8 |
277 %b = alloca %struct.foo, align 1 | 277 %b = alloca %struct.foo, align 1 |
278 store i8* %a, i8** %a.addr, align 8 | 278 store i8* %a, i8** %a.addr, align 8 |
279 %buf = getelementptr inbounds %struct.foo* %b, i32 0, i32 0 | 279 %buf = getelementptr inbounds %struct.foo, %struct.foo* %b, i32 0, i32 0 |
280 %arraydecay = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0 | 280 %arraydecay = getelementptr inbounds [16 x i8], [16 x i8]* %buf, i32 0, i32 0 |
281 %0 = load i8** %a.addr, align 8 | 281 %0 = load i8*, i8** %a.addr, align 8 |
282 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) | 282 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) |
283 %buf1 = getelementptr inbounds %struct.foo* %b, i32 0, i32 0 | 283 %buf1 = getelementptr inbounds %struct.foo, %struct.foo* %b, i32 0, i32 0 |
284 %arraydecay2 = getelementptr inbounds [16 x i8]* %buf1, i32 0, i32 0 | 284 %arraydecay2 = getelementptr inbounds [16 x i8], [16 x i8]* %buf1, i32 0, i32 0 |
285 %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2) | 285 %call3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2) |
286 ret void | 286 ret void |
287 } | 287 } |
288 | 288 |
289 ; test3a: array of [4 x i8] | 289 ; test3a: array of [4 x i8] |
290 ; no ssp attribute | 290 ; no ssp attribute |
307 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 307 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
308 ; DARWIN-X64: .cfi_endproc | 308 ; DARWIN-X64: .cfi_endproc |
309 %a.addr = alloca i8*, align 8 | 309 %a.addr = alloca i8*, align 8 |
310 %buf = alloca [4 x i8], align 1 | 310 %buf = alloca [4 x i8], align 1 |
311 store i8* %a, i8** %a.addr, align 8 | 311 store i8* %a, i8** %a.addr, align 8 |
312 %arraydecay = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0 | 312 %arraydecay = getelementptr inbounds [4 x i8], [4 x i8]* %buf, i32 0, i32 0 |
313 %0 = load i8** %a.addr, align 8 | 313 %0 = load i8*, i8** %a.addr, align 8 |
314 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) | 314 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) |
315 %arraydecay1 = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0 | 315 %arraydecay1 = getelementptr inbounds [4 x i8], [4 x i8]* %buf, i32 0, i32 0 |
316 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1) | 316 %call2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1) |
317 ret void | 317 ret void |
318 } | 318 } |
319 | 319 |
320 ; test3b: array [4 x i8] | 320 ; test3b: array [4 x i8] |
321 ; ssp attribute | 321 ; ssp attribute |
339 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 339 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
340 ; DARWIN-X64: .cfi_endproc | 340 ; DARWIN-X64: .cfi_endproc |
341 %a.addr = alloca i8*, align 8 | 341 %a.addr = alloca i8*, align 8 |
342 %buf = alloca [4 x i8], align 1 | 342 %buf = alloca [4 x i8], align 1 |
343 store i8* %a, i8** %a.addr, align 8 | 343 store i8* %a, i8** %a.addr, align 8 |
344 %arraydecay = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0 | 344 %arraydecay = getelementptr inbounds [4 x i8], [4 x i8]* %buf, i32 0, i32 0 |
345 %0 = load i8** %a.addr, align 8 | 345 %0 = load i8*, i8** %a.addr, align 8 |
346 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) | 346 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) |
347 %arraydecay1 = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0 | 347 %arraydecay1 = getelementptr inbounds [4 x i8], [4 x i8]* %buf, i32 0, i32 0 |
348 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1) | 348 %call2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1) |
349 ret void | 349 ret void |
350 } | 350 } |
351 | 351 |
352 ; test3c: array of [4 x i8] | 352 ; test3c: array of [4 x i8] |
353 ; sspstrong attribute | 353 ; sspstrong attribute |
371 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 371 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
372 ; DARWIN-X64: callq ___stack_chk_fail | 372 ; DARWIN-X64: callq ___stack_chk_fail |
373 %a.addr = alloca i8*, align 8 | 373 %a.addr = alloca i8*, align 8 |
374 %buf = alloca [4 x i8], align 1 | 374 %buf = alloca [4 x i8], align 1 |
375 store i8* %a, i8** %a.addr, align 8 | 375 store i8* %a, i8** %a.addr, align 8 |
376 %arraydecay = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0 | 376 %arraydecay = getelementptr inbounds [4 x i8], [4 x i8]* %buf, i32 0, i32 0 |
377 %0 = load i8** %a.addr, align 8 | 377 %0 = load i8*, i8** %a.addr, align 8 |
378 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) | 378 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) |
379 %arraydecay1 = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0 | 379 %arraydecay1 = getelementptr inbounds [4 x i8], [4 x i8]* %buf, i32 0, i32 0 |
380 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1) | 380 %call2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1) |
381 ret void | 381 ret void |
382 } | 382 } |
383 | 383 |
384 ; test3d: array of [4 x i8] | 384 ; test3d: array of [4 x i8] |
385 ; sspreq attribute | 385 ; sspreq attribute |
403 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 403 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
404 ; DARWIN-X64: callq ___stack_chk_fail | 404 ; DARWIN-X64: callq ___stack_chk_fail |
405 %a.addr = alloca i8*, align 8 | 405 %a.addr = alloca i8*, align 8 |
406 %buf = alloca [4 x i8], align 1 | 406 %buf = alloca [4 x i8], align 1 |
407 store i8* %a, i8** %a.addr, align 8 | 407 store i8* %a, i8** %a.addr, align 8 |
408 %arraydecay = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0 | 408 %arraydecay = getelementptr inbounds [4 x i8], [4 x i8]* %buf, i32 0, i32 0 |
409 %0 = load i8** %a.addr, align 8 | 409 %0 = load i8*, i8** %a.addr, align 8 |
410 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) | 410 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) |
411 %arraydecay1 = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0 | 411 %arraydecay1 = getelementptr inbounds [4 x i8], [4 x i8]* %buf, i32 0, i32 0 |
412 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1) | 412 %call2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1) |
413 ret void | 413 ret void |
414 } | 414 } |
415 | 415 |
416 ; test4a: struct { [4 x i8] } | 416 ; test4a: struct { [4 x i8] } |
417 ; no ssp attribute | 417 ; no ssp attribute |
434 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 434 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
435 ; DARWIN-X64: .cfi_endproc | 435 ; DARWIN-X64: .cfi_endproc |
436 %a.addr = alloca i8*, align 8 | 436 %a.addr = alloca i8*, align 8 |
437 %b = alloca %struct.foo.0, align 1 | 437 %b = alloca %struct.foo.0, align 1 |
438 store i8* %a, i8** %a.addr, align 8 | 438 store i8* %a, i8** %a.addr, align 8 |
439 %buf = getelementptr inbounds %struct.foo.0* %b, i32 0, i32 0 | 439 %buf = getelementptr inbounds %struct.foo.0, %struct.foo.0* %b, i32 0, i32 0 |
440 %arraydecay = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0 | 440 %arraydecay = getelementptr inbounds [4 x i8], [4 x i8]* %buf, i32 0, i32 0 |
441 %0 = load i8** %a.addr, align 8 | 441 %0 = load i8*, i8** %a.addr, align 8 |
442 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) | 442 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) |
443 %buf1 = getelementptr inbounds %struct.foo.0* %b, i32 0, i32 0 | 443 %buf1 = getelementptr inbounds %struct.foo.0, %struct.foo.0* %b, i32 0, i32 0 |
444 %arraydecay2 = getelementptr inbounds [4 x i8]* %buf1, i32 0, i32 0 | 444 %arraydecay2 = getelementptr inbounds [4 x i8], [4 x i8]* %buf1, i32 0, i32 0 |
445 %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2) | 445 %call3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2) |
446 ret void | 446 ret void |
447 } | 447 } |
448 | 448 |
449 ; test4b: struct { [4 x i8] } | 449 ; test4b: struct { [4 x i8] } |
450 ; ssp attribute | 450 ; ssp attribute |
468 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 468 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
469 ; DARWIN-X64: .cfi_endproc | 469 ; DARWIN-X64: .cfi_endproc |
470 %a.addr = alloca i8*, align 8 | 470 %a.addr = alloca i8*, align 8 |
471 %b = alloca %struct.foo.0, align 1 | 471 %b = alloca %struct.foo.0, align 1 |
472 store i8* %a, i8** %a.addr, align 8 | 472 store i8* %a, i8** %a.addr, align 8 |
473 %buf = getelementptr inbounds %struct.foo.0* %b, i32 0, i32 0 | 473 %buf = getelementptr inbounds %struct.foo.0, %struct.foo.0* %b, i32 0, i32 0 |
474 %arraydecay = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0 | 474 %arraydecay = getelementptr inbounds [4 x i8], [4 x i8]* %buf, i32 0, i32 0 |
475 %0 = load i8** %a.addr, align 8 | 475 %0 = load i8*, i8** %a.addr, align 8 |
476 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) | 476 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) |
477 %buf1 = getelementptr inbounds %struct.foo.0* %b, i32 0, i32 0 | 477 %buf1 = getelementptr inbounds %struct.foo.0, %struct.foo.0* %b, i32 0, i32 0 |
478 %arraydecay2 = getelementptr inbounds [4 x i8]* %buf1, i32 0, i32 0 | 478 %arraydecay2 = getelementptr inbounds [4 x i8], [4 x i8]* %buf1, i32 0, i32 0 |
479 %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2) | 479 %call3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2) |
480 ret void | 480 ret void |
481 } | 481 } |
482 | 482 |
483 ; test4c: struct { [4 x i8] } | 483 ; test4c: struct { [4 x i8] } |
484 ; sspstrong attribute | 484 ; sspstrong attribute |
502 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 502 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
503 ; DARWIN-X64: callq ___stack_chk_fail | 503 ; DARWIN-X64: callq ___stack_chk_fail |
504 %a.addr = alloca i8*, align 8 | 504 %a.addr = alloca i8*, align 8 |
505 %b = alloca %struct.foo.0, align 1 | 505 %b = alloca %struct.foo.0, align 1 |
506 store i8* %a, i8** %a.addr, align 8 | 506 store i8* %a, i8** %a.addr, align 8 |
507 %buf = getelementptr inbounds %struct.foo.0* %b, i32 0, i32 0 | 507 %buf = getelementptr inbounds %struct.foo.0, %struct.foo.0* %b, i32 0, i32 0 |
508 %arraydecay = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0 | 508 %arraydecay = getelementptr inbounds [4 x i8], [4 x i8]* %buf, i32 0, i32 0 |
509 %0 = load i8** %a.addr, align 8 | 509 %0 = load i8*, i8** %a.addr, align 8 |
510 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) | 510 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) |
511 %buf1 = getelementptr inbounds %struct.foo.0* %b, i32 0, i32 0 | 511 %buf1 = getelementptr inbounds %struct.foo.0, %struct.foo.0* %b, i32 0, i32 0 |
512 %arraydecay2 = getelementptr inbounds [4 x i8]* %buf1, i32 0, i32 0 | 512 %arraydecay2 = getelementptr inbounds [4 x i8], [4 x i8]* %buf1, i32 0, i32 0 |
513 %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2) | 513 %call3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2) |
514 ret void | 514 ret void |
515 } | 515 } |
516 | 516 |
517 ; test4d: struct { [4 x i8] } | 517 ; test4d: struct { [4 x i8] } |
518 ; sspreq attribute | 518 ; sspreq attribute |
536 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 536 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
537 ; DARWIN-X64: callq ___stack_chk_fail | 537 ; DARWIN-X64: callq ___stack_chk_fail |
538 %a.addr = alloca i8*, align 8 | 538 %a.addr = alloca i8*, align 8 |
539 %b = alloca %struct.foo.0, align 1 | 539 %b = alloca %struct.foo.0, align 1 |
540 store i8* %a, i8** %a.addr, align 8 | 540 store i8* %a, i8** %a.addr, align 8 |
541 %buf = getelementptr inbounds %struct.foo.0* %b, i32 0, i32 0 | 541 %buf = getelementptr inbounds %struct.foo.0, %struct.foo.0* %b, i32 0, i32 0 |
542 %arraydecay = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0 | 542 %arraydecay = getelementptr inbounds [4 x i8], [4 x i8]* %buf, i32 0, i32 0 |
543 %0 = load i8** %a.addr, align 8 | 543 %0 = load i8*, i8** %a.addr, align 8 |
544 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) | 544 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) |
545 %buf1 = getelementptr inbounds %struct.foo.0* %b, i32 0, i32 0 | 545 %buf1 = getelementptr inbounds %struct.foo.0, %struct.foo.0* %b, i32 0, i32 0 |
546 %arraydecay2 = getelementptr inbounds [4 x i8]* %buf1, i32 0, i32 0 | 546 %arraydecay2 = getelementptr inbounds [4 x i8], [4 x i8]* %buf1, i32 0, i32 0 |
547 %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2) | 547 %call3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2) |
548 ret void | 548 ret void |
549 } | 549 } |
550 | 550 |
551 ; test5a: no arrays / no nested arrays | 551 ; test5a: no arrays / no nested arrays |
552 ; no ssp attribute | 552 ; no ssp attribute |
568 ; DARWIN-X64-LABEL: test5a: | 568 ; DARWIN-X64-LABEL: test5a: |
569 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 569 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
570 ; DARWIN-X64: .cfi_endproc | 570 ; DARWIN-X64: .cfi_endproc |
571 %a.addr = alloca i8*, align 8 | 571 %a.addr = alloca i8*, align 8 |
572 store i8* %a, i8** %a.addr, align 8 | 572 store i8* %a, i8** %a.addr, align 8 |
573 %0 = load i8** %a.addr, align 8 | 573 %0 = load i8*, i8** %a.addr, align 8 |
574 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %0) | 574 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %0) |
575 ret void | 575 ret void |
576 } | 576 } |
577 | 577 |
578 ; test5b: no arrays / no nested arrays | 578 ; test5b: no arrays / no nested arrays |
579 ; ssp attribute | 579 ; ssp attribute |
596 ; DARWIN-X64-LABEL: test5b: | 596 ; DARWIN-X64-LABEL: test5b: |
597 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 597 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
598 ; DARWIN-X64: .cfi_endproc | 598 ; DARWIN-X64: .cfi_endproc |
599 %a.addr = alloca i8*, align 8 | 599 %a.addr = alloca i8*, align 8 |
600 store i8* %a, i8** %a.addr, align 8 | 600 store i8* %a, i8** %a.addr, align 8 |
601 %0 = load i8** %a.addr, align 8 | 601 %0 = load i8*, i8** %a.addr, align 8 |
602 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %0) | 602 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %0) |
603 ret void | 603 ret void |
604 } | 604 } |
605 | 605 |
606 ; test5c: no arrays / no nested arrays | 606 ; test5c: no arrays / no nested arrays |
607 ; sspstrong attribute | 607 ; sspstrong attribute |
624 ; DARWIN-X64-LABEL: test5c: | 624 ; DARWIN-X64-LABEL: test5c: |
625 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 625 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
626 ; DARWIN-X64: .cfi_endproc | 626 ; DARWIN-X64: .cfi_endproc |
627 %a.addr = alloca i8*, align 8 | 627 %a.addr = alloca i8*, align 8 |
628 store i8* %a, i8** %a.addr, align 8 | 628 store i8* %a, i8** %a.addr, align 8 |
629 %0 = load i8** %a.addr, align 8 | 629 %0 = load i8*, i8** %a.addr, align 8 |
630 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %0) | 630 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %0) |
631 ret void | 631 ret void |
632 } | 632 } |
633 | 633 |
634 ; test5d: no arrays / no nested arrays | 634 ; test5d: no arrays / no nested arrays |
635 ; sspreq attribute | 635 ; sspreq attribute |
652 ; DARWIN-X64-LABEL: test5d: | 652 ; DARWIN-X64-LABEL: test5d: |
653 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 653 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
654 ; DARWIN-X64: callq ___stack_chk_fail | 654 ; DARWIN-X64: callq ___stack_chk_fail |
655 %a.addr = alloca i8*, align 8 | 655 %a.addr = alloca i8*, align 8 |
656 store i8* %a, i8** %a.addr, align 8 | 656 store i8* %a, i8** %a.addr, align 8 |
657 %0 = load i8** %a.addr, align 8 | 657 %0 = load i8*, i8** %a.addr, align 8 |
658 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %0) | 658 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %0) |
659 ret void | 659 ret void |
660 } | 660 } |
661 | 661 |
662 ; test6a: Address-of local taken (j = &a) | 662 ; test6a: Address-of local taken (j = &a) |
663 ; no ssp attribute | 663 ; no ssp attribute |
681 ; DARWIN-X64: .cfi_endproc | 681 ; DARWIN-X64: .cfi_endproc |
682 %retval = alloca i32, align 4 | 682 %retval = alloca i32, align 4 |
683 %a = alloca i32, align 4 | 683 %a = alloca i32, align 4 |
684 %j = alloca i32*, align 8 | 684 %j = alloca i32*, align 8 |
685 store i32 0, i32* %retval | 685 store i32 0, i32* %retval |
686 %0 = load i32* %a, align 4 | 686 %0 = load i32, i32* %a, align 4 |
687 %add = add nsw i32 %0, 1 | 687 %add = add nsw i32 %0, 1 |
688 store i32 %add, i32* %a, align 4 | 688 store i32 %add, i32* %a, align 4 |
689 store i32* %a, i32** %j, align 8 | 689 store i32* %a, i32** %j, align 8 |
690 ret void | 690 ret void |
691 } | 691 } |
713 ; DARWIN-X64: .cfi_endproc | 713 ; DARWIN-X64: .cfi_endproc |
714 %retval = alloca i32, align 4 | 714 %retval = alloca i32, align 4 |
715 %a = alloca i32, align 4 | 715 %a = alloca i32, align 4 |
716 %j = alloca i32*, align 8 | 716 %j = alloca i32*, align 8 |
717 store i32 0, i32* %retval | 717 store i32 0, i32* %retval |
718 %0 = load i32* %a, align 4 | 718 %0 = load i32, i32* %a, align 4 |
719 %add = add nsw i32 %0, 1 | 719 %add = add nsw i32 %0, 1 |
720 store i32 %add, i32* %a, align 4 | 720 store i32 %add, i32* %a, align 4 |
721 store i32* %a, i32** %j, align 8 | 721 store i32* %a, i32** %j, align 8 |
722 ret void | 722 ret void |
723 } | 723 } |
745 ; DARWIN-X64: callq ___stack_chk_fail | 745 ; DARWIN-X64: callq ___stack_chk_fail |
746 %retval = alloca i32, align 4 | 746 %retval = alloca i32, align 4 |
747 %a = alloca i32, align 4 | 747 %a = alloca i32, align 4 |
748 %j = alloca i32*, align 8 | 748 %j = alloca i32*, align 8 |
749 store i32 0, i32* %retval | 749 store i32 0, i32* %retval |
750 %0 = load i32* %a, align 4 | 750 %0 = load i32, i32* %a, align 4 |
751 %add = add nsw i32 %0, 1 | 751 %add = add nsw i32 %0, 1 |
752 store i32 %add, i32* %a, align 4 | 752 store i32 %add, i32* %a, align 4 |
753 store i32* %a, i32** %j, align 8 | 753 store i32* %a, i32** %j, align 8 |
754 ret void | 754 ret void |
755 } | 755 } |
777 ; DARWIN-X64: callq ___stack_chk_fail | 777 ; DARWIN-X64: callq ___stack_chk_fail |
778 %retval = alloca i32, align 4 | 778 %retval = alloca i32, align 4 |
779 %a = alloca i32, align 4 | 779 %a = alloca i32, align 4 |
780 %j = alloca i32*, align 8 | 780 %j = alloca i32*, align 8 |
781 store i32 0, i32* %retval | 781 store i32 0, i32* %retval |
782 %0 = load i32* %a, align 4 | 782 %0 = load i32, i32* %a, align 4 |
783 %add = add nsw i32 %0, 1 | 783 %add = add nsw i32 %0, 1 |
784 store i32 %add, i32* %a, align 4 | 784 store i32 %add, i32* %a, align 4 |
785 store i32* %a, i32** %j, align 8 | 785 store i32* %a, i32** %j, align 8 |
786 ret void | 786 ret void |
787 } | 787 } |
806 ; DARWIN-X64-LABEL: test7a: | 806 ; DARWIN-X64-LABEL: test7a: |
807 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 807 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
808 ; DARWIN-X64: .cfi_endproc | 808 ; DARWIN-X64: .cfi_endproc |
809 %a = alloca i32, align 4 | 809 %a = alloca i32, align 4 |
810 %0 = ptrtoint i32* %a to i64 | 810 %0 = ptrtoint i32* %a to i64 |
811 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %0) | 811 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i64 %0) |
812 ret void | 812 ret void |
813 } | 813 } |
814 | 814 |
815 ; test7b: PtrToInt Cast | 815 ; test7b: PtrToInt Cast |
816 ; ssp attribute | 816 ; ssp attribute |
833 ; DARWIN-X64-LABEL: test7b: | 833 ; DARWIN-X64-LABEL: test7b: |
834 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 834 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
835 ; DARWIN-X64: .cfi_endproc | 835 ; DARWIN-X64: .cfi_endproc |
836 %a = alloca i32, align 4 | 836 %a = alloca i32, align 4 |
837 %0 = ptrtoint i32* %a to i64 | 837 %0 = ptrtoint i32* %a to i64 |
838 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %0) | 838 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i64 %0) |
839 ret void | 839 ret void |
840 } | 840 } |
841 | 841 |
842 ; test7c: PtrToInt Cast | 842 ; test7c: PtrToInt Cast |
843 ; sspstrong attribute | 843 ; sspstrong attribute |
860 ; DARWIN-X64-LABEL: test7c: | 860 ; DARWIN-X64-LABEL: test7c: |
861 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 861 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
862 ; DARWIN-X64: callq ___stack_chk_fail | 862 ; DARWIN-X64: callq ___stack_chk_fail |
863 %a = alloca i32, align 4 | 863 %a = alloca i32, align 4 |
864 %0 = ptrtoint i32* %a to i64 | 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) | 865 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i64 %0) |
866 ret void | 866 ret void |
867 } | 867 } |
868 | 868 |
869 ; test7d: PtrToInt Cast | 869 ; test7d: PtrToInt Cast |
870 ; sspreq attribute | 870 ; sspreq attribute |
887 ; DARWIN-X64-LABEL: test7d: | 887 ; DARWIN-X64-LABEL: test7d: |
888 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 888 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
889 ; DARWIN-X64: callq ___stack_chk_fail | 889 ; DARWIN-X64: callq ___stack_chk_fail |
890 %a = alloca i32, align 4 | 890 %a = alloca i32, align 4 |
891 %0 = ptrtoint i32* %a to i64 | 891 %0 = ptrtoint i32* %a to i64 |
892 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %0) | 892 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i64 %0) |
893 ret void | 893 ret void |
894 } | 894 } |
895 | 895 |
896 ; test8a: Passing addr-of to function call | 896 ; test8a: Passing addr-of to function call |
897 ; no ssp attribute | 897 ; no ssp attribute |
1019 %x = alloca double, align 8 | 1019 %x = alloca double, align 8 |
1020 %call = call double @testi_aux() | 1020 %call = call double @testi_aux() |
1021 store double %call, double* %x, align 8 | 1021 store double %call, double* %x, align 8 |
1022 %cmp2 = fcmp ogt double %call, 0.000000e+00 | 1022 %cmp2 = fcmp ogt double %call, 0.000000e+00 |
1023 %y.1 = select i1 %cmp2, double* %x, double* null | 1023 %y.1 = select i1 %cmp2, double* %x, double* null |
1024 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), double* %y.1) | 1024 %call2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), double* %y.1) |
1025 ret void | 1025 ret void |
1026 } | 1026 } |
1027 | 1027 |
1028 ; test9b: Addr-of in select instruction | 1028 ; test9b: Addr-of in select instruction |
1029 ; ssp attribute | 1029 ; ssp attribute |
1049 %x = alloca double, align 8 | 1049 %x = alloca double, align 8 |
1050 %call = call double @testi_aux() | 1050 %call = call double @testi_aux() |
1051 store double %call, double* %x, align 8 | 1051 store double %call, double* %x, align 8 |
1052 %cmp2 = fcmp ogt double %call, 0.000000e+00 | 1052 %cmp2 = fcmp ogt double %call, 0.000000e+00 |
1053 %y.1 = select i1 %cmp2, double* %x, double* null | 1053 %y.1 = select i1 %cmp2, double* %x, double* null |
1054 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), double* %y.1) | 1054 %call2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), double* %y.1) |
1055 ret void | 1055 ret void |
1056 } | 1056 } |
1057 | 1057 |
1058 ; test9c: Addr-of in select instruction | 1058 ; test9c: Addr-of in select instruction |
1059 ; sspstrong attribute | 1059 ; sspstrong attribute |
1079 %x = alloca double, align 8 | 1079 %x = alloca double, align 8 |
1080 %call = call double @testi_aux() | 1080 %call = call double @testi_aux() |
1081 store double %call, double* %x, align 8 | 1081 store double %call, double* %x, align 8 |
1082 %cmp2 = fcmp ogt double %call, 0.000000e+00 | 1082 %cmp2 = fcmp ogt double %call, 0.000000e+00 |
1083 %y.1 = select i1 %cmp2, double* %x, double* null | 1083 %y.1 = select i1 %cmp2, double* %x, double* null |
1084 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), double* %y.1) | 1084 %call2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), double* %y.1) |
1085 ret void | 1085 ret void |
1086 } | 1086 } |
1087 | 1087 |
1088 ; test9d: Addr-of in select instruction | 1088 ; test9d: Addr-of in select instruction |
1089 ; sspreq attribute | 1089 ; sspreq attribute |
1109 %x = alloca double, align 8 | 1109 %x = alloca double, align 8 |
1110 %call = call double @testi_aux() | 1110 %call = call double @testi_aux() |
1111 store double %call, double* %x, align 8 | 1111 store double %call, double* %x, align 8 |
1112 %cmp2 = fcmp ogt double %call, 0.000000e+00 | 1112 %cmp2 = fcmp ogt double %call, 0.000000e+00 |
1113 %y.1 = select i1 %cmp2, double* %x, double* null | 1113 %y.1 = select i1 %cmp2, double* %x, double* null |
1114 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), double* %y.1) | 1114 %call2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), double* %y.1) |
1115 ret void | 1115 ret void |
1116 } | 1116 } |
1117 | 1117 |
1118 ; test10a: Addr-of in phi instruction | 1118 ; test10a: Addr-of in phi instruction |
1119 ; no ssp attribute | 1119 ; no ssp attribute |
1153 if.then3: ; preds = %if.else | 1153 if.then3: ; preds = %if.else |
1154 br label %if.end4 | 1154 br label %if.end4 |
1155 | 1155 |
1156 if.end4: ; preds = %if.else, %if.then3, %if.then | 1156 if.end4: ; preds = %if.else, %if.then3, %if.then |
1157 %y.0 = phi double* [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ] | 1157 %y.0 = phi double* [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ] |
1158 %call5 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), double* %y.0) | 1158 %call5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %y.0) |
1159 ret void | 1159 ret void |
1160 } | 1160 } |
1161 | 1161 |
1162 ; test10b: Addr-of in phi instruction | 1162 ; test10b: Addr-of in phi instruction |
1163 ; ssp attribute | 1163 ; ssp attribute |
1198 if.then3: ; preds = %if.else | 1198 if.then3: ; preds = %if.else |
1199 br label %if.end4 | 1199 br label %if.end4 |
1200 | 1200 |
1201 if.end4: ; preds = %if.else, %if.then3, %if.then | 1201 if.end4: ; preds = %if.else, %if.then3, %if.then |
1202 %y.0 = phi double* [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ] | 1202 %y.0 = phi double* [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ] |
1203 %call5 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), double* %y.0) | 1203 %call5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %y.0) |
1204 ret void | 1204 ret void |
1205 } | 1205 } |
1206 | 1206 |
1207 ; test10c: Addr-of in phi instruction | 1207 ; test10c: Addr-of in phi instruction |
1208 ; sspstrong attribute | 1208 ; sspstrong attribute |
1243 if.then3: ; preds = %if.else | 1243 if.then3: ; preds = %if.else |
1244 br label %if.end4 | 1244 br label %if.end4 |
1245 | 1245 |
1246 if.end4: ; preds = %if.else, %if.then3, %if.then | 1246 if.end4: ; preds = %if.else, %if.then3, %if.then |
1247 %y.0 = phi double* [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ] | 1247 %y.0 = phi double* [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ] |
1248 %call5 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), double* %y.0) | 1248 %call5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %y.0) |
1249 ret void | 1249 ret void |
1250 } | 1250 } |
1251 | 1251 |
1252 ; test10d: Addr-of in phi instruction | 1252 ; test10d: Addr-of in phi instruction |
1253 ; sspreq attribute | 1253 ; sspreq attribute |
1288 if.then3: ; preds = %if.else | 1288 if.then3: ; preds = %if.else |
1289 br label %if.end4 | 1289 br label %if.end4 |
1290 | 1290 |
1291 if.end4: ; preds = %if.else, %if.then3, %if.then | 1291 if.end4: ; preds = %if.else, %if.then3, %if.then |
1292 %y.0 = phi double* [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ] | 1292 %y.0 = phi double* [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ] |
1293 %call5 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), double* %y.0) | 1293 %call5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %y.0) |
1294 ret void | 1294 ret void |
1295 } | 1295 } |
1296 | 1296 |
1297 ; test11a: Addr-of struct element. (GEP followed by store). | 1297 ; test11a: Addr-of struct element. (GEP followed by store). |
1298 ; no ssp attribute | 1298 ; no ssp attribute |
1314 ; DARWIN-X64-LABEL: test11a: | 1314 ; DARWIN-X64-LABEL: test11a: |
1315 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 1315 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
1316 ; DARWIN-X64: .cfi_endproc | 1316 ; DARWIN-X64: .cfi_endproc |
1317 %c = alloca %struct.pair, align 4 | 1317 %c = alloca %struct.pair, align 4 |
1318 %b = alloca i32*, align 8 | 1318 %b = alloca i32*, align 8 |
1319 %y = getelementptr inbounds %struct.pair* %c, i32 0, i32 1 | 1319 %y = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 1 |
1320 store i32* %y, i32** %b, align 8 | 1320 store i32* %y, i32** %b, align 8 |
1321 %0 = load i32** %b, align 8 | 1321 %0 = load i32*, i32** %b, align 8 |
1322 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i32* %0) | 1322 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i32* %0) |
1323 ret void | 1323 ret void |
1324 } | 1324 } |
1325 | 1325 |
1326 ; test11b: Addr-of struct element. (GEP followed by store). | 1326 ; test11b: Addr-of struct element. (GEP followed by store). |
1327 ; ssp attribute | 1327 ; ssp attribute |
1344 ; DARWIN-X64-LABEL: test11b: | 1344 ; DARWIN-X64-LABEL: test11b: |
1345 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 1345 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
1346 ; DARWIN-X64: .cfi_endproc | 1346 ; DARWIN-X64: .cfi_endproc |
1347 %c = alloca %struct.pair, align 4 | 1347 %c = alloca %struct.pair, align 4 |
1348 %b = alloca i32*, align 8 | 1348 %b = alloca i32*, align 8 |
1349 %y = getelementptr inbounds %struct.pair* %c, i32 0, i32 1 | 1349 %y = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 1 |
1350 store i32* %y, i32** %b, align 8 | 1350 store i32* %y, i32** %b, align 8 |
1351 %0 = load i32** %b, align 8 | 1351 %0 = load i32*, i32** %b, align 8 |
1352 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i32* %0) | 1352 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i32* %0) |
1353 ret void | 1353 ret void |
1354 } | 1354 } |
1355 | 1355 |
1356 ; test11c: Addr-of struct element. (GEP followed by store). | 1356 ; test11c: Addr-of struct element. (GEP followed by store). |
1357 ; sspstrong attribute | 1357 ; sspstrong attribute |
1374 ; DARWIN-X64-LABEL: test11c: | 1374 ; DARWIN-X64-LABEL: test11c: |
1375 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 1375 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
1376 ; DARWIN-X64: callq ___stack_chk_fail | 1376 ; DARWIN-X64: callq ___stack_chk_fail |
1377 %c = alloca %struct.pair, align 4 | 1377 %c = alloca %struct.pair, align 4 |
1378 %b = alloca i32*, align 8 | 1378 %b = alloca i32*, align 8 |
1379 %y = getelementptr inbounds %struct.pair* %c, i32 0, i32 1 | 1379 %y = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 1 |
1380 store i32* %y, i32** %b, align 8 | 1380 store i32* %y, i32** %b, align 8 |
1381 %0 = load i32** %b, align 8 | 1381 %0 = load i32*, i32** %b, align 8 |
1382 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i32* %0) | 1382 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i32* %0) |
1383 ret void | 1383 ret void |
1384 } | 1384 } |
1385 | 1385 |
1386 ; test11d: Addr-of struct element. (GEP followed by store). | 1386 ; test11d: Addr-of struct element. (GEP followed by store). |
1387 ; sspreq attribute | 1387 ; sspreq attribute |
1404 ; DARWIN-X64-LABEL: test11d: | 1404 ; DARWIN-X64-LABEL: test11d: |
1405 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 1405 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
1406 ; DARWIN-X64: callq ___stack_chk_fail | 1406 ; DARWIN-X64: callq ___stack_chk_fail |
1407 %c = alloca %struct.pair, align 4 | 1407 %c = alloca %struct.pair, align 4 |
1408 %b = alloca i32*, align 8 | 1408 %b = alloca i32*, align 8 |
1409 %y = getelementptr inbounds %struct.pair* %c, i32 0, i32 1 | 1409 %y = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 1 |
1410 store i32* %y, i32** %b, align 8 | 1410 store i32* %y, i32** %b, align 8 |
1411 %0 = load i32** %b, align 8 | 1411 %0 = load i32*, i32** %b, align 8 |
1412 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i32* %0) | 1412 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i32* %0) |
1413 ret void | 1413 ret void |
1414 } | 1414 } |
1415 | 1415 |
1416 ; test12a: Addr-of struct element, GEP followed by ptrtoint. | 1416 ; test12a: Addr-of struct element, GEP followed by ptrtoint. |
1417 ; no ssp attribute | 1417 ; no ssp attribute |
1433 ; DARWIN-X64-LABEL: test12a: | 1433 ; DARWIN-X64-LABEL: test12a: |
1434 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 1434 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
1435 ; DARWIN-X64: .cfi_endproc | 1435 ; DARWIN-X64: .cfi_endproc |
1436 %c = alloca %struct.pair, align 4 | 1436 %c = alloca %struct.pair, align 4 |
1437 %b = alloca i32*, align 8 | 1437 %b = alloca i32*, align 8 |
1438 %y = getelementptr inbounds %struct.pair* %c, i32 0, i32 1 | 1438 %y = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 1 |
1439 %0 = ptrtoint i32* %y to i64 | 1439 %0 = ptrtoint i32* %y to i64 |
1440 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %0) | 1440 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i64 %0) |
1441 ret void | 1441 ret void |
1442 } | 1442 } |
1443 | 1443 |
1444 ; test12b: Addr-of struct element, GEP followed by ptrtoint. | 1444 ; test12b: Addr-of struct element, GEP followed by ptrtoint. |
1445 ; ssp attribute | 1445 ; ssp attribute |
1462 ; DARWIN-X64-LABEL: test12b: | 1462 ; DARWIN-X64-LABEL: test12b: |
1463 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 1463 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
1464 ; DARWIN-X64: .cfi_endproc | 1464 ; DARWIN-X64: .cfi_endproc |
1465 %c = alloca %struct.pair, align 4 | 1465 %c = alloca %struct.pair, align 4 |
1466 %b = alloca i32*, align 8 | 1466 %b = alloca i32*, align 8 |
1467 %y = getelementptr inbounds %struct.pair* %c, i32 0, i32 1 | 1467 %y = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 1 |
1468 %0 = ptrtoint i32* %y to i64 | 1468 %0 = ptrtoint i32* %y to i64 |
1469 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %0) | 1469 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i64 %0) |
1470 ret void | 1470 ret void |
1471 } | 1471 } |
1472 | 1472 |
1473 ; test12c: Addr-of struct element, GEP followed by ptrtoint. | 1473 ; test12c: Addr-of struct element, GEP followed by ptrtoint. |
1474 ; sspstrong attribute | 1474 ; sspstrong attribute |
1490 ; DARWIN-X64-LABEL: test12c: | 1490 ; DARWIN-X64-LABEL: test12c: |
1491 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 1491 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
1492 ; DARWIN-X64: callq ___stack_chk_fail | 1492 ; DARWIN-X64: callq ___stack_chk_fail |
1493 %c = alloca %struct.pair, align 4 | 1493 %c = alloca %struct.pair, align 4 |
1494 %b = alloca i32*, align 8 | 1494 %b = alloca i32*, align 8 |
1495 %y = getelementptr inbounds %struct.pair* %c, i32 0, i32 1 | 1495 %y = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 1 |
1496 %0 = ptrtoint i32* %y to i64 | 1496 %0 = ptrtoint i32* %y to i64 |
1497 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %0) | 1497 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i64 %0) |
1498 ret void | 1498 ret void |
1499 } | 1499 } |
1500 | 1500 |
1501 ; test12d: Addr-of struct element, GEP followed by ptrtoint. | 1501 ; test12d: Addr-of struct element, GEP followed by ptrtoint. |
1502 ; sspreq attribute | 1502 ; sspreq attribute |
1519 ; DARWIN-X64-LABEL: test12d: | 1519 ; DARWIN-X64-LABEL: test12d: |
1520 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 1520 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
1521 ; DARWIN-X64: callq ___stack_chk_fail | 1521 ; DARWIN-X64: callq ___stack_chk_fail |
1522 %c = alloca %struct.pair, align 4 | 1522 %c = alloca %struct.pair, align 4 |
1523 %b = alloca i32*, align 8 | 1523 %b = alloca i32*, align 8 |
1524 %y = getelementptr inbounds %struct.pair* %c, i32 0, i32 1 | 1524 %y = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 1 |
1525 %0 = ptrtoint i32* %y to i64 | 1525 %0 = ptrtoint i32* %y to i64 |
1526 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %0) | 1526 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i64 %0) |
1527 ret void | 1527 ret void |
1528 } | 1528 } |
1529 | 1529 |
1530 ; test13a: Addr-of struct element, GEP followed by callinst. | 1530 ; test13a: Addr-of struct element, GEP followed by callinst. |
1531 ; no ssp attribute | 1531 ; no ssp attribute |
1546 | 1546 |
1547 ; DARWIN-X64-LABEL: test13a: | 1547 ; DARWIN-X64-LABEL: test13a: |
1548 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 1548 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
1549 ; DARWIN-X64: .cfi_endproc | 1549 ; DARWIN-X64: .cfi_endproc |
1550 %c = alloca %struct.pair, align 4 | 1550 %c = alloca %struct.pair, align 4 |
1551 %y = getelementptr inbounds %struct.pair* %c, i64 0, i32 1 | 1551 %y = getelementptr inbounds %struct.pair, %struct.pair* %c, i64 0, i32 1 |
1552 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32* %y) | 1552 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %y) |
1553 ret void | 1553 ret void |
1554 } | 1554 } |
1555 | 1555 |
1556 ; test13b: Addr-of struct element, GEP followed by callinst. | 1556 ; test13b: Addr-of struct element, GEP followed by callinst. |
1557 ; ssp attribute | 1557 ; ssp attribute |
1573 | 1573 |
1574 ; DARWIN-X64-LABEL: test13b: | 1574 ; DARWIN-X64-LABEL: test13b: |
1575 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 1575 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
1576 ; DARWIN-X64: .cfi_endproc | 1576 ; DARWIN-X64: .cfi_endproc |
1577 %c = alloca %struct.pair, align 4 | 1577 %c = alloca %struct.pair, align 4 |
1578 %y = getelementptr inbounds %struct.pair* %c, i64 0, i32 1 | 1578 %y = getelementptr inbounds %struct.pair, %struct.pair* %c, i64 0, i32 1 |
1579 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32* %y) | 1579 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %y) |
1580 ret void | 1580 ret void |
1581 } | 1581 } |
1582 | 1582 |
1583 ; test13c: Addr-of struct element, GEP followed by callinst. | 1583 ; test13c: Addr-of struct element, GEP followed by callinst. |
1584 ; sspstrong attribute | 1584 ; sspstrong attribute |
1600 | 1600 |
1601 ; DARWIN-X64-LABEL: test13c: | 1601 ; DARWIN-X64-LABEL: test13c: |
1602 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 1602 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
1603 ; DARWIN-X64: callq ___stack_chk_fail | 1603 ; DARWIN-X64: callq ___stack_chk_fail |
1604 %c = alloca %struct.pair, align 4 | 1604 %c = alloca %struct.pair, align 4 |
1605 %y = getelementptr inbounds %struct.pair* %c, i64 0, i32 1 | 1605 %y = getelementptr inbounds %struct.pair, %struct.pair* %c, i64 0, i32 1 |
1606 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32* %y) | 1606 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %y) |
1607 ret void | 1607 ret void |
1608 } | 1608 } |
1609 | 1609 |
1610 ; test13d: Addr-of struct element, GEP followed by callinst. | 1610 ; test13d: Addr-of struct element, GEP followed by callinst. |
1611 ; sspreq attribute | 1611 ; sspreq attribute |
1627 | 1627 |
1628 ; DARWIN-X64-LABEL: test13d: | 1628 ; DARWIN-X64-LABEL: test13d: |
1629 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 1629 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
1630 ; DARWIN-X64: callq ___stack_chk_fail | 1630 ; DARWIN-X64: callq ___stack_chk_fail |
1631 %c = alloca %struct.pair, align 4 | 1631 %c = alloca %struct.pair, align 4 |
1632 %y = getelementptr inbounds %struct.pair* %c, i64 0, i32 1 | 1632 %y = getelementptr inbounds %struct.pair, %struct.pair* %c, i64 0, i32 1 |
1633 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32* %y) | 1633 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %y) |
1634 ret void | 1634 ret void |
1635 } | 1635 } |
1636 | 1636 |
1637 ; test14a: Addr-of a local, optimized into a GEP (e.g., &a - 12) | 1637 ; test14a: Addr-of a local, optimized into a GEP (e.g., &a - 12) |
1638 ; no ssp attribute | 1638 ; no ssp attribute |
1653 | 1653 |
1654 ; DARWIN-X64-LABEL: test14a: | 1654 ; DARWIN-X64-LABEL: test14a: |
1655 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 1655 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
1656 ; DARWIN-X64: .cfi_endproc | 1656 ; DARWIN-X64: .cfi_endproc |
1657 %a = alloca i32, align 4 | 1657 %a = alloca i32, align 4 |
1658 %add.ptr5 = getelementptr inbounds i32* %a, i64 -12 | 1658 %add.ptr5 = getelementptr inbounds i32, i32* %a, i64 -12 |
1659 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32* %add.ptr5) | 1659 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %add.ptr5) |
1660 ret void | 1660 ret void |
1661 } | 1661 } |
1662 | 1662 |
1663 ; test14b: Addr-of a local, optimized into a GEP (e.g., &a - 12) | 1663 ; test14b: Addr-of a local, optimized into a GEP (e.g., &a - 12) |
1664 ; ssp attribute | 1664 ; ssp attribute |
1680 | 1680 |
1681 ; DARWIN-X64-LABEL: test14b: | 1681 ; DARWIN-X64-LABEL: test14b: |
1682 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 1682 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
1683 ; DARWIN-X64: .cfi_endproc | 1683 ; DARWIN-X64: .cfi_endproc |
1684 %a = alloca i32, align 4 | 1684 %a = alloca i32, align 4 |
1685 %add.ptr5 = getelementptr inbounds i32* %a, i64 -12 | 1685 %add.ptr5 = getelementptr inbounds i32, i32* %a, i64 -12 |
1686 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32* %add.ptr5) | 1686 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %add.ptr5) |
1687 ret void | 1687 ret void |
1688 } | 1688 } |
1689 | 1689 |
1690 ; test14c: Addr-of a local, optimized into a GEP (e.g., &a - 12) | 1690 ; test14c: Addr-of a local, optimized into a GEP (e.g., &a - 12) |
1691 ; sspstrong attribute | 1691 ; sspstrong attribute |
1707 | 1707 |
1708 ; DARWIN-X64-LABEL: test14c: | 1708 ; DARWIN-X64-LABEL: test14c: |
1709 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 1709 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
1710 ; DARWIN-X64: callq ___stack_chk_fail | 1710 ; DARWIN-X64: callq ___stack_chk_fail |
1711 %a = alloca i32, align 4 | 1711 %a = alloca i32, align 4 |
1712 %add.ptr5 = getelementptr inbounds i32* %a, i64 -12 | 1712 %add.ptr5 = getelementptr inbounds i32, i32* %a, i64 -12 |
1713 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32* %add.ptr5) | 1713 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %add.ptr5) |
1714 ret void | 1714 ret void |
1715 } | 1715 } |
1716 | 1716 |
1717 ; test14d: Addr-of a local, optimized into a GEP (e.g., &a - 12) | 1717 ; test14d: Addr-of a local, optimized into a GEP (e.g., &a - 12) |
1718 ; sspreq attribute | 1718 ; sspreq attribute |
1734 | 1734 |
1735 ; DARWIN-X64-LABEL: test14d: | 1735 ; DARWIN-X64-LABEL: test14d: |
1736 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 1736 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
1737 ; DARWIN-X64: callq ___stack_chk_fail | 1737 ; DARWIN-X64: callq ___stack_chk_fail |
1738 %a = alloca i32, align 4 | 1738 %a = alloca i32, align 4 |
1739 %add.ptr5 = getelementptr inbounds i32* %a, i64 -12 | 1739 %add.ptr5 = getelementptr inbounds i32, i32* %a, i64 -12 |
1740 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32* %add.ptr5) | 1740 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %add.ptr5) |
1741 ret void | 1741 ret void |
1742 } | 1742 } |
1743 | 1743 |
1744 ; test15a: Addr-of a local cast to a ptr of a different type | 1744 ; test15a: Addr-of a local cast to a ptr of a different type |
1745 ; (e.g., int a; ... ; float *b = &a;) | 1745 ; (e.g., int a; ... ; float *b = &a;) |
1765 %a = alloca i32, align 4 | 1765 %a = alloca i32, align 4 |
1766 %b = alloca float*, align 8 | 1766 %b = alloca float*, align 8 |
1767 store i32 0, i32* %a, align 4 | 1767 store i32 0, i32* %a, align 4 |
1768 %0 = bitcast i32* %a to float* | 1768 %0 = bitcast i32* %a to float* |
1769 store float* %0, float** %b, align 8 | 1769 store float* %0, float** %b, align 8 |
1770 %1 = load float** %b, align 8 | 1770 %1 = load float*, float** %b, align 8 |
1771 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), float* %1) | 1771 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), float* %1) |
1772 ret void | 1772 ret void |
1773 } | 1773 } |
1774 | 1774 |
1775 ; test15b: Addr-of a local cast to a ptr of a different type | 1775 ; test15b: Addr-of a local cast to a ptr of a different type |
1776 ; (e.g., int a; ... ; float *b = &a;) | 1776 ; (e.g., int a; ... ; float *b = &a;) |
1797 %a = alloca i32, align 4 | 1797 %a = alloca i32, align 4 |
1798 %b = alloca float*, align 8 | 1798 %b = alloca float*, align 8 |
1799 store i32 0, i32* %a, align 4 | 1799 store i32 0, i32* %a, align 4 |
1800 %0 = bitcast i32* %a to float* | 1800 %0 = bitcast i32* %a to float* |
1801 store float* %0, float** %b, align 8 | 1801 store float* %0, float** %b, align 8 |
1802 %1 = load float** %b, align 8 | 1802 %1 = load float*, float** %b, align 8 |
1803 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), float* %1) | 1803 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), float* %1) |
1804 ret void | 1804 ret void |
1805 } | 1805 } |
1806 | 1806 |
1807 ; test15c: Addr-of a local cast to a ptr of a different type | 1807 ; test15c: Addr-of a local cast to a ptr of a different type |
1808 ; (e.g., int a; ... ; float *b = &a;) | 1808 ; (e.g., int a; ... ; float *b = &a;) |
1829 %a = alloca i32, align 4 | 1829 %a = alloca i32, align 4 |
1830 %b = alloca float*, align 8 | 1830 %b = alloca float*, align 8 |
1831 store i32 0, i32* %a, align 4 | 1831 store i32 0, i32* %a, align 4 |
1832 %0 = bitcast i32* %a to float* | 1832 %0 = bitcast i32* %a to float* |
1833 store float* %0, float** %b, align 8 | 1833 store float* %0, float** %b, align 8 |
1834 %1 = load float** %b, align 8 | 1834 %1 = load float*, float** %b, align 8 |
1835 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), float* %1) | 1835 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), float* %1) |
1836 ret void | 1836 ret void |
1837 } | 1837 } |
1838 | 1838 |
1839 ; test15d: Addr-of a local cast to a ptr of a different type | 1839 ; test15d: Addr-of a local cast to a ptr of a different type |
1840 ; (e.g., int a; ... ; float *b = &a;) | 1840 ; (e.g., int a; ... ; float *b = &a;) |
1861 %a = alloca i32, align 4 | 1861 %a = alloca i32, align 4 |
1862 %b = alloca float*, align 8 | 1862 %b = alloca float*, align 8 |
1863 store i32 0, i32* %a, align 4 | 1863 store i32 0, i32* %a, align 4 |
1864 %0 = bitcast i32* %a to float* | 1864 %0 = bitcast i32* %a to float* |
1865 store float* %0, float** %b, align 8 | 1865 store float* %0, float** %b, align 8 |
1866 %1 = load float** %b, align 8 | 1866 %1 = load float*, float** %b, align 8 |
1867 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), float* %1) | 1867 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), float* %1) |
1868 ret void | 1868 ret void |
1869 } | 1869 } |
1870 | 1870 |
1871 ; test16a: Addr-of a local cast to a ptr of a different type (optimized) | 1871 ; test16a: Addr-of a local cast to a ptr of a different type (optimized) |
1872 ; (e.g., int a; ... ; float *b = &a;) | 1872 ; (e.g., int a; ... ; float *b = &a;) |
2002 | 2002 |
2003 ; DARWIN-X64-LABEL: test17a: | 2003 ; DARWIN-X64-LABEL: test17a: |
2004 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 2004 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
2005 ; DARWIN-X64: .cfi_endproc | 2005 ; DARWIN-X64: .cfi_endproc |
2006 %c = alloca %struct.vec, align 16 | 2006 %c = alloca %struct.vec, align 16 |
2007 %y = getelementptr inbounds %struct.vec* %c, i64 0, i32 0 | 2007 %y = getelementptr inbounds %struct.vec, %struct.vec* %c, i64 0, i32 0 |
2008 %add.ptr = getelementptr inbounds <4 x i32>* %y, i64 -12 | 2008 %add.ptr = getelementptr inbounds <4 x i32>, <4 x i32>* %y, i64 -12 |
2009 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), <4 x i32>* %add.ptr) | 2009 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), <4 x i32>* %add.ptr) |
2010 ret void | 2010 ret void |
2011 } | 2011 } |
2012 | 2012 |
2013 ; test17b: Addr-of a vector nested in a struct | 2013 ; test17b: Addr-of a vector nested in a struct |
2014 ; ssp attribute | 2014 ; ssp attribute |
2030 | 2030 |
2031 ; DARWIN-X64-LABEL: test17b: | 2031 ; DARWIN-X64-LABEL: test17b: |
2032 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 2032 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
2033 ; DARWIN-X64: .cfi_endproc | 2033 ; DARWIN-X64: .cfi_endproc |
2034 %c = alloca %struct.vec, align 16 | 2034 %c = alloca %struct.vec, align 16 |
2035 %y = getelementptr inbounds %struct.vec* %c, i64 0, i32 0 | 2035 %y = getelementptr inbounds %struct.vec, %struct.vec* %c, i64 0, i32 0 |
2036 %add.ptr = getelementptr inbounds <4 x i32>* %y, i64 -12 | 2036 %add.ptr = getelementptr inbounds <4 x i32>, <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) | 2037 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), <4 x i32>* %add.ptr) |
2038 ret void | 2038 ret void |
2039 } | 2039 } |
2040 | 2040 |
2041 ; test17c: Addr-of a vector nested in a struct | 2041 ; test17c: Addr-of a vector nested in a struct |
2042 ; sspstrong attribute | 2042 ; sspstrong attribute |
2058 | 2058 |
2059 ; DARWIN-X64-LABEL: test17c: | 2059 ; DARWIN-X64-LABEL: test17c: |
2060 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 2060 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
2061 ; DARWIN-X64: callq ___stack_chk_fail | 2061 ; DARWIN-X64: callq ___stack_chk_fail |
2062 %c = alloca %struct.vec, align 16 | 2062 %c = alloca %struct.vec, align 16 |
2063 %y = getelementptr inbounds %struct.vec* %c, i64 0, i32 0 | 2063 %y = getelementptr inbounds %struct.vec, %struct.vec* %c, i64 0, i32 0 |
2064 %add.ptr = getelementptr inbounds <4 x i32>* %y, i64 -12 | 2064 %add.ptr = getelementptr inbounds <4 x i32>, <4 x i32>* %y, i64 -12 |
2065 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), <4 x i32>* %add.ptr) | 2065 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), <4 x i32>* %add.ptr) |
2066 ret void | 2066 ret void |
2067 } | 2067 } |
2068 | 2068 |
2069 ; test17d: Addr-of a vector nested in a struct | 2069 ; test17d: Addr-of a vector nested in a struct |
2070 ; sspreq attribute | 2070 ; sspreq attribute |
2086 | 2086 |
2087 ; DARWIN-X64-LABEL: test17d: | 2087 ; DARWIN-X64-LABEL: test17d: |
2088 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 2088 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
2089 ; DARWIN-X64: callq ___stack_chk_fail | 2089 ; DARWIN-X64: callq ___stack_chk_fail |
2090 %c = alloca %struct.vec, align 16 | 2090 %c = alloca %struct.vec, align 16 |
2091 %y = getelementptr inbounds %struct.vec* %c, i64 0, i32 0 | 2091 %y = getelementptr inbounds %struct.vec, %struct.vec* %c, i64 0, i32 0 |
2092 %add.ptr = getelementptr inbounds <4 x i32>* %y, i64 -12 | 2092 %add.ptr = getelementptr inbounds <4 x i32>, <4 x i32>* %y, i64 -12 |
2093 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), <4 x i32>* %add.ptr) | 2093 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), <4 x i32>* %add.ptr) |
2094 ret void | 2094 ret void |
2095 } | 2095 } |
2096 | 2096 |
2097 ; test18a: Addr-of a variable passed into an invoke instruction. | 2097 ; test18a: Addr-of a variable passed into an invoke instruction. |
2098 ; no ssp attribute | 2098 ; no ssp attribute |
2099 ; Requires no protector. | 2099 ; Requires no protector. |
2100 define i32 @test18a() { | 2100 define i32 @test18a() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { |
2101 entry: | 2101 entry: |
2102 ; LINUX-I386-LABEL: test18a: | 2102 ; LINUX-I386-LABEL: test18a: |
2103 ; LINUX-I386-NOT: calll __stack_chk_fail | 2103 ; LINUX-I386-NOT: calll __stack_chk_fail |
2104 ; LINUX-I386: .cfi_endproc | 2104 ; LINUX-I386: .cfi_endproc |
2105 | 2105 |
2123 | 2123 |
2124 invoke.cont: | 2124 invoke.cont: |
2125 ret i32 0 | 2125 ret i32 0 |
2126 | 2126 |
2127 lpad: | 2127 lpad: |
2128 %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) | 2128 %0 = landingpad { i8*, i32 } |
2129 catch i8* null | 2129 catch i8* null |
2130 ret i32 0 | 2130 ret i32 0 |
2131 } | 2131 } |
2132 | 2132 |
2133 ; test18b: Addr-of a variable passed into an invoke instruction. | 2133 ; test18b: Addr-of a variable passed into an invoke instruction. |
2134 ; ssp attribute | 2134 ; ssp attribute |
2135 ; Requires no protector. | 2135 ; Requires no protector. |
2136 ; Function Attrs: ssp | 2136 ; Function Attrs: ssp |
2137 define i32 @test18b() #0 { | 2137 define i32 @test18b() #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { |
2138 entry: | 2138 entry: |
2139 ; LINUX-I386-LABEL: test18b: | 2139 ; LINUX-I386-LABEL: test18b: |
2140 ; LINUX-I386-NOT: calll __stack_chk_fail | 2140 ; LINUX-I386-NOT: calll __stack_chk_fail |
2141 ; LINUX-I386: .cfi_endproc | 2141 ; LINUX-I386: .cfi_endproc |
2142 | 2142 |
2160 | 2160 |
2161 invoke.cont: | 2161 invoke.cont: |
2162 ret i32 0 | 2162 ret i32 0 |
2163 | 2163 |
2164 lpad: | 2164 lpad: |
2165 %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) | 2165 %0 = landingpad { i8*, i32 } |
2166 catch i8* null | 2166 catch i8* null |
2167 ret i32 0 | 2167 ret i32 0 |
2168 } | 2168 } |
2169 | 2169 |
2170 ; test18c: Addr-of a variable passed into an invoke instruction. | 2170 ; test18c: Addr-of a variable passed into an invoke instruction. |
2171 ; sspstrong attribute | 2171 ; sspstrong attribute |
2172 ; Requires protector. | 2172 ; Requires protector. |
2173 ; Function Attrs: sspstrong | 2173 ; Function Attrs: sspstrong |
2174 define i32 @test18c() #1 { | 2174 define i32 @test18c() #1 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { |
2175 entry: | 2175 entry: |
2176 ; LINUX-I386-LABEL: test18c: | 2176 ; LINUX-I386-LABEL: test18c: |
2177 ; LINUX-I386: mov{{l|q}} %gs: | 2177 ; LINUX-I386: mov{{l|q}} %gs: |
2178 ; LINUX-I386: calll __stack_chk_fail | 2178 ; LINUX-I386: calll __stack_chk_fail |
2179 | 2179 |
2197 | 2197 |
2198 invoke.cont: | 2198 invoke.cont: |
2199 ret i32 0 | 2199 ret i32 0 |
2200 | 2200 |
2201 lpad: | 2201 lpad: |
2202 %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) | 2202 %0 = landingpad { i8*, i32 } |
2203 catch i8* null | 2203 catch i8* null |
2204 ret i32 0 | 2204 ret i32 0 |
2205 } | 2205 } |
2206 | 2206 |
2207 ; test18d: Addr-of a variable passed into an invoke instruction. | 2207 ; test18d: Addr-of a variable passed into an invoke instruction. |
2208 ; sspreq attribute | 2208 ; sspreq attribute |
2209 ; Requires protector. | 2209 ; Requires protector. |
2210 ; Function Attrs: sspreq | 2210 ; Function Attrs: sspreq |
2211 define i32 @test18d() #2 { | 2211 define i32 @test18d() #2 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { |
2212 entry: | 2212 entry: |
2213 ; LINUX-I386-LABEL: test18d: | 2213 ; LINUX-I386-LABEL: test18d: |
2214 ; LINUX-I386: mov{{l|q}} %gs: | 2214 ; LINUX-I386: mov{{l|q}} %gs: |
2215 ; LINUX-I386: calll __stack_chk_fail | 2215 ; LINUX-I386: calll __stack_chk_fail |
2216 | 2216 |
2234 | 2234 |
2235 invoke.cont: | 2235 invoke.cont: |
2236 ret i32 0 | 2236 ret i32 0 |
2237 | 2237 |
2238 lpad: | 2238 lpad: |
2239 %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) | 2239 %0 = landingpad { i8*, i32 } |
2240 catch i8* null | 2240 catch i8* null |
2241 ret i32 0 | 2241 ret i32 0 |
2242 } | 2242 } |
2243 ; test19a: Addr-of a struct element passed into an invoke instruction. | 2243 ; test19a: Addr-of a struct element passed into an invoke instruction. |
2244 ; (GEP followed by an invoke) | 2244 ; (GEP followed by an invoke) |
2245 ; no ssp attribute | 2245 ; no ssp attribute |
2246 ; Requires no protector. | 2246 ; Requires no protector. |
2247 define i32 @test19a() { | 2247 define i32 @test19a() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { |
2248 entry: | 2248 entry: |
2249 ; LINUX-I386-LABEL: test19a: | 2249 ; LINUX-I386-LABEL: test19a: |
2250 ; LINUX-I386-NOT: calll __stack_chk_fail | 2250 ; LINUX-I386-NOT: calll __stack_chk_fail |
2251 ; LINUX-I386: .cfi_endproc | 2251 ; LINUX-I386: .cfi_endproc |
2252 | 2252 |
2262 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 2262 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
2263 ; DARWIN-X64: .cfi_endproc | 2263 ; DARWIN-X64: .cfi_endproc |
2264 %c = alloca %struct.pair, align 4 | 2264 %c = alloca %struct.pair, align 4 |
2265 %exn.slot = alloca i8* | 2265 %exn.slot = alloca i8* |
2266 %ehselector.slot = alloca i32 | 2266 %ehselector.slot = alloca i32 |
2267 %a = getelementptr inbounds %struct.pair* %c, i32 0, i32 0 | 2267 %a = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 0 |
2268 store i32 0, i32* %a, align 4 | 2268 store i32 0, i32* %a, align 4 |
2269 %a1 = getelementptr inbounds %struct.pair* %c, i32 0, i32 0 | 2269 %a1 = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 0 |
2270 invoke void @_Z3exceptPi(i32* %a1) | 2270 invoke void @_Z3exceptPi(i32* %a1) |
2271 to label %invoke.cont unwind label %lpad | 2271 to label %invoke.cont unwind label %lpad |
2272 | 2272 |
2273 invoke.cont: | 2273 invoke.cont: |
2274 ret i32 0 | 2274 ret i32 0 |
2275 | 2275 |
2276 lpad: | 2276 lpad: |
2277 %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) | 2277 %0 = landingpad { i8*, i32 } |
2278 catch i8* null | 2278 catch i8* null |
2279 ret i32 0 | 2279 ret i32 0 |
2280 } | 2280 } |
2281 | 2281 |
2282 ; test19b: Addr-of a struct element passed into an invoke instruction. | 2282 ; test19b: Addr-of a struct element passed into an invoke instruction. |
2283 ; (GEP followed by an invoke) | 2283 ; (GEP followed by an invoke) |
2284 ; ssp attribute | 2284 ; ssp attribute |
2285 ; Requires no protector. | 2285 ; Requires no protector. |
2286 ; Function Attrs: ssp | 2286 ; Function Attrs: ssp |
2287 define i32 @test19b() #0 { | 2287 define i32 @test19b() #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { |
2288 entry: | 2288 entry: |
2289 ; LINUX-I386-LABEL: test19b: | 2289 ; LINUX-I386-LABEL: test19b: |
2290 ; LINUX-I386-NOT: calll __stack_chk_fail | 2290 ; LINUX-I386-NOT: calll __stack_chk_fail |
2291 ; LINUX-I386: .cfi_endproc | 2291 ; LINUX-I386: .cfi_endproc |
2292 | 2292 |
2302 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 2302 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
2303 ; DARWIN-X64: .cfi_endproc | 2303 ; DARWIN-X64: .cfi_endproc |
2304 %c = alloca %struct.pair, align 4 | 2304 %c = alloca %struct.pair, align 4 |
2305 %exn.slot = alloca i8* | 2305 %exn.slot = alloca i8* |
2306 %ehselector.slot = alloca i32 | 2306 %ehselector.slot = alloca i32 |
2307 %a = getelementptr inbounds %struct.pair* %c, i32 0, i32 0 | 2307 %a = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 0 |
2308 store i32 0, i32* %a, align 4 | 2308 store i32 0, i32* %a, align 4 |
2309 %a1 = getelementptr inbounds %struct.pair* %c, i32 0, i32 0 | 2309 %a1 = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 0 |
2310 invoke void @_Z3exceptPi(i32* %a1) | 2310 invoke void @_Z3exceptPi(i32* %a1) |
2311 to label %invoke.cont unwind label %lpad | 2311 to label %invoke.cont unwind label %lpad |
2312 | 2312 |
2313 invoke.cont: | 2313 invoke.cont: |
2314 ret i32 0 | 2314 ret i32 0 |
2315 | 2315 |
2316 lpad: | 2316 lpad: |
2317 %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) | 2317 %0 = landingpad { i8*, i32 } |
2318 catch i8* null | 2318 catch i8* null |
2319 ret i32 0 | 2319 ret i32 0 |
2320 } | 2320 } |
2321 | 2321 |
2322 ; test19c: Addr-of a struct element passed into an invoke instruction. | 2322 ; test19c: Addr-of a struct element passed into an invoke instruction. |
2323 ; (GEP followed by an invoke) | 2323 ; (GEP followed by an invoke) |
2324 ; sspstrong attribute | 2324 ; sspstrong attribute |
2325 ; Requires protector. | 2325 ; Requires protector. |
2326 ; Function Attrs: sspstrong | 2326 ; Function Attrs: sspstrong |
2327 define i32 @test19c() #1 { | 2327 define i32 @test19c() #1 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { |
2328 entry: | 2328 entry: |
2329 ; LINUX-I386-LABEL: test19c: | 2329 ; LINUX-I386-LABEL: test19c: |
2330 ; LINUX-I386: mov{{l|q}} %gs: | 2330 ; LINUX-I386: mov{{l|q}} %gs: |
2331 ; LINUX-I386: calll __stack_chk_fail | 2331 ; LINUX-I386: calll __stack_chk_fail |
2332 | 2332 |
2342 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 2342 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
2343 ; DARWIN-X64: callq ___stack_chk_fail | 2343 ; DARWIN-X64: callq ___stack_chk_fail |
2344 %c = alloca %struct.pair, align 4 | 2344 %c = alloca %struct.pair, align 4 |
2345 %exn.slot = alloca i8* | 2345 %exn.slot = alloca i8* |
2346 %ehselector.slot = alloca i32 | 2346 %ehselector.slot = alloca i32 |
2347 %a = getelementptr inbounds %struct.pair* %c, i32 0, i32 0 | 2347 %a = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 0 |
2348 store i32 0, i32* %a, align 4 | 2348 store i32 0, i32* %a, align 4 |
2349 %a1 = getelementptr inbounds %struct.pair* %c, i32 0, i32 0 | 2349 %a1 = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 0 |
2350 invoke void @_Z3exceptPi(i32* %a1) | 2350 invoke void @_Z3exceptPi(i32* %a1) |
2351 to label %invoke.cont unwind label %lpad | 2351 to label %invoke.cont unwind label %lpad |
2352 | 2352 |
2353 invoke.cont: | 2353 invoke.cont: |
2354 ret i32 0 | 2354 ret i32 0 |
2355 | 2355 |
2356 lpad: | 2356 lpad: |
2357 %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) | 2357 %0 = landingpad { i8*, i32 } |
2358 catch i8* null | 2358 catch i8* null |
2359 ret i32 0 | 2359 ret i32 0 |
2360 } | 2360 } |
2361 | 2361 |
2362 ; test19d: Addr-of a struct element passed into an invoke instruction. | 2362 ; test19d: Addr-of a struct element passed into an invoke instruction. |
2363 ; (GEP followed by an invoke) | 2363 ; (GEP followed by an invoke) |
2364 ; sspreq attribute | 2364 ; sspreq attribute |
2365 ; Requires protector. | 2365 ; Requires protector. |
2366 ; Function Attrs: sspreq | 2366 ; Function Attrs: sspreq |
2367 define i32 @test19d() #2 { | 2367 define i32 @test19d() #2 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { |
2368 entry: | 2368 entry: |
2369 ; LINUX-I386-LABEL: test19d: | 2369 ; LINUX-I386-LABEL: test19d: |
2370 ; LINUX-I386: mov{{l|q}} %gs: | 2370 ; LINUX-I386: mov{{l|q}} %gs: |
2371 ; LINUX-I386: calll __stack_chk_fail | 2371 ; LINUX-I386: calll __stack_chk_fail |
2372 ; LINUX-I386-NOT: calll __stack_chk_fail | 2372 ; LINUX-I386-NOT: calll __stack_chk_fail |
2386 ; DARWIN-X64: callq ___stack_chk_fail | 2386 ; DARWIN-X64: callq ___stack_chk_fail |
2387 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 2387 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
2388 %c = alloca %struct.pair, align 4 | 2388 %c = alloca %struct.pair, align 4 |
2389 %exn.slot = alloca i8* | 2389 %exn.slot = alloca i8* |
2390 %ehselector.slot = alloca i32 | 2390 %ehselector.slot = alloca i32 |
2391 %a = getelementptr inbounds %struct.pair* %c, i32 0, i32 0 | 2391 %a = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 0 |
2392 store i32 0, i32* %a, align 4 | 2392 store i32 0, i32* %a, align 4 |
2393 %a1 = getelementptr inbounds %struct.pair* %c, i32 0, i32 0 | 2393 %a1 = getelementptr inbounds %struct.pair, %struct.pair* %c, i32 0, i32 0 |
2394 invoke void @_Z3exceptPi(i32* %a1) | 2394 invoke void @_Z3exceptPi(i32* %a1) |
2395 to label %invoke.cont unwind label %lpad | 2395 to label %invoke.cont unwind label %lpad |
2396 | 2396 |
2397 invoke.cont: | 2397 invoke.cont: |
2398 ret i32 0 | 2398 ret i32 0 |
2399 | 2399 |
2400 lpad: | 2400 lpad: |
2401 %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) | 2401 %0 = landingpad { i8*, i32 } |
2402 catch i8* null | 2402 catch i8* null |
2403 ret i32 0 | 2403 ret i32 0 |
2404 } | 2404 } |
2405 | 2405 |
2406 ; test20a: Addr-of a pointer | 2406 ; test20a: Addr-of a pointer |
2426 %a = alloca i32*, align 8 | 2426 %a = alloca i32*, align 8 |
2427 %b = alloca i32**, align 8 | 2427 %b = alloca i32**, align 8 |
2428 %call = call i32* @getp() | 2428 %call = call i32* @getp() |
2429 store i32* %call, i32** %a, align 8 | 2429 store i32* %call, i32** %a, align 8 |
2430 store i32** %a, i32*** %b, align 8 | 2430 store i32** %a, i32*** %b, align 8 |
2431 %0 = load i32*** %b, align 8 | 2431 %0 = load i32**, i32*** %b, align 8 |
2432 call void @funcall2(i32** %0) | 2432 call void @funcall2(i32** %0) |
2433 ret void | 2433 ret void |
2434 } | 2434 } |
2435 | 2435 |
2436 ; test20b: Addr-of a pointer | 2436 ; test20b: Addr-of a pointer |
2457 %a = alloca i32*, align 8 | 2457 %a = alloca i32*, align 8 |
2458 %b = alloca i32**, align 8 | 2458 %b = alloca i32**, align 8 |
2459 %call = call i32* @getp() | 2459 %call = call i32* @getp() |
2460 store i32* %call, i32** %a, align 8 | 2460 store i32* %call, i32** %a, align 8 |
2461 store i32** %a, i32*** %b, align 8 | 2461 store i32** %a, i32*** %b, align 8 |
2462 %0 = load i32*** %b, align 8 | 2462 %0 = load i32**, i32*** %b, align 8 |
2463 call void @funcall2(i32** %0) | 2463 call void @funcall2(i32** %0) |
2464 ret void | 2464 ret void |
2465 } | 2465 } |
2466 | 2466 |
2467 ; test20c: Addr-of a pointer | 2467 ; test20c: Addr-of a pointer |
2488 %a = alloca i32*, align 8 | 2488 %a = alloca i32*, align 8 |
2489 %b = alloca i32**, align 8 | 2489 %b = alloca i32**, align 8 |
2490 %call = call i32* @getp() | 2490 %call = call i32* @getp() |
2491 store i32* %call, i32** %a, align 8 | 2491 store i32* %call, i32** %a, align 8 |
2492 store i32** %a, i32*** %b, align 8 | 2492 store i32** %a, i32*** %b, align 8 |
2493 %0 = load i32*** %b, align 8 | 2493 %0 = load i32**, i32*** %b, align 8 |
2494 call void @funcall2(i32** %0) | 2494 call void @funcall2(i32** %0) |
2495 ret void | 2495 ret void |
2496 } | 2496 } |
2497 | 2497 |
2498 ; test20d: Addr-of a pointer | 2498 ; test20d: Addr-of a pointer |
2519 %a = alloca i32*, align 8 | 2519 %a = alloca i32*, align 8 |
2520 %b = alloca i32**, align 8 | 2520 %b = alloca i32**, align 8 |
2521 %call = call i32* @getp() | 2521 %call = call i32* @getp() |
2522 store i32* %call, i32** %a, align 8 | 2522 store i32* %call, i32** %a, align 8 |
2523 store i32** %a, i32*** %b, align 8 | 2523 store i32** %a, i32*** %b, align 8 |
2524 %0 = load i32*** %b, align 8 | 2524 %0 = load i32**, i32*** %b, align 8 |
2525 call void @funcall2(i32** %0) | 2525 call void @funcall2(i32** %0) |
2526 ret void | 2526 ret void |
2527 } | 2527 } |
2528 | 2528 |
2529 ; test21a: Addr-of a casted pointer | 2529 ; test21a: Addr-of a casted pointer |
2550 %b = alloca float**, align 8 | 2550 %b = alloca float**, align 8 |
2551 %call = call i32* @getp() | 2551 %call = call i32* @getp() |
2552 store i32* %call, i32** %a, align 8 | 2552 store i32* %call, i32** %a, align 8 |
2553 %0 = bitcast i32** %a to float** | 2553 %0 = bitcast i32** %a to float** |
2554 store float** %0, float*** %b, align 8 | 2554 store float** %0, float*** %b, align 8 |
2555 %1 = load float*** %b, align 8 | 2555 %1 = load float**, float*** %b, align 8 |
2556 call void @funfloat2(float** %1) | 2556 call void @funfloat2(float** %1) |
2557 ret void | 2557 ret void |
2558 } | 2558 } |
2559 | 2559 |
2560 ; test21b: Addr-of a casted pointer | 2560 ; test21b: Addr-of a casted pointer |
2582 %b = alloca float**, align 8 | 2582 %b = alloca float**, align 8 |
2583 %call = call i32* @getp() | 2583 %call = call i32* @getp() |
2584 store i32* %call, i32** %a, align 8 | 2584 store i32* %call, i32** %a, align 8 |
2585 %0 = bitcast i32** %a to float** | 2585 %0 = bitcast i32** %a to float** |
2586 store float** %0, float*** %b, align 8 | 2586 store float** %0, float*** %b, align 8 |
2587 %1 = load float*** %b, align 8 | 2587 %1 = load float**, float*** %b, align 8 |
2588 call void @funfloat2(float** %1) | 2588 call void @funfloat2(float** %1) |
2589 ret void | 2589 ret void |
2590 } | 2590 } |
2591 | 2591 |
2592 ; test21c: Addr-of a casted pointer | 2592 ; test21c: Addr-of a casted pointer |
2614 %b = alloca float**, align 8 | 2614 %b = alloca float**, align 8 |
2615 %call = call i32* @getp() | 2615 %call = call i32* @getp() |
2616 store i32* %call, i32** %a, align 8 | 2616 store i32* %call, i32** %a, align 8 |
2617 %0 = bitcast i32** %a to float** | 2617 %0 = bitcast i32** %a to float** |
2618 store float** %0, float*** %b, align 8 | 2618 store float** %0, float*** %b, align 8 |
2619 %1 = load float*** %b, align 8 | 2619 %1 = load float**, float*** %b, align 8 |
2620 call void @funfloat2(float** %1) | 2620 call void @funfloat2(float** %1) |
2621 ret void | 2621 ret void |
2622 } | 2622 } |
2623 | 2623 |
2624 ; test21d: Addr-of a casted pointer | 2624 ; test21d: Addr-of a casted pointer |
2646 %b = alloca float**, align 8 | 2646 %b = alloca float**, align 8 |
2647 %call = call i32* @getp() | 2647 %call = call i32* @getp() |
2648 store i32* %call, i32** %a, align 8 | 2648 store i32* %call, i32** %a, align 8 |
2649 %0 = bitcast i32** %a to float** | 2649 %0 = bitcast i32** %a to float** |
2650 store float** %0, float*** %b, align 8 | 2650 store float** %0, float*** %b, align 8 |
2651 %1 = load float*** %b, align 8 | 2651 %1 = load float**, float*** %b, align 8 |
2652 call void @funfloat2(float** %1) | 2652 call void @funfloat2(float** %1) |
2653 ret void | 2653 ret void |
2654 } | 2654 } |
2655 | 2655 |
2656 ; test22a: [2 x i8] in a class | 2656 ; test22a: [2 x i8] in a class |
2672 | 2672 |
2673 ; DARWIN-X64-LABEL: test22a: | 2673 ; DARWIN-X64-LABEL: test22a: |
2674 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 2674 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
2675 ; DARWIN-X64: .cfi_endproc | 2675 ; DARWIN-X64: .cfi_endproc |
2676 %a = alloca %class.A, align 1 | 2676 %a = alloca %class.A, align 1 |
2677 %array = getelementptr inbounds %class.A* %a, i32 0, i32 0 | 2677 %array = getelementptr inbounds %class.A, %class.A* %a, i32 0, i32 0 |
2678 %arrayidx = getelementptr inbounds [2 x i8]* %array, i32 0, i64 0 | 2678 %arrayidx = getelementptr inbounds [2 x i8], [2 x i8]* %array, i32 0, i64 0 |
2679 %0 = load i8* %arrayidx, align 1 | 2679 %0 = load i8, i8* %arrayidx, align 1 |
2680 ret i8 %0 | 2680 ret i8 %0 |
2681 } | 2681 } |
2682 | 2682 |
2683 ; test22b: [2 x i8] in a class | 2683 ; test22b: [2 x i8] in a class |
2684 ; ssp attribute | 2684 ; ssp attribute |
2700 | 2700 |
2701 ; DARWIN-X64-LABEL: test22b: | 2701 ; DARWIN-X64-LABEL: test22b: |
2702 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 2702 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
2703 ; DARWIN-X64: .cfi_endproc | 2703 ; DARWIN-X64: .cfi_endproc |
2704 %a = alloca %class.A, align 1 | 2704 %a = alloca %class.A, align 1 |
2705 %array = getelementptr inbounds %class.A* %a, i32 0, i32 0 | 2705 %array = getelementptr inbounds %class.A, %class.A* %a, i32 0, i32 0 |
2706 %arrayidx = getelementptr inbounds [2 x i8]* %array, i32 0, i64 0 | 2706 %arrayidx = getelementptr inbounds [2 x i8], [2 x i8]* %array, i32 0, i64 0 |
2707 %0 = load i8* %arrayidx, align 1 | 2707 %0 = load i8, i8* %arrayidx, align 1 |
2708 ret i8 %0 | 2708 ret i8 %0 |
2709 } | 2709 } |
2710 | 2710 |
2711 ; test22c: [2 x i8] in a class | 2711 ; test22c: [2 x i8] in a class |
2712 ; sspstrong attribute | 2712 ; sspstrong attribute |
2728 | 2728 |
2729 ; DARWIN-X64-LABEL: test22c: | 2729 ; DARWIN-X64-LABEL: test22c: |
2730 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 2730 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
2731 ; DARWIN-X64: callq ___stack_chk_fail | 2731 ; DARWIN-X64: callq ___stack_chk_fail |
2732 %a = alloca %class.A, align 1 | 2732 %a = alloca %class.A, align 1 |
2733 %array = getelementptr inbounds %class.A* %a, i32 0, i32 0 | 2733 %array = getelementptr inbounds %class.A, %class.A* %a, i32 0, i32 0 |
2734 %arrayidx = getelementptr inbounds [2 x i8]* %array, i32 0, i64 0 | 2734 %arrayidx = getelementptr inbounds [2 x i8], [2 x i8]* %array, i32 0, i64 0 |
2735 %0 = load i8* %arrayidx, align 1 | 2735 %0 = load i8, i8* %arrayidx, align 1 |
2736 ret i8 %0 | 2736 ret i8 %0 |
2737 } | 2737 } |
2738 | 2738 |
2739 ; test22d: [2 x i8] in a class | 2739 ; test22d: [2 x i8] in a class |
2740 ; sspreq attribute | 2740 ; sspreq attribute |
2756 | 2756 |
2757 ; DARWIN-X64-LABEL: test22d: | 2757 ; DARWIN-X64-LABEL: test22d: |
2758 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 2758 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
2759 ; DARWIN-X64: callq ___stack_chk_fail | 2759 ; DARWIN-X64: callq ___stack_chk_fail |
2760 %a = alloca %class.A, align 1 | 2760 %a = alloca %class.A, align 1 |
2761 %array = getelementptr inbounds %class.A* %a, i32 0, i32 0 | 2761 %array = getelementptr inbounds %class.A, %class.A* %a, i32 0, i32 0 |
2762 %arrayidx = getelementptr inbounds [2 x i8]* %array, i32 0, i64 0 | 2762 %arrayidx = getelementptr inbounds [2 x i8], [2 x i8]* %array, i32 0, i64 0 |
2763 %0 = load i8* %arrayidx, align 1 | 2763 %0 = load i8, i8* %arrayidx, align 1 |
2764 ret i8 %0 | 2764 ret i8 %0 |
2765 } | 2765 } |
2766 | 2766 |
2767 ; test23a: [2 x i8] nested in several layers of structs and unions | 2767 ; test23a: [2 x i8] nested in several layers of structs and unions |
2768 ; no ssp attribute | 2768 ; no ssp attribute |
2783 | 2783 |
2784 ; DARWIN-X64-LABEL: test23a: | 2784 ; DARWIN-X64-LABEL: test23a: |
2785 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 2785 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
2786 ; DARWIN-X64: .cfi_endproc | 2786 ; DARWIN-X64: .cfi_endproc |
2787 %x = alloca %struct.deep, align 1 | 2787 %x = alloca %struct.deep, align 1 |
2788 %b = getelementptr inbounds %struct.deep* %x, i32 0, i32 0 | 2788 %b = getelementptr inbounds %struct.deep, %struct.deep* %x, i32 0, i32 0 |
2789 %c = bitcast %union.anon* %b to %struct.anon* | 2789 %c = bitcast %union.anon* %b to %struct.anon* |
2790 %d = getelementptr inbounds %struct.anon* %c, i32 0, i32 0 | 2790 %d = getelementptr inbounds %struct.anon, %struct.anon* %c, i32 0, i32 0 |
2791 %e = getelementptr inbounds %struct.anon.0* %d, i32 0, i32 0 | 2791 %e = getelementptr inbounds %struct.anon.0, %struct.anon.0* %d, i32 0, i32 0 |
2792 %array = bitcast %union.anon.1* %e to [2 x i8]* | 2792 %array = bitcast %union.anon.1* %e to [2 x i8]* |
2793 %arrayidx = getelementptr inbounds [2 x i8]* %array, i32 0, i64 0 | 2793 %arrayidx = getelementptr inbounds [2 x i8], [2 x i8]* %array, i32 0, i64 0 |
2794 %0 = load i8* %arrayidx, align 1 | 2794 %0 = load i8, i8* %arrayidx, align 1 |
2795 ret i8 %0 | 2795 ret i8 %0 |
2796 } | 2796 } |
2797 | 2797 |
2798 ; test23b: [2 x i8] nested in several layers of structs and unions | 2798 ; test23b: [2 x i8] nested in several layers of structs and unions |
2799 ; ssp attribute | 2799 ; ssp attribute |
2815 | 2815 |
2816 ; DARWIN-X64-LABEL: test23b: | 2816 ; DARWIN-X64-LABEL: test23b: |
2817 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 2817 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
2818 ; DARWIN-X64: .cfi_endproc | 2818 ; DARWIN-X64: .cfi_endproc |
2819 %x = alloca %struct.deep, align 1 | 2819 %x = alloca %struct.deep, align 1 |
2820 %b = getelementptr inbounds %struct.deep* %x, i32 0, i32 0 | 2820 %b = getelementptr inbounds %struct.deep, %struct.deep* %x, i32 0, i32 0 |
2821 %c = bitcast %union.anon* %b to %struct.anon* | 2821 %c = bitcast %union.anon* %b to %struct.anon* |
2822 %d = getelementptr inbounds %struct.anon* %c, i32 0, i32 0 | 2822 %d = getelementptr inbounds %struct.anon, %struct.anon* %c, i32 0, i32 0 |
2823 %e = getelementptr inbounds %struct.anon.0* %d, i32 0, i32 0 | 2823 %e = getelementptr inbounds %struct.anon.0, %struct.anon.0* %d, i32 0, i32 0 |
2824 %array = bitcast %union.anon.1* %e to [2 x i8]* | 2824 %array = bitcast %union.anon.1* %e to [2 x i8]* |
2825 %arrayidx = getelementptr inbounds [2 x i8]* %array, i32 0, i64 0 | 2825 %arrayidx = getelementptr inbounds [2 x i8], [2 x i8]* %array, i32 0, i64 0 |
2826 %0 = load i8* %arrayidx, align 1 | 2826 %0 = load i8, i8* %arrayidx, align 1 |
2827 ret i8 %0 | 2827 ret i8 %0 |
2828 } | 2828 } |
2829 | 2829 |
2830 ; test23c: [2 x i8] nested in several layers of structs and unions | 2830 ; test23c: [2 x i8] nested in several layers of structs and unions |
2831 ; sspstrong attribute | 2831 ; sspstrong attribute |
2847 | 2847 |
2848 ; DARWIN-X64-LABEL: test23c: | 2848 ; DARWIN-X64-LABEL: test23c: |
2849 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 2849 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
2850 ; DARWIN-X64: callq ___stack_chk_fail | 2850 ; DARWIN-X64: callq ___stack_chk_fail |
2851 %x = alloca %struct.deep, align 1 | 2851 %x = alloca %struct.deep, align 1 |
2852 %b = getelementptr inbounds %struct.deep* %x, i32 0, i32 0 | 2852 %b = getelementptr inbounds %struct.deep, %struct.deep* %x, i32 0, i32 0 |
2853 %c = bitcast %union.anon* %b to %struct.anon* | 2853 %c = bitcast %union.anon* %b to %struct.anon* |
2854 %d = getelementptr inbounds %struct.anon* %c, i32 0, i32 0 | 2854 %d = getelementptr inbounds %struct.anon, %struct.anon* %c, i32 0, i32 0 |
2855 %e = getelementptr inbounds %struct.anon.0* %d, i32 0, i32 0 | 2855 %e = getelementptr inbounds %struct.anon.0, %struct.anon.0* %d, i32 0, i32 0 |
2856 %array = bitcast %union.anon.1* %e to [2 x i8]* | 2856 %array = bitcast %union.anon.1* %e to [2 x i8]* |
2857 %arrayidx = getelementptr inbounds [2 x i8]* %array, i32 0, i64 0 | 2857 %arrayidx = getelementptr inbounds [2 x i8], [2 x i8]* %array, i32 0, i64 0 |
2858 %0 = load i8* %arrayidx, align 1 | 2858 %0 = load i8, i8* %arrayidx, align 1 |
2859 ret i8 %0 | 2859 ret i8 %0 |
2860 } | 2860 } |
2861 | 2861 |
2862 ; test23d: [2 x i8] nested in several layers of structs and unions | 2862 ; test23d: [2 x i8] nested in several layers of structs and unions |
2863 ; sspreq attribute | 2863 ; sspreq attribute |
2879 | 2879 |
2880 ; DARWIN-X64-LABEL: test23d: | 2880 ; DARWIN-X64-LABEL: test23d: |
2881 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 2881 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
2882 ; DARWIN-X64: callq ___stack_chk_fail | 2882 ; DARWIN-X64: callq ___stack_chk_fail |
2883 %x = alloca %struct.deep, align 1 | 2883 %x = alloca %struct.deep, align 1 |
2884 %b = getelementptr inbounds %struct.deep* %x, i32 0, i32 0 | 2884 %b = getelementptr inbounds %struct.deep, %struct.deep* %x, i32 0, i32 0 |
2885 %c = bitcast %union.anon* %b to %struct.anon* | 2885 %c = bitcast %union.anon* %b to %struct.anon* |
2886 %d = getelementptr inbounds %struct.anon* %c, i32 0, i32 0 | 2886 %d = getelementptr inbounds %struct.anon, %struct.anon* %c, i32 0, i32 0 |
2887 %e = getelementptr inbounds %struct.anon.0* %d, i32 0, i32 0 | 2887 %e = getelementptr inbounds %struct.anon.0, %struct.anon.0* %d, i32 0, i32 0 |
2888 %array = bitcast %union.anon.1* %e to [2 x i8]* | 2888 %array = bitcast %union.anon.1* %e to [2 x i8]* |
2889 %arrayidx = getelementptr inbounds [2 x i8]* %array, i32 0, i64 0 | 2889 %arrayidx = getelementptr inbounds [2 x i8], [2 x i8]* %array, i32 0, i64 0 |
2890 %0 = load i8* %arrayidx, align 1 | 2890 %0 = load i8, i8* %arrayidx, align 1 |
2891 ret i8 %0 | 2891 ret i8 %0 |
2892 } | 2892 } |
2893 | 2893 |
2894 ; test24a: Variable sized alloca | 2894 ; test24a: Variable sized alloca |
2895 ; no ssp attribute | 2895 ; no ssp attribute |
2912 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 2912 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
2913 ; DARWIN-X64: .cfi_endproc | 2913 ; DARWIN-X64: .cfi_endproc |
2914 %n.addr = alloca i32, align 4 | 2914 %n.addr = alloca i32, align 4 |
2915 %a = alloca i32*, align 8 | 2915 %a = alloca i32*, align 8 |
2916 store i32 %n, i32* %n.addr, align 4 | 2916 store i32 %n, i32* %n.addr, align 4 |
2917 %0 = load i32* %n.addr, align 4 | 2917 %0 = load i32, i32* %n.addr, align 4 |
2918 %conv = sext i32 %0 to i64 | 2918 %conv = sext i32 %0 to i64 |
2919 %1 = alloca i8, i64 %conv | 2919 %1 = alloca i8, i64 %conv |
2920 %2 = bitcast i8* %1 to i32* | 2920 %2 = bitcast i8* %1 to i32* |
2921 store i32* %2, i32** %a, align 8 | 2921 store i32* %2, i32** %a, align 8 |
2922 ret void | 2922 ret void |
2944 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 2944 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
2945 ; DARWIN-X64: callq ___stack_chk_fail | 2945 ; DARWIN-X64: callq ___stack_chk_fail |
2946 %n.addr = alloca i32, align 4 | 2946 %n.addr = alloca i32, align 4 |
2947 %a = alloca i32*, align 8 | 2947 %a = alloca i32*, align 8 |
2948 store i32 %n, i32* %n.addr, align 4 | 2948 store i32 %n, i32* %n.addr, align 4 |
2949 %0 = load i32* %n.addr, align 4 | 2949 %0 = load i32, i32* %n.addr, align 4 |
2950 %conv = sext i32 %0 to i64 | 2950 %conv = sext i32 %0 to i64 |
2951 %1 = alloca i8, i64 %conv | 2951 %1 = alloca i8, i64 %conv |
2952 %2 = bitcast i8* %1 to i32* | 2952 %2 = bitcast i8* %1 to i32* |
2953 store i32* %2, i32** %a, align 8 | 2953 store i32* %2, i32** %a, align 8 |
2954 ret void | 2954 ret void |
2976 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 2976 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
2977 ; DARWIN-X64: callq ___stack_chk_fail | 2977 ; DARWIN-X64: callq ___stack_chk_fail |
2978 %n.addr = alloca i32, align 4 | 2978 %n.addr = alloca i32, align 4 |
2979 %a = alloca i32*, align 8 | 2979 %a = alloca i32*, align 8 |
2980 store i32 %n, i32* %n.addr, align 4 | 2980 store i32 %n, i32* %n.addr, align 4 |
2981 %0 = load i32* %n.addr, align 4 | 2981 %0 = load i32, i32* %n.addr, align 4 |
2982 %conv = sext i32 %0 to i64 | 2982 %conv = sext i32 %0 to i64 |
2983 %1 = alloca i8, i64 %conv | 2983 %1 = alloca i8, i64 %conv |
2984 %2 = bitcast i8* %1 to i32* | 2984 %2 = bitcast i8* %1 to i32* |
2985 store i32* %2, i32** %a, align 8 | 2985 store i32* %2, i32** %a, align 8 |
2986 ret void | 2986 ret void |
3008 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 3008 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
3009 ; DARWIN-X64: callq ___stack_chk_fail | 3009 ; DARWIN-X64: callq ___stack_chk_fail |
3010 %n.addr = alloca i32, align 4 | 3010 %n.addr = alloca i32, align 4 |
3011 %a = alloca i32*, align 8 | 3011 %a = alloca i32*, align 8 |
3012 store i32 %n, i32* %n.addr, align 4 | 3012 store i32 %n, i32* %n.addr, align 4 |
3013 %0 = load i32* %n.addr, align 4 | 3013 %0 = load i32, i32* %n.addr, align 4 |
3014 %conv = sext i32 %0 to i64 | 3014 %conv = sext i32 %0 to i64 |
3015 %1 = alloca i8, i64 %conv | 3015 %1 = alloca i8, i64 %conv |
3016 %2 = bitcast i8* %1 to i32* | 3016 %2 = bitcast i8* %1 to i32* |
3017 store i32* %2, i32** %a, align 8 | 3017 store i32* %2, i32** %a, align 8 |
3018 ret void | 3018 ret void |
3037 | 3037 |
3038 ; DARWIN-X64-LABEL: test25a: | 3038 ; DARWIN-X64-LABEL: test25a: |
3039 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 3039 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
3040 ; DARWIN-X64: .cfi_endproc | 3040 ; DARWIN-X64: .cfi_endproc |
3041 %a = alloca [4 x i32], align 16 | 3041 %a = alloca [4 x i32], align 16 |
3042 %arrayidx = getelementptr inbounds [4 x i32]* %a, i32 0, i64 0 | 3042 %arrayidx = getelementptr inbounds [4 x i32], [4 x i32]* %a, i32 0, i64 0 |
3043 %0 = load i32* %arrayidx, align 4 | 3043 %0 = load i32, i32* %arrayidx, align 4 |
3044 ret i32 %0 | 3044 ret i32 %0 |
3045 } | 3045 } |
3046 | 3046 |
3047 ; test25b: array of [4 x i32] | 3047 ; test25b: array of [4 x i32] |
3048 ; ssp attribute | 3048 ; ssp attribute |
3064 | 3064 |
3065 ; DARWIN-X64-LABEL: test25b: | 3065 ; DARWIN-X64-LABEL: test25b: |
3066 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 3066 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
3067 ; DARWIN-X64: callq ___stack_chk_fail | 3067 ; DARWIN-X64: callq ___stack_chk_fail |
3068 %a = alloca [4 x i32], align 16 | 3068 %a = alloca [4 x i32], align 16 |
3069 %arrayidx = getelementptr inbounds [4 x i32]* %a, i32 0, i64 0 | 3069 %arrayidx = getelementptr inbounds [4 x i32], [4 x i32]* %a, i32 0, i64 0 |
3070 %0 = load i32* %arrayidx, align 4 | 3070 %0 = load i32, i32* %arrayidx, align 4 |
3071 ret i32 %0 | 3071 ret i32 %0 |
3072 } | 3072 } |
3073 | 3073 |
3074 ; test25c: array of [4 x i32] | 3074 ; test25c: array of [4 x i32] |
3075 ; sspstrong attribute | 3075 ; sspstrong attribute |
3091 | 3091 |
3092 ; DARWIN-X64-LABEL: test25c: | 3092 ; DARWIN-X64-LABEL: test25c: |
3093 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 3093 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
3094 ; DARWIN-X64: callq ___stack_chk_fail | 3094 ; DARWIN-X64: callq ___stack_chk_fail |
3095 %a = alloca [4 x i32], align 16 | 3095 %a = alloca [4 x i32], align 16 |
3096 %arrayidx = getelementptr inbounds [4 x i32]* %a, i32 0, i64 0 | 3096 %arrayidx = getelementptr inbounds [4 x i32], [4 x i32]* %a, i32 0, i64 0 |
3097 %0 = load i32* %arrayidx, align 4 | 3097 %0 = load i32, i32* %arrayidx, align 4 |
3098 ret i32 %0 | 3098 ret i32 %0 |
3099 } | 3099 } |
3100 | 3100 |
3101 ; test25d: array of [4 x i32] | 3101 ; test25d: array of [4 x i32] |
3102 ; sspreq attribute | 3102 ; sspreq attribute |
3118 | 3118 |
3119 ; DARWIN-X64-LABEL: test25d: | 3119 ; DARWIN-X64-LABEL: test25d: |
3120 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 3120 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
3121 ; DARWIN-X64: callq ___stack_chk_fail | 3121 ; DARWIN-X64: callq ___stack_chk_fail |
3122 %a = alloca [4 x i32], align 16 | 3122 %a = alloca [4 x i32], align 16 |
3123 %arrayidx = getelementptr inbounds [4 x i32]* %a, i32 0, i64 0 | 3123 %arrayidx = getelementptr inbounds [4 x i32], [4 x i32]* %a, i32 0, i64 0 |
3124 %0 = load i32* %arrayidx, align 4 | 3124 %0 = load i32, i32* %arrayidx, align 4 |
3125 ret i32 %0 | 3125 ret i32 %0 |
3126 } | 3126 } |
3127 | 3127 |
3128 ; test26: Nested structure, no arrays, no address-of expressions. | 3128 ; test26: Nested structure, no arrays, no address-of expressions. |
3129 ; Verify that the resulting gep-of-gep does not incorrectly trigger | 3129 ; Verify that the resulting gep-of-gep does not incorrectly trigger |
3147 | 3147 |
3148 ; DARWIN-X64-LABEL: test26: | 3148 ; DARWIN-X64-LABEL: test26: |
3149 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 3149 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
3150 ; DARWIN-X64: .cfi_endproc | 3150 ; DARWIN-X64: .cfi_endproc |
3151 %c = alloca %struct.nest, align 4 | 3151 %c = alloca %struct.nest, align 4 |
3152 %b = getelementptr inbounds %struct.nest* %c, i32 0, i32 1 | 3152 %b = getelementptr inbounds %struct.nest, %struct.nest* %c, i32 0, i32 1 |
3153 %_a = getelementptr inbounds %struct.pair* %b, i32 0, i32 0 | 3153 %_a = getelementptr inbounds %struct.pair, %struct.pair* %b, i32 0, i32 0 |
3154 %0 = load i32* %_a, align 4 | 3154 %0 = load i32, i32* %_a, align 4 |
3155 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i32 %0) | 3155 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i32 %0) |
3156 ret void | 3156 ret void |
3157 } | 3157 } |
3158 | 3158 |
3159 ; test27: Address-of a structure taken in a function with a loop where | 3159 ; test27: Address-of a structure taken in a function with a loop where |
3160 ; the alloca is an incoming value to a PHI node and a use of that PHI | 3160 ; the alloca is an incoming value to a PHI node and a use of that PHI |
3179 | 3179 |
3180 ; DARWIN-X64-LABEL: test27: | 3180 ; DARWIN-X64-LABEL: test27: |
3181 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 3181 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
3182 ; DARWIN-X64: callq ___stack_chk_fail | 3182 ; DARWIN-X64: callq ___stack_chk_fail |
3183 %tmp = alloca %struct.small*, align 8 | 3183 %tmp = alloca %struct.small*, align 8 |
3184 %tmp1 = call i32 (...)* @dummy(%struct.small** %tmp) | 3184 %tmp1 = call i32 (...) @dummy(%struct.small** %tmp) |
3185 %tmp2 = load %struct.small** %tmp, align 8 | 3185 %tmp2 = load %struct.small*, %struct.small** %tmp, align 8 |
3186 %tmp3 = ptrtoint %struct.small* %tmp2 to i64 | 3186 %tmp3 = ptrtoint %struct.small* %tmp2 to i64 |
3187 %tmp4 = trunc i64 %tmp3 to i32 | 3187 %tmp4 = trunc i64 %tmp3 to i32 |
3188 %tmp5 = icmp sgt i32 %tmp4, 0 | 3188 %tmp5 = icmp sgt i32 %tmp4, 0 |
3189 br i1 %tmp5, label %bb6, label %bb21 | 3189 br i1 %tmp5, label %bb6, label %bb21 |
3190 | 3190 |
3191 bb6: ; preds = %bb17, %bb | 3191 bb6: ; preds = %bb17, %bb |
3192 %tmp7 = phi %struct.small* [ %tmp19, %bb17 ], [ %tmp2, %bb ] | 3192 %tmp7 = phi %struct.small* [ %tmp19, %bb17 ], [ %tmp2, %bb ] |
3193 %tmp8 = phi i64 [ %tmp20, %bb17 ], [ 1, %bb ] | 3193 %tmp8 = phi i64 [ %tmp20, %bb17 ], [ 1, %bb ] |
3194 %tmp9 = phi i32 [ %tmp14, %bb17 ], [ %tmp1, %bb ] | 3194 %tmp9 = phi i32 [ %tmp14, %bb17 ], [ %tmp1, %bb ] |
3195 %tmp10 = getelementptr inbounds %struct.small* %tmp7, i64 0, i32 0 | 3195 %tmp10 = getelementptr inbounds %struct.small, %struct.small* %tmp7, i64 0, i32 0 |
3196 %tmp11 = load i8* %tmp10, align 1 | 3196 %tmp11 = load i8, i8* %tmp10, align 1 |
3197 %tmp12 = icmp eq i8 %tmp11, 1 | 3197 %tmp12 = icmp eq i8 %tmp11, 1 |
3198 %tmp13 = add nsw i32 %tmp9, 8 | 3198 %tmp13 = add nsw i32 %tmp9, 8 |
3199 %tmp14 = select i1 %tmp12, i32 %tmp13, i32 %tmp9 | 3199 %tmp14 = select i1 %tmp12, i32 %tmp13, i32 %tmp9 |
3200 %tmp15 = trunc i64 %tmp8 to i32 | 3200 %tmp15 = trunc i64 %tmp8 to i32 |
3201 %tmp16 = icmp eq i32 %tmp15, %tmp4 | 3201 %tmp16 = icmp eq i32 %tmp15, %tmp4 |
3202 br i1 %tmp16, label %bb21, label %bb17 | 3202 br i1 %tmp16, label %bb21, label %bb17 |
3203 | 3203 |
3204 bb17: ; preds = %bb6 | 3204 bb17: ; preds = %bb6 |
3205 %tmp18 = getelementptr inbounds %struct.small** %tmp, i64 %tmp8 | 3205 %tmp18 = getelementptr inbounds %struct.small*, %struct.small** %tmp, i64 %tmp8 |
3206 %tmp19 = load %struct.small** %tmp18, align 8 | 3206 %tmp19 = load %struct.small*, %struct.small** %tmp18, align 8 |
3207 %tmp20 = add i64 %tmp8, 1 | 3207 %tmp20 = add i64 %tmp8, 1 |
3208 br label %bb6 | 3208 br label %bb6 |
3209 | 3209 |
3210 bb21: ; preds = %bb6, %bb | 3210 bb21: ; preds = %bb6, %bb |
3211 %tmp22 = phi i32 [ %tmp1, %bb ], [ %tmp14, %bb6 ] | 3211 %tmp22 = phi i32 [ %tmp1, %bb ], [ %tmp14, %bb6 ] |
3212 %tmp23 = call i32 (...)* @dummy(i32 %tmp22) | 3212 %tmp23 = call i32 (...) @dummy(i32 %tmp22) |
3213 ret i32 undef | 3213 ret i32 undef |
3214 } | 3214 } |
3215 | 3215 |
3216 ; test28a: An array of [32 x i8] and a requested ssp-buffer-size of 33. | 3216 ; test28a: An array of [32 x i8] and a requested ssp-buffer-size of 33. |
3217 ; Requires no protector. | 3217 ; Requires no protector. |
3232 | 3232 |
3233 ; DARWIN-X64-LABEL: test28a: | 3233 ; DARWIN-X64-LABEL: test28a: |
3234 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 3234 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
3235 ; DARWIN-X64: .cfi_endproc | 3235 ; DARWIN-X64: .cfi_endproc |
3236 %test = alloca [32 x i8], align 16 | 3236 %test = alloca [32 x i8], align 16 |
3237 %arraydecay = getelementptr inbounds [32 x i8]* %test, i32 0, i32 0 | 3237 %arraydecay = getelementptr inbounds [32 x i8], [32 x i8]* %test, i32 0, i32 0 |
3238 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay) | 3238 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay) |
3239 ret i32 %call | 3239 ret i32 %call |
3240 } | 3240 } |
3241 | 3241 |
3242 ; test28b: An array of [33 x i8] and a requested ssp-buffer-size of 33. | 3242 ; test28b: An array of [33 x i8] and a requested ssp-buffer-size of 33. |
3243 ; Requires protector. | 3243 ; Requires protector. |
3258 | 3258 |
3259 ; DARWIN-X64-LABEL: test28b: | 3259 ; DARWIN-X64-LABEL: test28b: |
3260 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 3260 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
3261 ; DARWIN-X64: callq ___stack_chk_fail | 3261 ; DARWIN-X64: callq ___stack_chk_fail |
3262 %test = alloca [33 x i8], align 16 | 3262 %test = alloca [33 x i8], align 16 |
3263 %arraydecay = getelementptr inbounds [33 x i8]* %test, i32 0, i32 0 | 3263 %arraydecay = getelementptr inbounds [33 x i8], [33 x i8]* %test, i32 0, i32 0 |
3264 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay) | 3264 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay) |
3265 ret i32 %call | 3265 ret i32 %call |
3266 } | 3266 } |
3267 | 3267 |
3268 ; test29a: An array of [4 x i8] and a requested ssp-buffer-size of 5. | 3268 ; test29a: An array of [4 x i8] and a requested ssp-buffer-size of 5. |
3269 ; Requires no protector. | 3269 ; Requires no protector. |
3284 | 3284 |
3285 ; DARWIN-X64-LABEL: test29a: | 3285 ; DARWIN-X64-LABEL: test29a: |
3286 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 3286 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
3287 ; DARWIN-X64: .cfi_endproc | 3287 ; DARWIN-X64: .cfi_endproc |
3288 %test = alloca [4 x i8], align 1 | 3288 %test = alloca [4 x i8], align 1 |
3289 %arraydecay = getelementptr inbounds [4 x i8]* %test, i32 0, i32 0 | 3289 %arraydecay = getelementptr inbounds [4 x i8], [4 x i8]* %test, i32 0, i32 0 |
3290 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay) | 3290 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay) |
3291 ret i32 %call | 3291 ret i32 %call |
3292 } | 3292 } |
3293 | 3293 |
3294 ; test29b: An array of [5 x i8] and a requested ssp-buffer-size of 5. | 3294 ; test29b: An array of [5 x i8] and a requested ssp-buffer-size of 5. |
3295 ; Requires protector. | 3295 ; Requires protector. |
3310 | 3310 |
3311 ; DARWIN-X64-LABEL: test29b: | 3311 ; DARWIN-X64-LABEL: test29b: |
3312 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 3312 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
3313 ; DARWIN-X64: callq ___stack_chk_fail | 3313 ; DARWIN-X64: callq ___stack_chk_fail |
3314 %test = alloca [5 x i8], align 1 | 3314 %test = alloca [5 x i8], align 1 |
3315 %arraydecay = getelementptr inbounds [5 x i8]* %test, i32 0, i32 0 | 3315 %arraydecay = getelementptr inbounds [5 x i8], [5 x i8]* %test, i32 0, i32 0 |
3316 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay) | 3316 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay) |
3317 ret i32 %call | 3317 ret i32 %call |
3318 } | 3318 } |
3319 | 3319 |
3320 ; test30a: An structure containing an i32 and an array of [5 x i8]. | 3320 ; test30a: An structure containing an i32 and an array of [5 x i8]. |
3321 ; Requested ssp-buffer-size of 6. | 3321 ; Requested ssp-buffer-size of 6. |
3341 %test = alloca %struct.small_char, align 4 | 3341 %test = alloca %struct.small_char, align 4 |
3342 %test.coerce = alloca { i64, i8 } | 3342 %test.coerce = alloca { i64, i8 } |
3343 %0 = bitcast { i64, i8 }* %test.coerce to i8* | 3343 %0 = bitcast { i64, i8 }* %test.coerce to i8* |
3344 %1 = bitcast %struct.small_char* %test to i8* | 3344 %1 = bitcast %struct.small_char* %test to i8* |
3345 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* %1, i64 12, i32 0, i1 false) | 3345 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* %1, i64 12, i32 0, i1 false) |
3346 %2 = getelementptr { i64, i8 }* %test.coerce, i32 0, i32 0 | 3346 %2 = getelementptr { i64, i8 }, { i64, i8 }* %test.coerce, i32 0, i32 0 |
3347 %3 = load i64* %2, align 1 | 3347 %3 = load i64, i64* %2, align 1 |
3348 %4 = getelementptr { i64, i8 }* %test.coerce, i32 0, i32 1 | 3348 %4 = getelementptr { i64, i8 }, { i64, i8 }* %test.coerce, i32 0, i32 1 |
3349 %5 = load i8* %4, align 1 | 3349 %5 = load i8, i8* %4, align 1 |
3350 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %3, i8 %5) | 3350 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i64 %3, i8 %5) |
3351 ret i32 %call | 3351 ret i32 %call |
3352 } | 3352 } |
3353 | 3353 |
3354 ; test30b: An structure containing an i32 and an array of [5 x i8]. | 3354 ; test30b: An structure containing an i32 and an array of [5 x i8]. |
3355 ; Requested ssp-buffer-size of 5. | 3355 ; Requested ssp-buffer-size of 5. |
3375 %test = alloca %struct.small_char, align 4 | 3375 %test = alloca %struct.small_char, align 4 |
3376 %test.coerce = alloca { i64, i8 } | 3376 %test.coerce = alloca { i64, i8 } |
3377 %0 = bitcast { i64, i8 }* %test.coerce to i8* | 3377 %0 = bitcast { i64, i8 }* %test.coerce to i8* |
3378 %1 = bitcast %struct.small_char* %test to i8* | 3378 %1 = bitcast %struct.small_char* %test to i8* |
3379 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* %1, i64 12, i32 0, i1 false) | 3379 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* %1, i64 12, i32 0, i1 false) |
3380 %2 = getelementptr { i64, i8 }* %test.coerce, i32 0, i32 0 | 3380 %2 = getelementptr { i64, i8 }, { i64, i8 }* %test.coerce, i32 0, i32 0 |
3381 %3 = load i64* %2, align 1 | 3381 %3 = load i64, i64* %2, align 1 |
3382 %4 = getelementptr { i64, i8 }* %test.coerce, i32 0, i32 1 | 3382 %4 = getelementptr { i64, i8 }, { i64, i8 }* %test.coerce, i32 0, i32 1 |
3383 %5 = load i8* %4, align 1 | 3383 %5 = load i8, i8* %4, align 1 |
3384 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %3, i8 %5) | 3384 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i64 %3, i8 %5) |
3385 ret i32 %call | 3385 ret i32 %call |
3386 } | 3386 } |
3387 | 3387 |
3388 ; test31a: An alloca of size 5. | 3388 ; test31a: An alloca of size 5. |
3389 ; Requested ssp-buffer-size of 6. | 3389 ; Requested ssp-buffer-size of 6. |
3407 ; DARWIN-X64-NOT: callq ___stack_chk_fail | 3407 ; DARWIN-X64-NOT: callq ___stack_chk_fail |
3408 ; DARWIN-X64: .cfi_endproc | 3408 ; DARWIN-X64: .cfi_endproc |
3409 %test = alloca i8*, align 8 | 3409 %test = alloca i8*, align 8 |
3410 %0 = alloca i8, i64 4 | 3410 %0 = alloca i8, i64 4 |
3411 store i8* %0, i8** %test, align 8 | 3411 store i8* %0, i8** %test, align 8 |
3412 %1 = load i8** %test, align 8 | 3412 %1 = load i8*, i8** %test, align 8 |
3413 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %1) | 3413 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %1) |
3414 ret i32 %call | 3414 ret i32 %call |
3415 } | 3415 } |
3416 | 3416 |
3417 ; test31b: An alloca of size 5. | 3417 ; test31b: An alloca of size 5. |
3418 ; Requested ssp-buffer-size of 5. | 3418 ; Requested ssp-buffer-size of 5. |
3435 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard | 3435 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard |
3436 ; DARWIN-X64: callq ___stack_chk_fail | 3436 ; DARWIN-X64: callq ___stack_chk_fail |
3437 %test = alloca i8*, align 8 | 3437 %test = alloca i8*, align 8 |
3438 %0 = alloca i8, i64 5 | 3438 %0 = alloca i8, i64 5 |
3439 store i8* %0, i8** %test, align 8 | 3439 store i8* %0, i8** %test, align 8 |
3440 %1 = load i8** %test, align 8 | 3440 %1 = load i8*, i8** %test, align 8 |
3441 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %1) | 3441 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* %1) |
3442 ret i32 %call | 3442 ret i32 %call |
3443 } | 3443 } |
3444 | 3444 |
3445 declare double @testi_aux() | 3445 declare double @testi_aux() |
3446 declare i8* @strcpy(i8*, i8*) | 3446 declare i8* @strcpy(i8*, i8*) |