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