1 ; RUN: opt < %s -disable-output "-passes=print<da>" -aa-pipeline=basic-aa 2>&1 \
3 ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
5 target 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"
6 target triple = "x86_64-apple-macosx10.6.0"
9 ;; for (long int i = 0; i < 50; i++)
10 ;; for (long int j = 0; j < 50; j++)
11 ;; for (long int k = 0; k < 50; k++)
12 ;; for (long int l = 0; l < 50; l++) {
13 ;; A[n][i][j + k] = i;
14 ;; *B++ = A[10][i + 10][2*j - l];
16 define void @sep0([100 x [100 x i32]]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
18 br label %for.cond1.preheader
20 ; CHECK: da analyze - output [= * * S]!
21 ; CHECK: da analyze - flow [* * * *|<]!
22 ; CHECK: da analyze - confused!
23 ; CHECK: da analyze - input [* * S *]!
24 ; CHECK: da analyze - confused!
25 ; CHECK: da analyze - none!
27 for.cond1.preheader: ; preds = %entry, %for.inc22
28 %B.addr.08 = phi i32* [ %B, %entry ], [ %scevgep11, %for.inc22 ]
29 %i.07 = phi i64 [ 0, %entry ], [ %inc23, %for.inc22 ]
30 br label %for.cond4.preheader
32 for.cond4.preheader: ; preds = %for.cond1.preheader, %for.inc19
33 %B.addr.16 = phi i32* [ %B.addr.08, %for.cond1.preheader ], [ %scevgep9, %for.inc19 ]
34 %j.05 = phi i64 [ 0, %for.cond1.preheader ], [ %inc20, %for.inc19 ]
35 br label %for.cond7.preheader
37 for.cond7.preheader: ; preds = %for.cond4.preheader, %for.inc16
38 %B.addr.24 = phi i32* [ %B.addr.16, %for.cond4.preheader ], [ %scevgep, %for.inc16 ]
39 %k.03 = phi i64 [ 0, %for.cond4.preheader ], [ %inc17, %for.inc16 ]
42 for.body9: ; preds = %for.cond7.preheader, %for.body9
43 %l.02 = phi i64 [ 0, %for.cond7.preheader ], [ %inc, %for.body9 ]
44 %B.addr.31 = phi i32* [ %B.addr.24, %for.cond7.preheader ], [ %incdec.ptr, %for.body9 ]
45 %conv = trunc i64 %i.07 to i32
46 %add = add nsw i64 %j.05, %k.03
47 %idxprom = sext i32 %n to i64
48 %arrayidx11 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %A, i64 %idxprom, i64 %i.07, i64 %add
49 store i32 %conv, i32* %arrayidx11, align 4
50 %mul = shl nsw i64 %j.05, 1
51 %sub = sub nsw i64 %mul, %l.02
52 %add12 = add nsw i64 %i.07, 10
53 %arrayidx15 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %A, i64 10, i64 %add12, i64 %sub
54 %0 = load i32, i32* %arrayidx15, align 4
55 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.31, i64 1
56 store i32 %0, i32* %B.addr.31, align 4
57 %inc = add nsw i64 %l.02, 1
58 %exitcond = icmp ne i64 %inc, 50
59 br i1 %exitcond, label %for.body9, label %for.inc16
61 for.inc16: ; preds = %for.body9
62 %scevgep = getelementptr i32, i32* %B.addr.24, i64 50
63 %inc17 = add nsw i64 %k.03, 1
64 %exitcond10 = icmp ne i64 %inc17, 50
65 br i1 %exitcond10, label %for.cond7.preheader, label %for.inc19
67 for.inc19: ; preds = %for.inc16
68 %scevgep9 = getelementptr i32, i32* %B.addr.16, i64 2500
69 %inc20 = add nsw i64 %j.05, 1
70 %exitcond12 = icmp ne i64 %inc20, 50
71 br i1 %exitcond12, label %for.cond4.preheader, label %for.inc22
73 for.inc22: ; preds = %for.inc19
74 %scevgep11 = getelementptr i32, i32* %B.addr.08, i64 125000
75 %inc23 = add nsw i64 %i.07, 1
76 %exitcond13 = icmp ne i64 %inc23, 50
77 br i1 %exitcond13, label %for.cond1.preheader, label %for.end24
79 for.end24: ; preds = %for.inc22
84 ;; for (long int i = 0; i < 50; i++)
85 ;; for (long int j = 0; j < 50; j++)
86 ;; for (long int k = 0; k < 50; k++)
87 ;; for (long int l = 0; l < 50; l++) {
88 ;; A[i][i][j + k] = i;
89 ;; *B++ = A[10][i + 10][2*j - l];
91 define void @sep1([100 x [100 x i32]]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
93 br label %for.cond1.preheader
95 ; CHECK: da analyze - output [= * * S]!
96 ; CHECK: da analyze - flow [* * * *|<]!
97 ; CHECK: da analyze - confused!
98 ; CHECK: da analyze - input [* * S *]!
99 ; CHECK: da analyze - confused!
100 ; CHECK: da analyze - none!
102 for.cond1.preheader: ; preds = %entry, %for.inc22
103 %B.addr.08 = phi i32* [ %B, %entry ], [ %scevgep11, %for.inc22 ]
104 %i.07 = phi i64 [ 0, %entry ], [ %inc23, %for.inc22 ]
105 br label %for.cond4.preheader
107 for.cond4.preheader: ; preds = %for.cond1.preheader, %for.inc19
108 %B.addr.16 = phi i32* [ %B.addr.08, %for.cond1.preheader ], [ %scevgep9, %for.inc19 ]
109 %j.05 = phi i64 [ 0, %for.cond1.preheader ], [ %inc20, %for.inc19 ]
110 br label %for.cond7.preheader
112 for.cond7.preheader: ; preds = %for.cond4.preheader, %for.inc16
113 %B.addr.24 = phi i32* [ %B.addr.16, %for.cond4.preheader ], [ %scevgep, %for.inc16 ]
114 %k.03 = phi i64 [ 0, %for.cond4.preheader ], [ %inc17, %for.inc16 ]
117 for.body9: ; preds = %for.cond7.preheader, %for.body9
118 %l.02 = phi i64 [ 0, %for.cond7.preheader ], [ %inc, %for.body9 ]
119 %B.addr.31 = phi i32* [ %B.addr.24, %for.cond7.preheader ], [ %incdec.ptr, %for.body9 ]
120 %conv = trunc i64 %i.07 to i32
121 %add = add nsw i64 %j.05, %k.03
122 %arrayidx11 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %A, i64 %i.07, i64 %i.07, i64 %add
123 store i32 %conv, i32* %arrayidx11, align 4
124 %mul = shl nsw i64 %j.05, 1
125 %sub = sub nsw i64 %mul, %l.02
126 %add12 = add nsw i64 %i.07, 10
127 %arrayidx15 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %A, i64 10, i64 %add12, i64 %sub
128 %0 = load i32, i32* %arrayidx15, align 4
129 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.31, i64 1
130 store i32 %0, i32* %B.addr.31, align 4
131 %inc = add nsw i64 %l.02, 1
132 %exitcond = icmp ne i64 %inc, 50
133 br i1 %exitcond, label %for.body9, label %for.inc16
135 for.inc16: ; preds = %for.body9
136 %scevgep = getelementptr i32, i32* %B.addr.24, i64 50
137 %inc17 = add nsw i64 %k.03, 1
138 %exitcond10 = icmp ne i64 %inc17, 50
139 br i1 %exitcond10, label %for.cond7.preheader, label %for.inc19
141 for.inc19: ; preds = %for.inc16
142 %scevgep9 = getelementptr i32, i32* %B.addr.16, i64 2500
143 %inc20 = add nsw i64 %j.05, 1
144 %exitcond12 = icmp ne i64 %inc20, 50
145 br i1 %exitcond12, label %for.cond4.preheader, label %for.inc22
147 for.inc22: ; preds = %for.inc19
148 %scevgep11 = getelementptr i32, i32* %B.addr.08, i64 125000
149 %inc23 = add nsw i64 %i.07, 1
150 %exitcond13 = icmp ne i64 %inc23, 50
151 br i1 %exitcond13, label %for.cond1.preheader, label %for.end24
153 for.end24: ; preds = %for.inc22
158 ;; for (long int i = 0; i < 50; i++)
159 ;; for (long int j = 0; j < 50; j++)
160 ;; for (long int k = 0; k < 50; k++)
161 ;; for (long int l = 0; l < 50; l++) {
162 ;; A[i][i][i + k][l] = i;
163 ;; *B++ = A[10][i + 10][j + k][l + 10];
165 define void @sep2([100 x [100 x [100 x i32]]]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
167 br label %for.cond1.preheader
169 ; CHECK: da analyze - output [= S = =]!
170 ; CHECK: da analyze - flow [* * * <>]!
171 ; CHECK: da analyze - confused!
172 ; CHECK: da analyze - input [= * * *]!
173 ; CHECK: da analyze - confused!
174 ; CHECK: da analyze - none!
176 for.cond1.preheader: ; preds = %entry, %for.inc26
177 %B.addr.08 = phi i32* [ %B, %entry ], [ %scevgep11, %for.inc26 ]
178 %i.07 = phi i64 [ 0, %entry ], [ %inc27, %for.inc26 ]
179 br label %for.cond4.preheader
181 for.cond4.preheader: ; preds = %for.cond1.preheader, %for.inc23
182 %B.addr.16 = phi i32* [ %B.addr.08, %for.cond1.preheader ], [ %scevgep9, %for.inc23 ]
183 %j.05 = phi i64 [ 0, %for.cond1.preheader ], [ %inc24, %for.inc23 ]
184 br label %for.cond7.preheader
186 for.cond7.preheader: ; preds = %for.cond4.preheader, %for.inc20
187 %B.addr.24 = phi i32* [ %B.addr.16, %for.cond4.preheader ], [ %scevgep, %for.inc20 ]
188 %k.03 = phi i64 [ 0, %for.cond4.preheader ], [ %inc21, %for.inc20 ]
191 for.body9: ; preds = %for.cond7.preheader, %for.body9
192 %l.02 = phi i64 [ 0, %for.cond7.preheader ], [ %inc, %for.body9 ]
193 %B.addr.31 = phi i32* [ %B.addr.24, %for.cond7.preheader ], [ %incdec.ptr, %for.body9 ]
194 %conv = trunc i64 %i.07 to i32
195 %add = add nsw i64 %i.07, %k.03
196 %arrayidx12 = getelementptr inbounds [100 x [100 x [100 x i32]]], [100 x [100 x [100 x i32]]]* %A, i64 %i.07, i64 %i.07, i64 %add, i64 %l.02
197 store i32 %conv, i32* %arrayidx12, align 4
198 %add13 = add nsw i64 %l.02, 10
199 %add14 = add nsw i64 %j.05, %k.03
200 %add15 = add nsw i64 %i.07, 10
201 %arrayidx19 = getelementptr inbounds [100 x [100 x [100 x i32]]], [100 x [100 x [100 x i32]]]* %A, i64 10, i64 %add15, i64 %add14, i64 %add13
202 %0 = load i32, i32* %arrayidx19, align 4
203 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.31, i64 1
204 store i32 %0, i32* %B.addr.31, align 4
205 %inc = add nsw i64 %l.02, 1
206 %exitcond = icmp ne i64 %inc, 50
207 br i1 %exitcond, label %for.body9, label %for.inc20
209 for.inc20: ; preds = %for.body9
210 %scevgep = getelementptr i32, i32* %B.addr.24, i64 50
211 %inc21 = add nsw i64 %k.03, 1
212 %exitcond10 = icmp ne i64 %inc21, 50
213 br i1 %exitcond10, label %for.cond7.preheader, label %for.inc23
215 for.inc23: ; preds = %for.inc20
216 %scevgep9 = getelementptr i32, i32* %B.addr.16, i64 2500
217 %inc24 = add nsw i64 %j.05, 1
218 %exitcond12 = icmp ne i64 %inc24, 50
219 br i1 %exitcond12, label %for.cond4.preheader, label %for.inc26
221 for.inc26: ; preds = %for.inc23
222 %scevgep11 = getelementptr i32, i32* %B.addr.08, i64 125000
223 %inc27 = add nsw i64 %i.07, 1
224 %exitcond13 = icmp ne i64 %inc27, 50
225 br i1 %exitcond13, label %for.cond1.preheader, label %for.end28
227 for.end28: ; preds = %for.inc26
232 ;; for (long int i = 0; i < 50; i++)
233 ;; for (long int j = 0; j < 50; j++)
234 ;; for (long int k = 0; k < 50; k++)
235 ;; for (long int l = 0; l < 50; l++) {
236 ;; A[i][i][i + k][l + k] = i;
237 ;; *B++ = A[10][i + 10][j + k][l + 10];
239 define void @sep3([100 x [100 x [100 x i32]]]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
241 br label %for.cond1.preheader
243 ; CHECK: da analyze - output [= S = =]!
244 ; CHECK: da analyze - flow [* * * *|<]!
245 ; CHECK: da analyze - confused!
246 ; CHECK: da analyze - input [= * * *]!
247 ; CHECK: da analyze - confused!
248 ; CHECK: da analyze - none!
250 for.cond1.preheader: ; preds = %entry, %for.inc27
251 %B.addr.08 = phi i32* [ %B, %entry ], [ %scevgep11, %for.inc27 ]
252 %i.07 = phi i64 [ 0, %entry ], [ %inc28, %for.inc27 ]
253 br label %for.cond4.preheader
255 for.cond4.preheader: ; preds = %for.cond1.preheader, %for.inc24
256 %B.addr.16 = phi i32* [ %B.addr.08, %for.cond1.preheader ], [ %scevgep9, %for.inc24 ]
257 %j.05 = phi i64 [ 0, %for.cond1.preheader ], [ %inc25, %for.inc24 ]
258 br label %for.cond7.preheader
260 for.cond7.preheader: ; preds = %for.cond4.preheader, %for.inc21
261 %B.addr.24 = phi i32* [ %B.addr.16, %for.cond4.preheader ], [ %scevgep, %for.inc21 ]
262 %k.03 = phi i64 [ 0, %for.cond4.preheader ], [ %inc22, %for.inc21 ]
265 for.body9: ; preds = %for.cond7.preheader, %for.body9
266 %l.02 = phi i64 [ 0, %for.cond7.preheader ], [ %inc, %for.body9 ]
267 %B.addr.31 = phi i32* [ %B.addr.24, %for.cond7.preheader ], [ %incdec.ptr, %for.body9 ]
268 %conv = trunc i64 %i.07 to i32
269 %add = add nsw i64 %l.02, %k.03
270 %add10 = add nsw i64 %i.07, %k.03
271 %arrayidx13 = getelementptr inbounds [100 x [100 x [100 x i32]]], [100 x [100 x [100 x i32]]]* %A, i64 %i.07, i64 %i.07, i64 %add10, i64 %add
272 store i32 %conv, i32* %arrayidx13, align 4
273 %add14 = add nsw i64 %l.02, 10
274 %add15 = add nsw i64 %j.05, %k.03
275 %add16 = add nsw i64 %i.07, 10
276 %arrayidx20 = getelementptr inbounds [100 x [100 x [100 x i32]]], [100 x [100 x [100 x i32]]]* %A, i64 10, i64 %add16, i64 %add15, i64 %add14
277 %0 = load i32, i32* %arrayidx20, align 4
278 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.31, i64 1
279 store i32 %0, i32* %B.addr.31, align 4
280 %inc = add nsw i64 %l.02, 1
281 %exitcond = icmp ne i64 %inc, 50
282 br i1 %exitcond, label %for.body9, label %for.inc21
284 for.inc21: ; preds = %for.body9
285 %scevgep = getelementptr i32, i32* %B.addr.24, i64 50
286 %inc22 = add nsw i64 %k.03, 1
287 %exitcond10 = icmp ne i64 %inc22, 50
288 br i1 %exitcond10, label %for.cond7.preheader, label %for.inc24
290 for.inc24: ; preds = %for.inc21
291 %scevgep9 = getelementptr i32, i32* %B.addr.16, i64 2500
292 %inc25 = add nsw i64 %j.05, 1
293 %exitcond12 = icmp ne i64 %inc25, 50
294 br i1 %exitcond12, label %for.cond4.preheader, label %for.inc27
296 for.inc27: ; preds = %for.inc24
297 %scevgep11 = getelementptr i32, i32* %B.addr.08, i64 125000
298 %inc28 = add nsw i64 %i.07, 1
299 %exitcond13 = icmp ne i64 %inc28, 50
300 br i1 %exitcond13, label %for.cond1.preheader, label %for.end29
302 for.end29: ; preds = %for.inc27