1; RUN: opt < %s -disable-output "-passes=print<da>" -aa-pipeline=basic-aa 2>&1 \
2; RUN: | FileCheck %s
3; RUN: opt < %s -analyze -enable-new-pm=0 -basic-aa -da | FileCheck %s
4
5target 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"
6target triple = "x86_64-apple-macosx10.6.0"
7
8
9;;  for (long int i = 0; i < 50; i++) {
10;;    A[i][i] = i;
11;;    *B++ = A[i + 10][i + 9];
12
13define void @couple0([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
14entry:
15  br label %for.body
16
17; CHECK-LABEL: couple0
18; CHECK: da analyze - none!
19; CHECK: da analyze - none!
20; CHECK: da analyze - confused!
21; CHECK: da analyze - none!
22; CHECK: da analyze - confused!
23; CHECK: da analyze - none!
24
25for.body:                                         ; preds = %entry, %for.body
26  %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
27  %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
28  %conv = trunc i64 %i.02 to i32
29  %arrayidx1 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %i.02, i64 %i.02
30  store i32 %conv, i32* %arrayidx1, align 4
31  %add = add nsw i64 %i.02, 9
32  %add2 = add nsw i64 %i.02, 10
33  %arrayidx4 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %add2, i64 %add
34  %0 = load i32, i32* %arrayidx4, align 4
35  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
36  store i32 %0, i32* %B.addr.01, align 4
37  %inc = add nsw i64 %i.02, 1
38  %exitcond = icmp ne i64 %inc, 50
39  br i1 %exitcond, label %for.body, label %for.end
40
41for.end:                                          ; preds = %for.body
42  ret void
43}
44
45
46;;  for (long int i = 0; i < 50; i++) {
47;;    A[i][i] = i;
48;;    *B++ = A[i + 9][i + 9];
49
50define void @couple1([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
51entry:
52  br label %for.body
53
54; CHECK-LABEL: couple1
55; CHECK: da analyze - none!
56; CHECK: da analyze - consistent flow [-9]!
57; CHECK: da analyze - confused!
58; CHECK: da analyze - none!
59; CHECK: da analyze - confused!
60; CHECK: da analyze - none!
61
62for.body:                                         ; preds = %entry, %for.body
63  %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
64  %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
65  %conv = trunc i64 %i.02 to i32
66  %arrayidx1 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %i.02, i64 %i.02
67  store i32 %conv, i32* %arrayidx1, align 4
68  %add = add nsw i64 %i.02, 9
69  %add2 = add nsw i64 %i.02, 9
70  %arrayidx4 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %add2, i64 %add
71  %0 = load i32, i32* %arrayidx4, 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 nsw i64 %i.02, 1
75  %exitcond = icmp ne i64 %inc, 50
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 int i = 0; i < 50; i++) {
84;;    A[3*i - 6][3*i - 6] = i;
85;;    *B++ = A[i][i];
86
87define void @couple2([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
88entry:
89  br label %for.body
90
91; CHECK-LABEL: couple2
92; CHECK: da analyze - none!
93; CHECK: da analyze - flow [*|<]!
94; CHECK: da analyze - confused!
95; CHECK: da analyze - none!
96; CHECK: da analyze - confused!
97; CHECK: da analyze - none!
98
99for.body:                                         ; preds = %entry, %for.body
100  %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
101  %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
102  %conv = trunc i64 %i.02 to i32
103  %mul = mul nsw i64 %i.02, 3
104  %sub = add nsw i64 %mul, -6
105  %mul1 = mul nsw i64 %i.02, 3
106  %sub2 = add nsw i64 %mul1, -6
107  %arrayidx3 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %sub2, i64 %sub
108  store i32 %conv, i32* %arrayidx3, align 4
109  %arrayidx5 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %i.02, i64 %i.02
110  %0 = load i32, i32* %arrayidx5, align 4
111  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
112  store i32 %0, i32* %B.addr.01, align 4
113  %inc = add nsw i64 %i.02, 1
114  %exitcond = icmp ne i64 %inc, 50
115  br i1 %exitcond, label %for.body, label %for.end
116
117for.end:                                          ; preds = %for.body
118  ret void
119}
120
121
122;;  for (long int i = 0; i < 50; i++) {
123;;    A[3*i - 6][3*i - 5] = i;
124;;    *B++ = A[i][i];
125
126define void @couple3([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
127entry:
128  br label %for.body
129
130; CHECK-LABEL: couple3
131; CHECK: da analyze - none!
132; CHECK: da analyze - none!
133; CHECK: da analyze - confused!
134; CHECK: da analyze - none!
135; CHECK: da analyze - confused!
136; CHECK: da analyze - none!
137
138for.body:                                         ; preds = %entry, %for.body
139  %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
140  %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
141  %conv = trunc i64 %i.02 to i32
142  %mul = mul nsw i64 %i.02, 3
143  %sub = add nsw i64 %mul, -5
144  %mul1 = mul nsw i64 %i.02, 3
145  %sub2 = add nsw i64 %mul1, -6
146  %arrayidx3 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %sub2, i64 %sub
147  store i32 %conv, i32* %arrayidx3, align 4
148  %arrayidx5 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %i.02, i64 %i.02
149  %0 = load i32, i32* %arrayidx5, align 4
150  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
151  store i32 %0, i32* %B.addr.01, align 4
152  %inc = add nsw i64 %i.02, 1
153  %exitcond = icmp ne i64 %inc, 50
154  br i1 %exitcond, label %for.body, label %for.end
155
156for.end:                                          ; preds = %for.body
157  ret void
158}
159
160
161;;  for (long int i = 0; i < 50; i++) {
162;;    A[3*i - 6][3*i - n] = i;
163;;    *B++ = A[i][i];
164
165define void @couple4([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
166entry:
167  br label %for.body
168
169; CHECK-LABEL: couple4
170; CHECK: da analyze - none!
171; CHECK: da analyze - flow [*|<]!
172; CHECK: da analyze - confused!
173; CHECK: da analyze - none!
174; CHECK: da analyze - confused!
175; CHECK: da analyze - none!
176
177for.body:                                         ; preds = %entry, %for.body
178  %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
179  %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
180  %conv = trunc i64 %i.02 to i32
181  %mul = mul nsw i64 %i.02, 3
182  %conv1 = sext i32 %n to i64
183  %sub = sub nsw i64 %mul, %conv1
184  %mul2 = mul nsw i64 %i.02, 3
185  %sub3 = add nsw i64 %mul2, -6
186  %arrayidx4 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %sub3, i64 %sub
187  store i32 %conv, i32* %arrayidx4, align 4
188  %arrayidx6 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %i.02, i64 %i.02
189  %0 = load i32, i32* %arrayidx6, align 4
190  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
191  store i32 %0, i32* %B.addr.01, align 4
192  %inc = add nsw i64 %i.02, 1
193  %exitcond = icmp ne i64 %inc, 50
194  br i1 %exitcond, label %for.body, label %for.end
195
196for.end:                                          ; preds = %for.body
197  ret void
198}
199
200
201;;  for (long int i = 0; i < 50; i++) {
202;;    A[3*i - n + 1][3*i - n] = i;
203;;    *B++ = A[i][i];
204
205define void @couple5([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
206entry:
207  br label %for.body
208
209; CHECK-LABEL: couple5
210; CHECK: da analyze - none!
211; CHECK: da analyze - none!
212; CHECK: da analyze - confused!
213; CHECK: da analyze - none!
214; CHECK: da analyze - confused!
215; CHECK: da analyze - none!
216
217for.body:                                         ; preds = %entry, %for.body
218  %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
219  %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
220  %conv = trunc i64 %i.02 to i32
221  %mul = mul nsw i64 %i.02, 3
222  %conv1 = sext i32 %n to i64
223  %sub = sub nsw i64 %mul, %conv1
224  %mul2 = mul nsw i64 %i.02, 3
225  %conv3 = sext i32 %n to i64
226  %sub4 = sub nsw i64 %mul2, %conv3
227  %add = add nsw i64 %sub4, 1
228  %arrayidx5 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %add, i64 %sub
229  store i32 %conv, i32* %arrayidx5, align 4
230  %arrayidx7 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %i.02, i64 %i.02
231  %0 = load i32, i32* %arrayidx7, align 4
232  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
233  store i32 %0, i32* %B.addr.01, align 4
234  %inc = add nsw i64 %i.02, 1
235  %exitcond = icmp ne i64 %inc, 50
236  br i1 %exitcond, label %for.body, label %for.end
237
238for.end:                                          ; preds = %for.body
239  ret void
240}
241
242
243;;  for (long int i = 0; i < 50; i++) {
244;;    A[i][3*i - 6] = i;
245;;    *B++ = A[i][i];
246
247define void @couple6([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
248entry:
249  br label %for.body
250
251; CHECK-LABEL: couple6
252; CHECK: da analyze - none!
253; CHECK: da analyze - flow [=|<]!
254; CHECK: da analyze - confused!
255; CHECK: da analyze - none!
256; CHECK: da analyze - confused!
257; CHECK: da analyze - none!
258
259for.body:                                         ; preds = %entry, %for.body
260  %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
261  %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
262  %conv = trunc i64 %i.02 to i32
263  %mul = mul nsw i64 %i.02, 3
264  %sub = add nsw i64 %mul, -6
265  %arrayidx1 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %i.02, i64 %sub
266  store i32 %conv, i32* %arrayidx1, align 4
267  %arrayidx3 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %i.02, i64 %i.02
268  %0 = load i32, i32* %arrayidx3, align 4
269  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
270  store i32 %0, i32* %B.addr.01, align 4
271  %inc = add nsw i64 %i.02, 1
272  %exitcond = icmp ne i64 %inc, 50
273  br i1 %exitcond, label %for.body, label %for.end
274
275for.end:                                          ; preds = %for.body
276  ret void
277}
278
279
280;;  for (long int i = 0; i < 50; i++) {
281;;    A[i][3*i - 5] = i;
282;;    *B++ = A[i][i];
283
284define void @couple7([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
285entry:
286  br label %for.body
287
288; CHECK-LABEL: couple7
289; CHECK: da analyze - none!
290; CHECK: da analyze - none!
291; CHECK: da analyze - confused!
292; CHECK: da analyze - none!
293; CHECK: da analyze - confused!
294; CHECK: da analyze - none!
295
296for.body:                                         ; preds = %entry, %for.body
297  %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
298  %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
299  %conv = trunc i64 %i.02 to i32
300  %mul = mul nsw i64 %i.02, 3
301  %sub = add nsw i64 %mul, -5
302  %arrayidx1 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %i.02, i64 %sub
303  store i32 %conv, i32* %arrayidx1, align 4
304  %arrayidx3 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %i.02, i64 %i.02
305  %0 = load i32, i32* %arrayidx3, align 4
306  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
307  store i32 %0, i32* %B.addr.01, align 4
308  %inc = add nsw i64 %i.02, 1
309  %exitcond = icmp ne i64 %inc, 50
310  br i1 %exitcond, label %for.body, label %for.end
311
312for.end:                                          ; preds = %for.body
313  ret void
314}
315
316
317;;  for (long int i = 0; i <= 15; i++) {
318;;    A[3*i - 18][3 - i] = i;
319;;    *B++ = A[i][i];
320
321define void @couple8([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
322entry:
323  br label %for.body
324
325; CHECK-LABEL: couple8
326; CHECK: da analyze - none!
327; CHECK: da analyze - none!
328; CHECK: da analyze - confused!
329; CHECK: da analyze - none!
330; CHECK: da analyze - confused!
331; CHECK: da analyze - none!
332
333for.body:                                         ; preds = %entry, %for.body
334  %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
335  %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
336  %conv = trunc i64 %i.02 to i32
337  %sub = sub nsw i64 3, %i.02
338  %mul = mul nsw i64 %i.02, 3
339  %sub1 = add nsw i64 %mul, -18
340  %arrayidx2 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %sub1, i64 %sub
341  store i32 %conv, i32* %arrayidx2, align 4
342  %arrayidx4 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %i.02, i64 %i.02
343  %0 = load i32, i32* %arrayidx4, align 4
344  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
345  store i32 %0, i32* %B.addr.01, align 4
346  %inc = add nsw i64 %i.02, 1
347  %exitcond = icmp ne i64 %inc, 16
348  br i1 %exitcond, label %for.body, label %for.end
349
350for.end:                                          ; preds = %for.body
351  ret void
352}
353
354
355;;  for (long int i = 0; i <= 15; i++) {
356;;    A[3*i - 18][2 - i] = i;
357;;    *B++ = A[i][i];
358
359define void @couple9([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
360entry:
361  br label %for.body
362
363; CHECK-LABEL: couple9
364; CHECK: da analyze - none!
365; CHECK: da analyze - none!
366; CHECK: da analyze - confused!
367; CHECK: da analyze - none!
368; CHECK: da analyze - confused!
369; CHECK: da analyze - none!
370
371for.body:                                         ; preds = %entry, %for.body
372  %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
373  %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
374  %conv = trunc i64 %i.02 to i32
375  %sub = sub nsw i64 2, %i.02
376  %mul = mul nsw i64 %i.02, 3
377  %sub1 = add nsw i64 %mul, -18
378  %arrayidx2 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %sub1, i64 %sub
379  store i32 %conv, i32* %arrayidx2, align 4
380  %arrayidx4 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %i.02, i64 %i.02
381  %0 = load i32, i32* %arrayidx4, align 4
382  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
383  store i32 %0, i32* %B.addr.01, align 4
384  %inc = add nsw i64 %i.02, 1
385  %exitcond = icmp ne i64 %inc, 16
386  br i1 %exitcond, label %for.body, label %for.end
387
388for.end:                                          ; preds = %for.body
389  ret void
390}
391
392
393;;  for (long int i = 0; i <= 15; i++) {
394;;    A[3*i - 18][6 - i] = i;
395;;    *B++ = A[i][i];
396
397define void @couple10([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
398entry:
399  br label %for.body
400
401; CHECK-LABEL: couple10
402; CHECK: da analyze - none!
403; CHECK: da analyze - flow [>]!
404; CHECK: da analyze - confused!
405; CHECK: da analyze - none!
406; CHECK: da analyze - confused!
407; CHECK: da analyze - none!
408
409for.body:                                         ; preds = %entry, %for.body
410  %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
411  %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
412  %conv = trunc i64 %i.02 to i32
413  %sub = sub nsw i64 6, %i.02
414  %mul = mul nsw i64 %i.02, 3
415  %sub1 = add nsw i64 %mul, -18
416  %arrayidx2 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %sub1, i64 %sub
417  store i32 %conv, i32* %arrayidx2, align 4
418  %arrayidx4 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %i.02, i64 %i.02
419  %0 = load i32, i32* %arrayidx4, align 4
420  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
421  store i32 %0, i32* %B.addr.01, align 4
422  %inc = add nsw i64 %i.02, 1
423  %exitcond = icmp ne i64 %inc, 16
424  br i1 %exitcond, label %for.body, label %for.end
425
426for.end:                                          ; preds = %for.body
427  ret void
428}
429
430
431;;  for (long int i = 0; i <= 15; i++) {
432;;    A[3*i - 18][18 - i] = i;
433;;    *B++ = A[i][i];
434
435define void @couple11([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
436entry:
437  br label %for.body
438
439; CHECK-LABEL: couple11
440; CHECK: da analyze - none!
441; CHECK: da analyze - flow [=|<] splitable!
442; CHECK: da analyze - split level = 1, iteration = 9!
443; CHECK: da analyze - confused!
444; CHECK: da analyze - none!
445; CHECK: da analyze - confused!
446; CHECK: da analyze - none!
447
448for.body:                                         ; preds = %entry, %for.body
449  %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
450  %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
451  %conv = trunc i64 %i.02 to i32
452  %sub = sub nsw i64 18, %i.02
453  %mul = mul nsw i64 %i.02, 3
454  %sub1 = add nsw i64 %mul, -18
455  %arrayidx2 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %sub1, i64 %sub
456  store i32 %conv, i32* %arrayidx2, align 4
457  %arrayidx4 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %i.02, i64 %i.02
458  %0 = load i32, i32* %arrayidx4, align 4
459  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
460  store i32 %0, i32* %B.addr.01, align 4
461  %inc = add nsw i64 %i.02, 1
462  %exitcond = icmp ne i64 %inc, 16
463  br i1 %exitcond, label %for.body, label %for.end
464
465for.end:                                          ; preds = %for.body
466  ret void
467}
468
469
470;;  for (long int i = 0; i <= 12; i++) {
471;;    A[3*i - 18][22 - i] = i;
472;;    *B++ = A[i][i];
473
474define void @couple12([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
475entry:
476  br label %for.body
477
478; CHECK-LABEL: couple12
479; CHECK: da analyze - none!
480; CHECK: da analyze - flow [<] splitable!
481; CHECK: da analyze - split level = 1, iteration = 11!
482; CHECK: da analyze - confused!
483; CHECK: da analyze - none!
484; CHECK: da analyze - confused!
485; CHECK: da analyze - none!
486
487for.body:                                         ; preds = %entry, %for.body
488  %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
489  %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
490  %conv = trunc i64 %i.02 to i32
491  %sub = sub nsw i64 22, %i.02
492  %mul = mul nsw i64 %i.02, 3
493  %sub1 = add nsw i64 %mul, -18
494  %arrayidx2 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %sub1, i64 %sub
495  store i32 %conv, i32* %arrayidx2, align 4
496  %arrayidx4 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %i.02, i64 %i.02
497  %0 = load i32, i32* %arrayidx4, align 4
498  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
499  store i32 %0, i32* %B.addr.01, align 4
500  %inc = add nsw i64 %i.02, 1
501  %exitcond = icmp ne i64 %inc, 13
502  br i1 %exitcond, label %for.body, label %for.end
503
504for.end:                                          ; preds = %for.body
505  ret void
506}
507
508
509;;  for (long int i = 0; i < 12; i++) {
510;;    A[3*i - 18][22 - i] = i;
511;;    *B++ = A[i][i];
512
513define void @couple13([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
514entry:
515  br label %for.body
516
517; CHECK-LABEL: couple13
518; CHECK: da analyze - none!
519; CHECK: da analyze - none!
520; CHECK: da analyze - confused!
521; CHECK: da analyze - none!
522; CHECK: da analyze - confused!
523; CHECK: da analyze - none!
524
525for.body:                                         ; preds = %entry, %for.body
526  %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
527  %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
528  %conv = trunc i64 %i.02 to i32
529  %sub = sub nsw i64 22, %i.02
530  %mul = mul nsw i64 %i.02, 3
531  %sub1 = add nsw i64 %mul, -18
532  %arrayidx2 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %sub1, i64 %sub
533  store i32 %conv, i32* %arrayidx2, align 4
534  %arrayidx4 = getelementptr inbounds [100 x i32], [100 x i32]* %A, i64 %i.02, i64 %i.02
535  %0 = load i32, i32* %arrayidx4, align 4
536  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
537  store i32 %0, i32* %B.addr.01, align 4
538  %inc = add nsw i64 %i.02, 1
539  %exitcond = icmp ne i64 %inc, 12
540  br i1 %exitcond, label %for.body, label %for.end
541
542for.end:                                          ; preds = %for.body
543  ret void
544}
545
546;;  for (long int i = 0; i < 100; i++) {
547;;    A[3*i - 18][18 - i][i] = i;
548;;    *B++ = A[i][i][i];
549
550define void @couple14([100 x [100 x i32]]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
551entry:
552  br label %for.body
553
554; CHECK-LABEL: couple14
555; CHECK: da analyze - none!
556; CHECK: da analyze - flow [=|<]!
557; CHECK: da analyze - confused!
558; CHECK: da analyze - none!
559; CHECK: da analyze - confused!
560; CHECK: da analyze - none!
561
562for.body:                                         ; preds = %entry, %for.body
563  %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
564  %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
565  %conv = trunc i64 %i.02 to i32
566  %sub = sub nsw i64 18, %i.02
567  %mul = mul nsw i64 %i.02, 3
568  %sub1 = add nsw i64 %mul, -18
569  %arrayidx3 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %A, i64 %sub1, i64 %sub, i64 %i.02
570  store i32 %conv, i32* %arrayidx3, align 4
571  %arrayidx6 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %A, i64 %i.02, i64 %i.02, i64 %i.02
572  %0 = load i32, i32* %arrayidx6, align 4
573  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
574  store i32 %0, i32* %B.addr.01, align 4
575  %inc = add nsw i64 %i.02, 1
576  %exitcond = icmp ne i64 %inc, 100
577  br i1 %exitcond, label %for.body, label %for.end
578
579for.end:                                          ; preds = %for.body
580  ret void
581}
582
583
584;;  for (long int i = 0; i < 100; i++) {
585;;    A[3*i - 18][22 - i][i] = i;
586;;    *B++ = A[i][i][i];
587
588define void @couple15([100 x [100 x i32]]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
589entry:
590  br label %for.body
591
592; CHECK-LABEL: couple15
593; CHECK: da analyze - none!
594; CHECK: da analyze - none!
595; CHECK: da analyze - confused!
596; CHECK: da analyze - none!
597; CHECK: da analyze - confused!
598; CHECK: da analyze - none!
599
600for.body:                                         ; preds = %entry, %for.body
601  %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
602  %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
603  %conv = trunc i64 %i.02 to i32
604  %sub = sub nsw i64 22, %i.02
605  %mul = mul nsw i64 %i.02, 3
606  %sub1 = add nsw i64 %mul, -18
607  %arrayidx3 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %A, i64 %sub1, i64 %sub, i64 %i.02
608  store i32 %conv, i32* %arrayidx3, align 4
609  %arrayidx6 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %A, i64 %i.02, i64 %i.02, i64 %i.02
610  %0 = load i32, i32* %arrayidx6, align 4
611  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
612  store i32 %0, i32* %B.addr.01, align 4
613  %inc = add nsw i64 %i.02, 1
614  %exitcond = icmp ne i64 %inc, 100
615  br i1 %exitcond, label %for.body, label %for.end
616
617for.end:                                          ; preds = %for.body
618  ret void
619}
620
621;;  for(int i = 0; i < N; i+=1) {
622;;    A[M*N*i] = 1;
623;;    for(int j = 0; j < M; j+=1)
624;;      A[M*N + M*i + j] = 2;
625
626define void @couple_weakzerosiv(i32* noalias nocapture %A, i64 %N, i64 %M) {
627entry:
628  %cmp29 = icmp sgt i64 %N, 0
629  br i1 %cmp29, label %for.body.lr.ph, label %for.cond.cleanup
630
631; CHECK-LABEL: couple_weakzerosiv
632; CHECK: da analyze - none!
633; CHECK: da analyze - output [p>]!
634; CHECK: da analyze - none!
635
636for.body.lr.ph:                                   ; preds = %entry
637  %mul = mul nsw i64 %M, %N
638  br label %for.body.us
639
640for.body.us:                                      ; preds = %for.body.lr.ph, %for.cond.cleanup4.loopexit.us
641  %i.030.us = phi i64 [ %add12.us, %for.cond.cleanup4.loopexit.us ], [ 0, %for.body.lr.ph ]
642  %mul1.us = mul nsw i64 %i.030.us, %mul
643  %arrayidx.us = getelementptr inbounds i32, i32* %A, i64 %mul1.us
644  store i32 1, i32* %arrayidx.us, align 4
645  %mul6.us = mul nsw i64 %i.030.us, %M
646  %add.us = add i64 %mul6.us, %mul
647  br label %for.body5.us
648
649for.body5.us:                                     ; preds = %for.body5.us, %for.body.us
650  %j.028.us = phi i64 [ 0, %for.body.us ], [ %add10.us, %for.body5.us ]
651  %add8.us = add i64 %add.us, %j.028.us
652  %arrayidx9.us = getelementptr inbounds i32, i32* %A, i64 %add8.us
653  store i32 2, i32* %arrayidx9.us, align 4
654  %add10.us = add nuw nsw i64 %j.028.us, 1
655  %exitcond.us = icmp eq i64 %add10.us, %M
656  br i1 %exitcond.us, label %for.cond.cleanup4.loopexit.us, label %for.body5.us
657
658for.cond.cleanup4.loopexit.us:                    ; preds = %for.body5.us
659  %add12.us = add nuw nsw i64 %i.030.us, 1
660  %exitcond31.us = icmp eq i64 %add12.us, %N
661  br i1 %exitcond31.us, label %for.cond.cleanup, label %for.body.us
662
663for.cond.cleanup:                                 ; preds = %for.cond.cleanup4.loopexit.us, %entry
664  ret void
665}
666