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