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