blob: aa5d254a0ce2297f02ea6437c4639a67adb428cf [file] [log] [blame]
Sebastian Pop59b61b92012-10-11 07:32:34 +00001; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
2
3; ModuleID = 'ExactRDIV.bc'
4target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
5target triple = "x86_64-apple-macosx10.6.0"
6
7
8;; for (long int i = 0; i < 10; i++)
9;; A[4*i + 10] = ...
10;; for (long int j = 0; j < 10; j++)
11;; ... = A[2*j + 1];
12
13define void @rdiv0(i32* %A, i32* %B) nounwind uwtable ssp {
14entry:
15 br label %for.body
16
17for.body: ; preds = %for.body, %entry
18 %i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
19 %conv = trunc i64 %i.03 to i32
20 %mul = shl nsw i64 %i.03, 2
21 %add = add nsw i64 %mul, 10
22 %arrayidx = getelementptr inbounds i32* %A, i64 %add
23 store i32 %conv, i32* %arrayidx, align 4
24 %inc = add nsw i64 %i.03, 1
25 %cmp = icmp slt i64 %inc, 10
26 br i1 %cmp, label %for.body, label %for.body4
27
28for.body4: ; preds = %for.body4, %for.body
29 %j.02 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.body ]
30 %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ]
31 %mul5 = shl nsw i64 %j.02, 1
32 %add64 = or i64 %mul5, 1
33 %arrayidx7 = getelementptr inbounds i32* %A, i64 %add64
34 %0 = load i32* %arrayidx7, align 4
35; CHECK: da analyze - none!
36 %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
37 store i32 %0, i32* %B.addr.01, align 4
38 %inc9 = add nsw i64 %j.02, 1
39 %cmp2 = icmp slt i64 %inc9, 10
40 br i1 %cmp2, label %for.body4, label %for.end10
41
42for.end10: ; preds = %for.body4
43 ret void
44}
45
46
47;; for (long int i = 0; i < 5; i++)
48;; A[11*i - 45] = ...
49;; for (long int j = 0; j < 10; j++)
50;; ... = A[j];
51
52define void @rdiv1(i32* %A, i32* %B) nounwind uwtable ssp {
53entry:
54 br label %for.body
55
56for.body: ; preds = %for.body, %entry
57 %i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
58 %conv = trunc i64 %i.03 to i32
59 %mul = mul nsw i64 %i.03, 11
60 %sub = add nsw i64 %mul, -45
61 %arrayidx = getelementptr inbounds i32* %A, i64 %sub
62 store i32 %conv, i32* %arrayidx, align 4
63 %inc = add nsw i64 %i.03, 1
64 %cmp = icmp slt i64 %inc, 5
65 br i1 %cmp, label %for.body, label %for.body4
66
67for.body4: ; preds = %for.body4, %for.body
68 %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body ]
69 %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ]
70 %arrayidx5 = getelementptr inbounds i32* %A, i64 %j.02
71 %0 = load i32* %arrayidx5, align 4
72; CHECK: da analyze - none!
73 %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
74 store i32 %0, i32* %B.addr.01, align 4
75 %inc7 = add nsw i64 %j.02, 1
76 %cmp2 = icmp slt i64 %inc7, 10
77 br i1 %cmp2, label %for.body4, label %for.end8
78
79for.end8: ; preds = %for.body4
80 ret void
81}
82
83
84;; for (long int i = 0; i <= 5; i++)
85;; A[11*i - 45] = ...
86;; for (long int j = 0; j < 10; j++)
87;; ... = A[j];
88
89define void @rdiv2(i32* %A, i32* %B) nounwind uwtable ssp {
90entry:
91 br label %for.body
92
93for.body: ; preds = %for.body, %entry
94 %i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
95 %conv = trunc i64 %i.03 to i32
96 %mul = mul nsw i64 %i.03, 11
97 %sub = add nsw i64 %mul, -45
98 %arrayidx = getelementptr inbounds i32* %A, i64 %sub
99 store i32 %conv, i32* %arrayidx, align 4
100 %inc = add nsw i64 %i.03, 1
101 %cmp = icmp slt i64 %inc, 6
102 br i1 %cmp, label %for.body, label %for.body4
103
104for.body4: ; preds = %for.body4, %for.body
105 %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body ]
106 %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ]
107 %arrayidx5 = getelementptr inbounds i32* %A, i64 %j.02
108 %0 = load i32* %arrayidx5, align 4
109; CHECK: da analyze - none!
110 %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
111 store i32 %0, i32* %B.addr.01, align 4
112 %inc7 = add nsw i64 %j.02, 1
113 %cmp2 = icmp slt i64 %inc7, 10
114 br i1 %cmp2, label %for.body4, label %for.end8
115
116for.end8: ; preds = %for.body4
117 ret void
118}
119
120
121;; for (long int i = 0; i < 5; i++)
122;; A[11*i - 45] = ...
123;; for (long int j = 0; j <= 10; j++)
124;; ... = A[j];
125
126define void @rdiv3(i32* %A, i32* %B) nounwind uwtable ssp {
127entry:
128 br label %for.body
129
130for.body: ; preds = %for.body, %entry
131 %i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
132 %conv = trunc i64 %i.03 to i32
133 %mul = mul nsw i64 %i.03, 11
134 %sub = add nsw i64 %mul, -45
135 %arrayidx = getelementptr inbounds i32* %A, i64 %sub
136 store i32 %conv, i32* %arrayidx, align 4
137 %inc = add nsw i64 %i.03, 1
138 %cmp = icmp slt i64 %inc, 5
139 br i1 %cmp, label %for.body, label %for.body4
140
141for.body4: ; preds = %for.body4, %for.body
142 %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body ]
143 %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ]
144 %arrayidx5 = getelementptr inbounds i32* %A, i64 %j.02
145 %0 = load i32* %arrayidx5, align 4
146; CHECK: da analyze - none!
147 %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
148 store i32 %0, i32* %B.addr.01, align 4
149 %inc7 = add nsw i64 %j.02, 1
150 %cmp2 = icmp slt i64 %inc7, 11
151 br i1 %cmp2, label %for.body4, label %for.end8
152
153for.end8: ; preds = %for.body4
154 ret void
155}
156
157
158;; for (long int i = 0; i <= 5; i++)
159;; A[11*i - 45] = ...
160;; for (long int j = 0; j <= 10; j++)
161;; ... = A[j];
162
163define void @rdiv4(i32* %A, i32* %B) nounwind uwtable ssp {
164entry:
165 br label %for.body
166
167for.body: ; preds = %for.body, %entry
168 %i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
169 %conv = trunc i64 %i.03 to i32
170 %mul = mul nsw i64 %i.03, 11
171 %sub = add nsw i64 %mul, -45
172 %arrayidx = getelementptr inbounds i32* %A, i64 %sub
173 store i32 %conv, i32* %arrayidx, align 4
174 %inc = add nsw i64 %i.03, 1
175 %cmp = icmp slt i64 %inc, 6
176 br i1 %cmp, label %for.body, label %for.body4
177
178for.body4: ; preds = %for.body4, %for.body
179 %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body ]
180 %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ]
181 %arrayidx5 = getelementptr inbounds i32* %A, i64 %j.02
182 %0 = load i32* %arrayidx5, align 4
183; CHECK: da analyze - flow!
184 %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
185 store i32 %0, i32* %B.addr.01, align 4
186 %inc7 = add nsw i64 %j.02, 1
187 %cmp2 = icmp slt i64 %inc7, 11
188 br i1 %cmp2, label %for.body4, label %for.end8
189
190for.end8: ; preds = %for.body4
191 ret void
192}
193
194
195;; for (long int i = 0; i < 5; i++)
196;; A[-11*i + 45] = ...
197;; for (long int j = 0; j < 10; j++)
198;; ... = A[-j];
199
200define void @rdiv5(i32* %A, i32* %B) nounwind uwtable ssp {
201entry:
202 br label %for.body
203
204for.body: ; preds = %for.body, %entry
205 %i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
206 %conv = trunc i64 %i.03 to i32
207 %mul = mul nsw i64 %i.03, -11
208 %add = add nsw i64 %mul, 45
209 %arrayidx = getelementptr inbounds i32* %A, i64 %add
210 store i32 %conv, i32* %arrayidx, align 4
211 %inc = add nsw i64 %i.03, 1
212 %cmp = icmp slt i64 %inc, 5
213 br i1 %cmp, label %for.body, label %for.body4
214
215for.body4: ; preds = %for.body4, %for.body
216 %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body ]
217 %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ]
218 %sub = sub nsw i64 0, %j.02
219 %arrayidx5 = getelementptr inbounds i32* %A, i64 %sub
220 %0 = load i32* %arrayidx5, align 4
221; CHECK: da analyze - none!
222 %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
223 store i32 %0, i32* %B.addr.01, align 4
224 %inc7 = add nsw i64 %j.02, 1
225 %cmp2 = icmp slt i64 %inc7, 10
226 br i1 %cmp2, label %for.body4, label %for.end8
227
228for.end8: ; preds = %for.body4
229 ret void
230}
231
232
233;; for (long int i = 0; i <= 5; i++)
234;; A[-11*i + 45] = ...
235;; for (long int j = 0; j < 10; j++)
236;; ... = A[-j];
237
238define void @rdiv6(i32* %A, i32* %B) nounwind uwtable ssp {
239entry:
240 br label %for.body
241
242for.body: ; preds = %for.body, %entry
243 %i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
244 %conv = trunc i64 %i.03 to i32
245 %mul = mul nsw i64 %i.03, -11
246 %add = add nsw i64 %mul, 45
247 %arrayidx = getelementptr inbounds i32* %A, i64 %add
248 store i32 %conv, i32* %arrayidx, align 4
249 %inc = add nsw i64 %i.03, 1
250 %cmp = icmp slt i64 %inc, 6
251 br i1 %cmp, label %for.body, label %for.body4
252
253for.body4: ; preds = %for.body4, %for.body
254 %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body ]
255 %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ]
256 %sub = sub nsw i64 0, %j.02
257 %arrayidx5 = getelementptr inbounds i32* %A, i64 %sub
258 %0 = load i32* %arrayidx5, align 4
259; CHECK: da analyze - none!
260 %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
261 store i32 %0, i32* %B.addr.01, align 4
262 %inc7 = add nsw i64 %j.02, 1
263 %cmp2 = icmp slt i64 %inc7, 10
264 br i1 %cmp2, label %for.body4, label %for.end8
265
266for.end8: ; preds = %for.body4
267 ret void
268}
269
270
271;; for (long int i = 0; i < 5; i++)
272;; A[-11*i + 45] = ...
273;; for (long int j = 0; j <= 10; j++)
274;; ... = A[-j];
275
276define void @rdiv7(i32* %A, i32* %B) nounwind uwtable ssp {
277entry:
278 br label %for.body
279
280for.body: ; preds = %for.body, %entry
281 %i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
282 %conv = trunc i64 %i.03 to i32
283 %mul = mul nsw i64 %i.03, -11
284 %add = add nsw i64 %mul, 45
285 %arrayidx = getelementptr inbounds i32* %A, i64 %add
286 store i32 %conv, i32* %arrayidx, align 4
287 %inc = add nsw i64 %i.03, 1
288 %cmp = icmp slt i64 %inc, 5
289 br i1 %cmp, label %for.body, label %for.body4
290
291for.body4: ; preds = %for.body4, %for.body
292 %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body ]
293 %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ]
294 %sub = sub nsw i64 0, %j.02
295 %arrayidx5 = getelementptr inbounds i32* %A, i64 %sub
296 %0 = load i32* %arrayidx5, align 4
297; CHECK: da analyze - none!
298 %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
299 store i32 %0, i32* %B.addr.01, align 4
300 %inc7 = add nsw i64 %j.02, 1
301 %cmp2 = icmp slt i64 %inc7, 11
302 br i1 %cmp2, label %for.body4, label %for.end8
303
304for.end8: ; preds = %for.body4
305 ret void
306}
307
308
309;; for (long int i = 0; i <= 5; i++)
310;; A[-11*i + 45] = ...
311;; for (long int j = 0; j <= 10; j++)
312;; ... = A[-j];
313
314define void @rdiv8(i32* %A, i32* %B) nounwind uwtable ssp {
315entry:
316 br label %for.body
317
318for.body: ; preds = %for.body, %entry
319 %i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
320 %conv = trunc i64 %i.03 to i32
321 %mul = mul nsw i64 %i.03, -11
322 %add = add nsw i64 %mul, 45
323 %arrayidx = getelementptr inbounds i32* %A, i64 %add
324 store i32 %conv, i32* %arrayidx, align 4
325 %inc = add nsw i64 %i.03, 1
326 %cmp = icmp slt i64 %inc, 6
327 br i1 %cmp, label %for.body, label %for.body4
328
329for.body4: ; preds = %for.body4, %for.body
330 %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body ]
331 %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ]
332 %sub = sub nsw i64 0, %j.02
333 %arrayidx5 = getelementptr inbounds i32* %A, i64 %sub
334 %0 = load i32* %arrayidx5, align 4
335; CHECK: da analyze - flow!
336 %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
337 store i32 %0, i32* %B.addr.01, align 4
338 %inc7 = add nsw i64 %j.02, 1
339 %cmp2 = icmp slt i64 %inc7, 11
340 br i1 %cmp2, label %for.body4, label %for.end8
341
342for.end8: ; preds = %for.body4
343 ret void
344}
345
346
347;; for (long int i = 0; i < 5; i++)
348;; for (long int j = 0; j < 10; j++)
349;; A[11*i - j] = ...
350;; ... = A[45];
351
352define void @rdiv9(i32* %A, i32* %B) nounwind uwtable ssp {
353entry:
354 br label %for.cond1.preheader
355
356for.cond1.preheader: ; preds = %for.inc5, %entry
357 %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc5 ]
358 %i.03 = phi i64 [ 0, %entry ], [ %inc6, %for.inc5 ]
359 br label %for.body3
360
361for.body3: ; preds = %for.body3, %for.cond1.preheader
362 %j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ]
363 %B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ]
364 %conv = trunc i64 %i.03 to i32
365 %mul = mul nsw i64 %i.03, 11
366 %sub = sub nsw i64 %mul, %j.02
367 %arrayidx = getelementptr inbounds i32* %A, i64 %sub
368 store i32 %conv, i32* %arrayidx, align 4
369 %arrayidx4 = getelementptr inbounds i32* %A, i64 45
370 %0 = load i32* %arrayidx4, align 4
371; CHECK: da analyze - none!
372 %incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1
373 store i32 %0, i32* %B.addr.11, align 4
374 %inc = add nsw i64 %j.02, 1
375 %cmp2 = icmp slt i64 %inc, 10
376 br i1 %cmp2, label %for.body3, label %for.inc5
377
378for.inc5: ; preds = %for.body3
379 %inc6 = add nsw i64 %i.03, 1
380 %cmp = icmp slt i64 %inc6, 5
381 br i1 %cmp, label %for.cond1.preheader, label %for.end7
382
383for.end7: ; preds = %for.inc5
384 ret void
385}
386
387
388;; for (long int i = 0; i < 5; i++)
389;; for (long int j = 0; j <= 10; j++)
390;; A[11*i - j] = ...
391;; ... = A[45];
392
393define void @rdiv10(i32* %A, i32* %B) nounwind uwtable ssp {
394entry:
395 br label %for.cond1.preheader
396
397for.cond1.preheader: ; preds = %for.inc5, %entry
398 %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc5 ]
399 %i.03 = phi i64 [ 0, %entry ], [ %inc6, %for.inc5 ]
400 br label %for.body3
401
402for.body3: ; preds = %for.body3, %for.cond1.preheader
403 %j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ]
404 %B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ]
405 %conv = trunc i64 %i.03 to i32
406 %mul = mul nsw i64 %i.03, 11
407 %sub = sub nsw i64 %mul, %j.02
408 %arrayidx = getelementptr inbounds i32* %A, i64 %sub
409 store i32 %conv, i32* %arrayidx, align 4
410 %arrayidx4 = getelementptr inbounds i32* %A, i64 45
411 %0 = load i32* %arrayidx4, align 4
412; CHECK: da analyze - none!
413 %incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1
414 store i32 %0, i32* %B.addr.11, align 4
415 %inc = add nsw i64 %j.02, 1
416 %cmp2 = icmp slt i64 %inc, 10
417 br i1 %cmp2, label %for.body3, label %for.inc5
418
419for.inc5: ; preds = %for.body3
420 %inc6 = add nsw i64 %i.03, 1
421 %cmp = icmp slt i64 %inc6, 6
422 br i1 %cmp, label %for.cond1.preheader, label %for.end7
423
424for.end7: ; preds = %for.inc5
425 ret void
426}
427
428
429;; for (long int i = 0; i <= 5; i++)
430;; for (long int j = 0; j <= 10; j++)
431;; A[11*i - j] = ...
432;; ... = A[45];
433
434define void @rdiv11(i32* %A, i32* %B) nounwind uwtable ssp {
435entry:
436 br label %for.cond1.preheader
437
438for.cond1.preheader: ; preds = %for.inc5, %entry
439 %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc5 ]
440 %i.03 = phi i64 [ 0, %entry ], [ %inc6, %for.inc5 ]
441 br label %for.body3
442
443for.body3: ; preds = %for.body3, %for.cond1.preheader
444 %j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ]
445 %B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ]
446 %conv = trunc i64 %i.03 to i32
447 %mul = mul nsw i64 %i.03, 11
448 %sub = sub nsw i64 %mul, %j.02
449 %arrayidx = getelementptr inbounds i32* %A, i64 %sub
450 store i32 %conv, i32* %arrayidx, align 4
451 %arrayidx4 = getelementptr inbounds i32* %A, i64 45
452 %0 = load i32* %arrayidx4, align 4
453; CHECK: da analyze - none!
454 %incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1
455 store i32 %0, i32* %B.addr.11, align 4
456 %inc = add nsw i64 %j.02, 1
457 %cmp2 = icmp slt i64 %inc, 11
458 br i1 %cmp2, label %for.body3, label %for.inc5
459
460for.inc5: ; preds = %for.body3
461 %inc6 = add nsw i64 %i.03, 1
462 %cmp = icmp slt i64 %inc6, 5
463 br i1 %cmp, label %for.cond1.preheader, label %for.end7
464
465for.end7: ; preds = %for.inc5
466 ret void
467}
468
469
470;; for (long int i = 0; i < 5; i++)
471;; for (long int j = 0; j < 10; j++)
472;; A[11*i - j] = ...
473;; ... = A[45];
474
475define void @rdiv12(i32* %A, i32* %B) nounwind uwtable ssp {
476entry:
477 br label %for.cond1.preheader
478
479for.cond1.preheader: ; preds = %for.inc5, %entry
480 %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc5 ]
481 %i.03 = phi i64 [ 0, %entry ], [ %inc6, %for.inc5 ]
482 br label %for.body3
483
484for.body3: ; preds = %for.body3, %for.cond1.preheader
485 %j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ]
486 %B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ]
487 %conv = trunc i64 %i.03 to i32
488 %mul = mul nsw i64 %i.03, 11
489 %sub = sub nsw i64 %mul, %j.02
490 %arrayidx = getelementptr inbounds i32* %A, i64 %sub
491 store i32 %conv, i32* %arrayidx, align 4
492 %arrayidx4 = getelementptr inbounds i32* %A, i64 45
493 %0 = load i32* %arrayidx4, align 4
494; CHECK: da analyze - flow [* *|<]!
495 %incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1
496 store i32 %0, i32* %B.addr.11, align 4
497 %inc = add nsw i64 %j.02, 1
498 %cmp2 = icmp slt i64 %inc, 11
499 br i1 %cmp2, label %for.body3, label %for.inc5
500
501for.inc5: ; preds = %for.body3
502 %inc6 = add nsw i64 %i.03, 1
503 %cmp = icmp slt i64 %inc6, 6
504 br i1 %cmp, label %for.cond1.preheader, label %for.end7
505
506for.end7: ; preds = %for.inc5
507 ret void
508}