1 ; "PLAIN" - No optimizations. This tests the target-independent
3 ; RUN: opt -S -o - < %s | FileCheck --check-prefix=PLAIN %s
5 ; "OPT" - Optimizations but no targetdata. This tests target-independent
6 ; folding in the optimizers.
7 ; RUN: opt -S -o - -instcombine -globalopt < %s | FileCheck --check-prefix=OPT %s
9 ; "TO" - Optimizations and targetdata. This tests target-dependent
10 ; folding in the optimizers.
11 ; RUN: opt -S -o - -instcombine -globalopt -default-data-layout="e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" < %s | FileCheck --check-prefix=TO %s
13 ; "SCEV" - ScalarEvolution but no targetdata.
14 ; RUN: opt -analyze -scalar-evolution < %s | FileCheck --check-prefix=SCEV %s
16 ; ScalarEvolution with targetdata isn't interesting on these testcases
17 ; because ScalarEvolution doesn't attempt to duplicate all of instcombine's
18 ; and the constant folders' folding.
20 ; PLAIN: %0 = type { i1, double }
21 ; PLAIN: %1 = type { double, float, double, double }
22 ; PLAIN: %2 = type { i1, i1* }
23 ; PLAIN: %3 = type { i64, i64 }
24 ; PLAIN: %4 = type { i32, i32 }
25 ; OPT: %0 = type { i1, double }
26 ; OPT: %1 = type { double, float, double, double }
27 ; OPT: %2 = type { i1, i1* }
28 ; OPT: %3 = type { i64, i64 }
29 ; OPT: %4 = type { i32, i32 }
31 ; The automatic constant folder in opt does not have targetdata access, so
32 ; it can't fold gep arithmetic, in general. However, the constant folder run
33 ; from instcombine and global opt can use targetdata.
35 ; PLAIN: @G8 = global i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -1)
36 ; PLAIN: @G1 = global i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -1)
37 ; PLAIN: @F8 = global i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -2)
38 ; PLAIN: @F1 = global i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -2)
39 ; PLAIN: @H8 = global i8* getelementptr (i8* null, i32 -1)
40 ; PLAIN: @H1 = global i1* getelementptr (i1* null, i32 -1)
41 ; OPT: @G8 = global i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -1)
42 ; OPT: @G1 = global i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -1)
43 ; OPT: @F8 = global i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -2)
44 ; OPT: @F1 = global i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -2)
45 ; OPT: @H8 = global i8* getelementptr (i8* null, i32 -1)
46 ; OPT: @H1 = global i1* getelementptr (i1* null, i32 -1)
47 ; TO: @G8 = global i8* null
48 ; TO: @G1 = global i1* null
49 ; TO: @F8 = global i8* inttoptr (i64 -1 to i8*)
50 ; TO: @F1 = global i1* inttoptr (i64 -1 to i1*)
51 ; TO: @H8 = global i8* inttoptr (i64 -1 to i8*)
52 ; TO: @H1 = global i1* inttoptr (i64 -1 to i1*)
54 @G8 = global i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -1)
55 @G1 = global i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -1)
56 @F8 = global i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -2)
57 @F1 = global i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -2)
58 @H8 = global i8* getelementptr (i8* inttoptr (i32 0 to i8*), i32 -1)
59 @H1 = global i1* getelementptr (i1* inttoptr (i32 0 to i1*), i32 -1)
61 ; The target-independent folder should be able to do some clever
62 ; simplifications on sizeof, alignof, and offsetof expressions. The
63 ; target-dependent folder should fold these down to constants.
65 ; PLAIN: @a = constant i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310)
66 ; PLAIN: @b = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
67 ; PLAIN: @c = constant i64 mul nuw (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2)
68 ; PLAIN: @d = constant i64 mul nuw (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 11)
69 ; PLAIN: @e = constant i64 ptrtoint (double* getelementptr (%1* null, i64 0, i32 2) to i64)
70 ; PLAIN: @f = constant i64 1
71 ; PLAIN: @g = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
72 ; PLAIN: @h = constant i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64)
73 ; PLAIN: @i = constant i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64)
74 ; PLAIN: @j = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
75 ; PLAIN: @k = constant i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64)
76 ; OPT: @a = constant i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310)
77 ; OPT: @b = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
78 ; OPT: @c = constant i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2)
79 ; OPT: @d = constant i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 11)
80 ; OPT: @e = constant i64 ptrtoint (double* getelementptr (%1* null, i64 0, i32 2) to i64)
81 ; OPT: @f = constant i64 1
82 ; OPT: @g = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
83 ; OPT: @h = constant i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64)
84 ; OPT: @i = constant i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64)
85 ; OPT: @j = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
86 ; OPT: @k = constant i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64)
87 ; TO: @a = constant i64 18480
88 ; TO: @b = constant i64 8
89 ; TO: @c = constant i64 16
90 ; TO: @d = constant i64 88
91 ; TO: @e = constant i64 16
92 ; TO: @f = constant i64 1
93 ; TO: @g = constant i64 8
94 ; TO: @h = constant i64 8
95 ; TO: @i = constant i64 8
96 ; TO: @j = constant i64 8
97 ; TO: @k = constant i64 8
99 @a = constant i64 mul (i64 3, i64 mul (i64 ptrtoint ({[7 x double], [7 x double]}* getelementptr ({[7 x double], [7 x double]}* null, i64 11) to i64), i64 5))
100 @b = constant i64 ptrtoint ([13 x double]* getelementptr ({i1, [13 x double]}* null, i64 0, i32 1) to i64)
101 @c = constant i64 ptrtoint (double* getelementptr ({double, double, double, double}* null, i64 0, i32 2) to i64)
102 @d = constant i64 ptrtoint (double* getelementptr ([13 x double]* null, i64 0, i32 11) to i64)
103 @e = constant i64 ptrtoint (double* getelementptr ({double, float, double, double}* null, i64 0, i32 2) to i64)
104 @f = constant i64 ptrtoint (<{ i16, i128 }>* getelementptr ({i1, <{ i16, i128 }>}* null, i64 0, i32 1) to i64)
105 @g = constant i64 ptrtoint ({double, double}* getelementptr ({i1, {double, double}}* null, i64 0, i32 1) to i64)
106 @h = constant i64 ptrtoint (double** getelementptr (double** null, i64 1) to i64)
107 @i = constant i64 ptrtoint (double** getelementptr ({i1, double*}* null, i64 0, i32 1) to i64)
108 @j = constant i64 ptrtoint (union {double, double}* getelementptr ({i1, union {double, double}}* null, i64 0, i32 1) to i64)
109 @k = constant i64 ptrtoint (union {double, double}* getelementptr (union {double, double}* null, i64 1) to i64)
111 ; The target-dependent folder should cast GEP indices to integer-sized pointers.
113 ; PLAIN: @M = constant i64* getelementptr (i64* null, i32 1)
114 ; PLAIN: @N = constant i64* getelementptr (%3* null, i32 0, i32 1)
115 ; PLAIN: @O = constant i64* getelementptr ([2 x i64]* null, i32 0, i32 1)
116 ; OPT: @M = constant i64* getelementptr (i64* null, i32 1)
117 ; OPT: @N = constant i64* getelementptr (%3* null, i32 0, i32 1)
118 ; OPT: @O = constant i64* getelementptr ([2 x i64]* null, i32 0, i32 1)
119 ; TO: @M = constant i64* inttoptr (i64 8 to i64*)
120 ; TO: @N = constant i64* inttoptr (i64 8 to i64*)
121 ; TO: @O = constant i64* inttoptr (i64 8 to i64*)
123 @M = constant i64* getelementptr (i64* null, i32 1)
124 @N = constant i64* getelementptr ({ i64, i64 }* null, i32 0, i32 1)
125 @O = constant i64* getelementptr ([2 x i64]* null, i32 0, i32 1)
127 ; Fold GEP of a GEP. Theoretically some of these cases could be folded
128 ; without using targetdata, however that's not implemented yet.
130 ; PLAIN: @Z = global i32* getelementptr inbounds (i32* getelementptr inbounds ([3 x %4]* @ext, i64 0, i64 1, i32 0), i64 1)
131 ; OPT: @Z = global i32* getelementptr (i32* getelementptr inbounds ([3 x %4]* @ext, i64 0, i64 1, i32 0), i64 1)
132 ; TO: @Z = global i32* getelementptr inbounds ([3 x %0]* @ext, i64 0, i64 1, i32 1)
134 @ext = external global [3 x { i32, i32 }]
135 @Z = global i32* getelementptr inbounds (i32* getelementptr inbounds ([3 x { i32, i32 }]* @ext, i64 0, i64 1, i32 0), i64 1)
137 ; Duplicate all of the above as function return values rather than
138 ; global initializers.
140 ; PLAIN: define i8* @goo8() nounwind {
141 ; PLAIN: %t = bitcast i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -1) to i8*
144 ; PLAIN: define i1* @goo1() nounwind {
145 ; PLAIN: %t = bitcast i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -1) to i1*
148 ; PLAIN: define i8* @foo8() nounwind {
149 ; PLAIN: %t = bitcast i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -2) to i8*
152 ; PLAIN: define i1* @foo1() nounwind {
153 ; PLAIN: %t = bitcast i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -2) to i1*
156 ; PLAIN: define i8* @hoo8() nounwind {
157 ; PLAIN: %t = bitcast i8* getelementptr (i8* null, i32 -1) to i8*
160 ; PLAIN: define i1* @hoo1() nounwind {
161 ; PLAIN: %t = bitcast i1* getelementptr (i1* null, i32 -1) to i1*
164 ; OPT: define i8* @goo8() nounwind {
165 ; OPT: ret i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -1)
167 ; OPT: define i1* @goo1() nounwind {
168 ; OPT: ret i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -1)
170 ; OPT: define i8* @foo8() nounwind {
171 ; OPT: ret i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -2)
173 ; OPT: define i1* @foo1() nounwind {
174 ; OPT: ret i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -2)
176 ; OPT: define i8* @hoo8() nounwind {
177 ; OPT: ret i8* getelementptr (i8* null, i32 -1)
179 ; OPT: define i1* @hoo1() nounwind {
180 ; OPT: ret i1* getelementptr (i1* null, i32 -1)
182 ; TO: define i8* @goo8() nounwind {
185 ; TO: define i1* @goo1() nounwind {
188 ; TO: define i8* @foo8() nounwind {
189 ; TO: ret i8* inttoptr (i64 -1 to i8*)
191 ; TO: define i1* @foo1() nounwind {
192 ; TO: ret i1* inttoptr (i64 -1 to i1*)
194 ; TO: define i8* @hoo8() nounwind {
195 ; TO: ret i8* inttoptr (i64 -1 to i8*)
197 ; TO: define i1* @hoo1() nounwind {
198 ; TO: ret i1* inttoptr (i64 -1 to i1*)
200 ; SCEV: Classifying expressions for: @goo8
201 ; SCEV: %t = bitcast i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -1) to i8*
202 ; SCEV: --> ((-1 * sizeof(i8)) + inttoptr (i32 1 to i8*))
203 ; SCEV: Classifying expressions for: @goo1
204 ; SCEV: %t = bitcast i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -1) to i1*
205 ; SCEV: --> ((-1 * sizeof(i1)) + inttoptr (i32 1 to i1*))
206 ; SCEV: Classifying expressions for: @foo8
207 ; SCEV: %t = bitcast i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -2) to i8*
208 ; SCEV: --> ((-2 * sizeof(i8)) + inttoptr (i32 1 to i8*))
209 ; SCEV: Classifying expressions for: @foo1
210 ; SCEV: %t = bitcast i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -2) to i1*
211 ; SCEV: --> ((-2 * sizeof(i1)) + inttoptr (i32 1 to i1*))
212 ; SCEV: Classifying expressions for: @hoo8
213 ; SCEV: --> (-1 * sizeof(i8))
214 ; SCEV: Classifying expressions for: @hoo1
215 ; SCEV: --> (-1 * sizeof(i1))
217 define i8* @goo8() nounwind {
218 %t = bitcast i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -1) to i8*
221 define i1* @goo1() nounwind {
222 %t = bitcast i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -1) to i1*
225 define i8* @foo8() nounwind {
226 %t = bitcast i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -2) to i8*
229 define i1* @foo1() nounwind {
230 %t = bitcast i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -2) to i1*
233 define i8* @hoo8() nounwind {
234 %t = bitcast i8* getelementptr (i8* inttoptr (i32 0 to i8*), i32 -1) to i8*
237 define i1* @hoo1() nounwind {
238 %t = bitcast i1* getelementptr (i1* inttoptr (i32 0 to i1*), i32 -1) to i1*
242 ; PLAIN: define i64 @fa() nounwind {
243 ; PLAIN: %t = bitcast i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310) to i64
246 ; PLAIN: define i64 @fb() nounwind {
247 ; PLAIN: %t = bitcast i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) to i64
250 ; PLAIN: define i64 @fc() nounwind {
251 ; PLAIN: %t = bitcast i64 mul nuw (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2) to i64
254 ; PLAIN: define i64 @fd() nounwind {
255 ; PLAIN: %t = bitcast i64 mul nuw (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 11) to i64
258 ; PLAIN: define i64 @fe() nounwind {
259 ; PLAIN: %t = bitcast i64 ptrtoint (double* getelementptr (%1* null, i64 0, i32 2) to i64) to i64
262 ; PLAIN: define i64 @ff() nounwind {
263 ; PLAIN: %t = bitcast i64 1 to i64
266 ; PLAIN: define i64 @fg() nounwind {
267 ; PLAIN: %t = bitcast i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) to i64
270 ; PLAIN: define i64 @fh() nounwind {
271 ; PLAIN: %t = bitcast i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64) to i64
274 ; PLAIN: define i64 @fi() nounwind {
275 ; PLAIN: %t = bitcast i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64) to i64
278 ; PLAIN: define i64 @fj() nounwind {
279 ; PLAIN: %t = bitcast i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) to i64
282 ; PLAIN: define i64 @fk() nounwind {
283 ; PLAIN: %t = bitcast i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64) to i64
286 ; OPT: define i64 @fa() nounwind {
287 ; OPT: ret i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310)
289 ; OPT: define i64 @fb() nounwind {
290 ; OPT: ret i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
292 ; OPT: define i64 @fc() nounwind {
293 ; OPT: ret i64 mul nuw (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2)
295 ; OPT: define i64 @fd() nounwind {
296 ; OPT: ret i64 mul nuw (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 11)
298 ; OPT: define i64 @fe() nounwind {
299 ; OPT: ret i64 ptrtoint (double* getelementptr (%1* null, i64 0, i32 2) to i64)
301 ; OPT: define i64 @ff() nounwind {
304 ; OPT: define i64 @fg() nounwind {
305 ; OPT: ret i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
307 ; OPT: define i64 @fh() nounwind {
308 ; OPT: ret i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64)
310 ; OPT: define i64 @fi() nounwind {
311 ; OPT: ret i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64)
313 ; OPT: define i64 @fj() nounwind {
314 ; OPT: ret i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
316 ; OPT: define i64 @fk() nounwind {
317 ; OPT: ret i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64)
319 ; TO: define i64 @fa() nounwind {
322 ; TO: define i64 @fb() nounwind {
325 ; TO: define i64 @fc() nounwind {
328 ; TO: define i64 @fd() nounwind {
331 ; TO: define i64 @fe() nounwind {
334 ; TO: define i64 @ff() nounwind {
337 ; TO: define i64 @fg() nounwind {
340 ; TO: define i64 @fh() nounwind {
343 ; TO: define i64 @fi() nounwind {
346 ; TO: define i64 @fj() nounwind {
349 ; TO: define i64 @fk() nounwind {
352 ; SCEV: Classifying expressions for: @fa
353 ; SCEV: %t = bitcast i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310) to i64
354 ; SCEV: --> (2310 * sizeof(double))
355 ; SCEV: Classifying expressions for: @fb
356 ; SCEV: %t = bitcast i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) to i64
357 ; SCEV: --> alignof(double)
358 ; SCEV: Classifying expressions for: @fc
359 ; SCEV: %t = bitcast i64 mul nuw (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2) to i64
360 ; SCEV: --> (2 * sizeof(double))
361 ; SCEV: Classifying expressions for: @fd
362 ; SCEV: %t = bitcast i64 mul nuw (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 11) to i64
363 ; SCEV: --> (11 * sizeof(double))
364 ; SCEV: Classifying expressions for: @fe
365 ; SCEV: %t = bitcast i64 ptrtoint (double* getelementptr (%1* null, i64 0, i32 2) to i64) to i64
366 ; SCEV: --> offsetof({ double, float, double, double }, 2)
367 ; SCEV: Classifying expressions for: @ff
368 ; SCEV: %t = bitcast i64 1 to i64
370 ; SCEV: Classifying expressions for: @fg
371 ; SCEV: %t = bitcast i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) to i64
372 ; SCEV: --> alignof(double)
373 ; SCEV: Classifying expressions for: @fh
374 ; SCEV: %t = bitcast i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64) to i64
375 ; SCEV: --> sizeof(i1*)
376 ; SCEV: Classifying expressions for: @fi
377 ; SCEV: %t = bitcast i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64) to i64
378 ; SCEV: --> alignof(i1*)
379 ; SCEV: Classifying expressions for: @fj
380 ; SCEV: %t = bitcast i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) to i64
381 ; SCEV: --> alignof(double)
382 ; SCEV: Classifying expressions for: @fk
383 ; SCEV: %t = bitcast i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64) to i64
384 ; SCEV: --> sizeof(double)
386 define i64 @fa() nounwind {
387 %t = bitcast i64 mul (i64 3, i64 mul (i64 ptrtoint ({[7 x double], [7 x double]}* getelementptr ({[7 x double], [7 x double]}* null, i64 11) to i64), i64 5)) to i64
390 define i64 @fb() nounwind {
391 %t = bitcast i64 ptrtoint ([13 x double]* getelementptr ({i1, [13 x double]}* null, i64 0, i32 1) to i64) to i64
394 define i64 @fc() nounwind {
395 %t = bitcast i64 ptrtoint (double* getelementptr ({double, double, double, double}* null, i64 0, i32 2) to i64) to i64
398 define i64 @fd() nounwind {
399 %t = bitcast i64 ptrtoint (double* getelementptr ([13 x double]* null, i64 0, i32 11) to i64) to i64
402 define i64 @fe() nounwind {
403 %t = bitcast i64 ptrtoint (double* getelementptr ({double, float, double, double}* null, i64 0, i32 2) to i64) to i64
406 define i64 @ff() nounwind {
407 %t = bitcast i64 ptrtoint (<{ i16, i128 }>* getelementptr ({i1, <{ i16, i128 }>}* null, i64 0, i32 1) to i64) to i64
410 define i64 @fg() nounwind {
411 %t = bitcast i64 ptrtoint ({double, double}* getelementptr ({i1, {double, double}}* null, i64 0, i32 1) to i64) to i64
414 define i64 @fh() nounwind {
415 %t = bitcast i64 ptrtoint (double** getelementptr (double** null, i32 1) to i64) to i64
418 define i64 @fi() nounwind {
419 %t = bitcast i64 ptrtoint (double** getelementptr ({i1, double*}* null, i64 0, i32 1) to i64) to i64
422 define i64 @fj() nounwind {
423 %t = bitcast i64 ptrtoint (union {double, double}* getelementptr ({i1, union {double, double}}* null, i64 0, i32 1) to i64) to i64
426 define i64 @fk() nounwind {
427 %t = bitcast i64 ptrtoint (union {double, double}* getelementptr (union {double, double}* null, i64 1) to i64) to i64
431 ; PLAIN: define i64* @fM() nounwind {
432 ; PLAIN: %t = bitcast i64* getelementptr (i64* null, i32 1) to i64*
435 ; PLAIN: define i64* @fN() nounwind {
436 ; PLAIN: %t = bitcast i64* getelementptr (%3* null, i32 0, i32 1) to i64*
439 ; PLAIN: define i64* @fO() nounwind {
440 ; PLAIN: %t = bitcast i64* getelementptr ([2 x i64]* null, i32 0, i32 1) to i64*
443 ; OPT: define i64* @fM() nounwind {
444 ; OPT: ret i64* getelementptr (i64* null, i32 1)
446 ; OPT: define i64* @fN() nounwind {
447 ; OPT: ret i64* getelementptr (%3* null, i32 0, i32 1)
449 ; OPT: define i64* @fO() nounwind {
450 ; OPT: ret i64* getelementptr ([2 x i64]* null, i32 0, i32 1)
452 ; TO: define i64* @fM() nounwind {
453 ; TO: ret i64* inttoptr (i64 8 to i64*)
455 ; TO: define i64* @fN() nounwind {
456 ; TO: ret i64* inttoptr (i64 8 to i64*)
458 ; TO: define i64* @fO() nounwind {
459 ; TO: ret i64* inttoptr (i64 8 to i64*)
461 ; SCEV: Classifying expressions for: @fM
462 ; SCEV: %t = bitcast i64* getelementptr (i64* null, i32 1) to i64*
463 ; SCEV: --> sizeof(i64)
464 ; SCEV: Classifying expressions for: @fN
465 ; SCEV: %t = bitcast i64* getelementptr (%3* null, i32 0, i32 1) to i64*
466 ; SCEV: --> sizeof(i64)
467 ; SCEV: Classifying expressions for: @fO
468 ; SCEV: %t = bitcast i64* getelementptr ([2 x i64]* null, i32 0, i32 1) to i64*
469 ; SCEV: --> sizeof(i64)
471 define i64* @fM() nounwind {
472 %t = bitcast i64* getelementptr (i64* null, i32 1) to i64*
475 define i64* @fN() nounwind {
476 %t = bitcast i64* getelementptr ({ i64, i64 }* null, i32 0, i32 1) to i64*
479 define i64* @fO() nounwind {
480 %t = bitcast i64* getelementptr ([2 x i64]* null, i32 0, i32 1) to i64*
484 ; PLAIN: define i32* @fZ() nounwind {
485 ; PLAIN: %t = bitcast i32* getelementptr inbounds (i32* getelementptr inbounds ([3 x %4]* @ext, i64 0, i64 1, i32 0), i64 1) to i32*
488 ; OPT: define i32* @fZ() nounwind {
489 ; OPT: ret i32* getelementptr inbounds (i32* getelementptr inbounds ([3 x %4]* @ext, i64 0, i64 1, i32 0), i64 1)
491 ; TO: define i32* @fZ() nounwind {
492 ; TO: ret i32* getelementptr inbounds ([3 x %0]* @ext, i64 0, i64 1, i32 1)
494 ; SCEV: Classifying expressions for: @fZ
495 ; SCEV: %t = bitcast i32* getelementptr inbounds (i32* getelementptr inbounds ([3 x %4]* @ext, i64 0, i64 1, i32 0), i64 1) to i32*
496 ; SCEV: --> ((3 * sizeof(i32)) + @ext)
498 define i32* @fZ() nounwind {
499 %t = bitcast i32* getelementptr inbounds (i32* getelementptr inbounds ([3 x { i32, i32 }]* @ext, i64 0, i64 1, i32 0), i64 1) to i32*