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 ; ModuleID = 'SymbolicRDIV.bc'
6 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"
7 target triple = "x86_64-apple-macosx10.6.0"
10 ;; for (long int i = 0; i < n1; i++)
12 ;; for (long int j = 0; j < n2; j++)
13 ;; *B++ = A[3*j + 3*n1];
15 define void @symbolicrdiv0(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
17 %cmp4 = icmp eq i64 %n1, 0
18 br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader
20 ; CHECK: 'Dependence Analysis' for function 'symbolicrdiv0'
21 ; CHECK: da analyze - none!
22 ; CHECK: da analyze - none!
23 ; CHECK: da analyze - confused!
24 ; CHECK: da analyze - none!
25 ; CHECK: da analyze - confused!
26 ; CHECK: da analyze - none!
28 for.body.preheader: ; preds = %entry
31 for.cond1.preheader.loopexit: ; preds = %for.body
32 br label %for.cond1.preheader
34 for.cond1.preheader: ; preds = %for.cond1.preheader.loopexit, %entry
35 %cmp21 = icmp eq i64 %n2, 0
36 br i1 %cmp21, label %for.end11, label %for.body4.preheader
38 for.body4.preheader: ; preds = %for.cond1.preheader
41 for.body: ; preds = %for.body.preheader, %for.body
42 %i.05 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
43 %conv = trunc i64 %i.05 to i32
44 %mul = shl nsw i64 %i.05, 1
45 %add = add i64 %mul, %n1
46 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
47 store i32 %conv, i32* %arrayidx, align 4
48 %inc = add nsw i64 %i.05, 1
49 %exitcond = icmp ne i64 %inc, %n1
50 br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit
52 for.body4: ; preds = %for.body4.preheader, %for.body4
53 %j.03 = phi i64 [ %inc10, %for.body4 ], [ 0, %for.body4.preheader ]
54 %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
55 %mul56 = add i64 %j.03, %n1
56 %add7 = mul i64 %mul56, 3
57 %arrayidx8 = getelementptr inbounds i32, i32* %A, i64 %add7
58 %0 = load i32, i32* %arrayidx8, align 4
59 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
60 store i32 %0, i32* %B.addr.02, align 4
61 %inc10 = add nsw i64 %j.03, 1
62 %exitcond7 = icmp ne i64 %inc10, %n2
63 br i1 %exitcond7, label %for.body4, label %for.end11.loopexit
65 for.end11.loopexit: ; preds = %for.body4
68 for.end11: ; preds = %for.end11.loopexit, %for.cond1.preheader
73 ;; for (long int i = 0; i < n1; i++)
75 ;; for (long int j = 0; j < n2; j++)
76 ;; *B++ = A[3*j + 2*n2];
78 define void @symbolicrdiv1(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
80 %cmp4 = icmp eq i64 %n1, 0
81 br i1 %cmp4, label %for.cond2.preheader, label %for.body.preheader
83 ; CHECK: 'Dependence Analysis' for function 'symbolicrdiv1'
84 ; CHECK: da analyze - none!
85 ; CHECK: da analyze - none!
86 ; CHECK: da analyze - confused!
87 ; CHECK: da analyze - none!
88 ; CHECK: da analyze - confused!
89 ; CHECK: da analyze - none!
91 for.body.preheader: ; preds = %entry
94 for.cond2.preheader.loopexit: ; preds = %for.body
95 br label %for.cond2.preheader
97 for.cond2.preheader: ; preds = %for.cond2.preheader.loopexit, %entry
98 %cmp31 = icmp eq i64 %n2, 0
99 br i1 %cmp31, label %for.end12, label %for.body5.preheader
101 for.body5.preheader: ; preds = %for.cond2.preheader
104 for.body: ; preds = %for.body.preheader, %for.body
105 %i.05 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
106 %conv = trunc i64 %i.05 to i32
107 %mul = shl nsw i64 %i.05, 1
108 %mul1 = mul i64 %n2, 5
109 %add = add i64 %mul, %mul1
110 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
111 store i32 %conv, i32* %arrayidx, align 4
112 %inc = add nsw i64 %i.05, 1
113 %exitcond = icmp ne i64 %inc, %n1
114 br i1 %exitcond, label %for.body, label %for.cond2.preheader.loopexit
116 for.body5: ; preds = %for.body5.preheader, %for.body5
117 %j.03 = phi i64 [ %inc11, %for.body5 ], [ 0, %for.body5.preheader ]
118 %B.addr.02 = phi i32* [ %incdec.ptr, %for.body5 ], [ %B, %for.body5.preheader ]
119 %mul6 = mul nsw i64 %j.03, 3
120 %mul7 = shl i64 %n2, 1
121 %add8 = add i64 %mul6, %mul7
122 %arrayidx9 = getelementptr inbounds i32, i32* %A, i64 %add8
123 %0 = load i32, i32* %arrayidx9, align 4
124 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
125 store i32 %0, i32* %B.addr.02, align 4
126 %inc11 = add nsw i64 %j.03, 1
127 %exitcond6 = icmp ne i64 %inc11, %n2
128 br i1 %exitcond6, label %for.body5, label %for.end12.loopexit
130 for.end12.loopexit: ; preds = %for.body5
133 for.end12: ; preds = %for.end12.loopexit, %for.cond2.preheader
138 ;; for (long int i = 0; i < n1; i++)
140 ;; for (long int j = 0; j < n2; j++)
141 ;; *B++ = A[-j + 2*n1];
143 define void @symbolicrdiv2(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
145 %cmp4 = icmp eq i64 %n1, 0
146 br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader
148 ; CHECK: 'Dependence Analysis' for function 'symbolicrdiv2'
149 ; CHECK: da analyze - none!
150 ; CHECK: da analyze - none!
151 ; CHECK: da analyze - confused!
152 ; CHECK: da analyze - none!
153 ; CHECK: da analyze - confused!
154 ; CHECK: da analyze - none!
156 for.body.preheader: ; preds = %entry
159 for.cond1.preheader.loopexit: ; preds = %for.body
160 br label %for.cond1.preheader
162 for.cond1.preheader: ; preds = %for.cond1.preheader.loopexit, %entry
163 %cmp21 = icmp eq i64 %n2, 0
164 br i1 %cmp21, label %for.end10, label %for.body4.preheader
166 for.body4.preheader: ; preds = %for.cond1.preheader
169 for.body: ; preds = %for.body.preheader, %for.body
170 %i.05 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
171 %conv = trunc i64 %i.05 to i32
172 %mul = shl nsw i64 %i.05, 1
173 %sub = sub i64 %mul, %n2
174 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %sub
175 store i32 %conv, i32* %arrayidx, align 4
176 %inc = add nsw i64 %i.05, 1
177 %exitcond = icmp ne i64 %inc, %n1
178 br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit
180 for.body4: ; preds = %for.body4.preheader, %for.body4
181 %j.03 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.body4.preheader ]
182 %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
183 %mul6 = shl i64 %n1, 1
184 %add = sub i64 %mul6, %j.03
185 %arrayidx7 = getelementptr inbounds i32, i32* %A, i64 %add
186 %0 = load i32, i32* %arrayidx7, align 4
187 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
188 store i32 %0, i32* %B.addr.02, align 4
189 %inc9 = add nsw i64 %j.03, 1
190 %exitcond6 = icmp ne i64 %inc9, %n2
191 br i1 %exitcond6, label %for.body4, label %for.end10.loopexit
193 for.end10.loopexit: ; preds = %for.body4
196 for.end10: ; preds = %for.end10.loopexit, %for.cond1.preheader
201 ;; for (long int i = 0; i < n1; i++)
203 ;; for (long int j = 0; j < n2; j++)
206 define void @symbolicrdiv3(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
208 %cmp4 = icmp eq i64 %n1, 0
209 br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader
211 ; CHECK: 'Dependence Analysis' for function 'symbolicrdiv3'
212 ; CHECK: da analyze - none!
213 ; CHECK: da analyze - none!
214 ; CHECK: da analyze - confused!
215 ; CHECK: da analyze - none!
216 ; CHECK: da analyze - confused!
217 ; CHECK: da analyze - none!
219 for.body.preheader: ; preds = %entry
222 for.cond1.preheader.loopexit: ; preds = %for.body
223 br label %for.cond1.preheader
225 for.cond1.preheader: ; preds = %for.cond1.preheader.loopexit, %entry
226 %cmp21 = icmp eq i64 %n2, 0
227 br i1 %cmp21, label %for.end9, label %for.body4.preheader
229 for.body4.preheader: ; preds = %for.cond1.preheader
232 for.body: ; preds = %for.body.preheader, %for.body
233 %i.05 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
234 %conv = trunc i64 %i.05 to i32
235 %add = sub i64 %n2, %i.05
236 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
237 store i32 %conv, i32* %arrayidx, align 4
238 %inc = add nsw i64 %i.05, 1
239 %exitcond = icmp ne i64 %inc, %n1
240 br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit
242 for.body4: ; preds = %for.body4.preheader, %for.body4
243 %j.03 = phi i64 [ %inc8, %for.body4 ], [ 0, %for.body4.preheader ]
244 %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
245 %sub5 = sub i64 %j.03, %n1
246 %arrayidx6 = getelementptr inbounds i32, i32* %A, i64 %sub5
247 %0 = load i32, i32* %arrayidx6, align 4
248 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
249 store i32 %0, i32* %B.addr.02, align 4
250 %inc8 = add nsw i64 %j.03, 1
251 %exitcond6 = icmp ne i64 %inc8, %n2
252 br i1 %exitcond6, label %for.body4, label %for.end9.loopexit
254 for.end9.loopexit: ; preds = %for.body4
257 for.end9: ; preds = %for.end9.loopexit, %for.cond1.preheader
262 ;; for (long int i = 0; i < n1; i++)
264 ;; for (long int j = 0; j < n2; j++)
265 ;; *B++ = A[-j + n1];
267 define void @symbolicrdiv4(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
269 %cmp4 = icmp eq i64 %n1, 0
270 br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader
272 ; CHECK: 'Dependence Analysis' for function 'symbolicrdiv4'
273 ; CHECK: da analyze - none!
274 ; CHECK: da analyze - none!
275 ; CHECK: da analyze - confused!
276 ; CHECK: da analyze - none!
277 ; CHECK: da analyze - confused!
278 ; CHECK: da analyze - none!
280 for.body.preheader: ; preds = %entry
283 for.cond1.preheader.loopexit: ; preds = %for.body
284 br label %for.cond1.preheader
286 for.cond1.preheader: ; preds = %for.cond1.preheader.loopexit, %entry
287 %cmp21 = icmp eq i64 %n2, 0
288 br i1 %cmp21, label %for.end10, label %for.body4.preheader
290 for.body4.preheader: ; preds = %for.cond1.preheader
293 for.body: ; preds = %for.body.preheader, %for.body
294 %i.05 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
295 %conv = trunc i64 %i.05 to i32
296 %mul = shl i64 %n1, 1
297 %add = sub i64 %mul, %i.05
298 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
299 store i32 %conv, i32* %arrayidx, align 4
300 %inc = add nsw i64 %i.05, 1
301 %exitcond = icmp ne i64 %inc, %n1
302 br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit
304 for.body4: ; preds = %for.body4.preheader, %for.body4
305 %j.03 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.body4.preheader ]
306 %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
307 %add6 = sub i64 %n1, %j.03
308 %arrayidx7 = getelementptr inbounds i32, i32* %A, i64 %add6
309 %0 = load i32, i32* %arrayidx7, align 4
310 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
311 store i32 %0, i32* %B.addr.02, align 4
312 %inc9 = add nsw i64 %j.03, 1
313 %exitcond6 = icmp ne i64 %inc9, %n2
314 br i1 %exitcond6, label %for.body4, label %for.end10.loopexit
316 for.end10.loopexit: ; preds = %for.body4
319 for.end10: ; preds = %for.end10.loopexit, %for.cond1.preheader
324 ;; for (long int i = 0; i < n1; i++)
326 ;; for (long int j = 0; j < n2; j++)
327 ;; *B++ = A[-j + 2*n2];
329 define void @symbolicrdiv5(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
331 %cmp4 = icmp eq i64 %n1, 0
332 br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader
334 ; CHECK: 'Dependence Analysis' for function 'symbolicrdiv5'
335 ; CHECK: da analyze - none!
336 ; CHECK: da analyze - none!
337 ; CHECK: da analyze - confused!
338 ; CHECK: da analyze - none!
339 ; CHECK: da analyze - confused!
340 ; CHECK: da analyze - none!
342 for.body.preheader: ; preds = %entry
345 for.cond1.preheader.loopexit: ; preds = %for.body
346 br label %for.cond1.preheader
348 for.cond1.preheader: ; preds = %for.cond1.preheader.loopexit, %entry
349 %cmp21 = icmp eq i64 %n2, 0
350 br i1 %cmp21, label %for.end10, label %for.body4.preheader
352 for.body4.preheader: ; preds = %for.cond1.preheader
355 for.body: ; preds = %for.body.preheader, %for.body
356 %i.05 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
357 %conv = trunc i64 %i.05 to i32
358 %add = sub i64 %n2, %i.05
359 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
360 store i32 %conv, i32* %arrayidx, align 4
361 %inc = add nsw i64 %i.05, 1
362 %exitcond = icmp ne i64 %inc, %n1
363 br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit
365 for.body4: ; preds = %for.body4.preheader, %for.body4
366 %j.03 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.body4.preheader ]
367 %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
368 %mul = shl i64 %n2, 1
369 %add6 = sub i64 %mul, %j.03
370 %arrayidx7 = getelementptr inbounds i32, i32* %A, i64 %add6
371 %0 = load i32, i32* %arrayidx7, align 4
372 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
373 store i32 %0, i32* %B.addr.02, align 4
374 %inc9 = add nsw i64 %j.03, 1
375 %exitcond6 = icmp ne i64 %inc9, %n2
376 br i1 %exitcond6, label %for.body4, label %for.end10.loopexit
378 for.end10.loopexit: ; preds = %for.body4
381 for.end10: ; preds = %for.end10.loopexit, %for.cond1.preheader
386 ;; for (long int i = 0; i < n1; i++)
387 ;; for (long int j = 0; j < n2; j++) {
391 define void @symbolicrdiv6(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
393 %cmp4 = icmp eq i64 %n1, 0
394 br i1 %cmp4, label %for.end7, label %for.cond1.preheader.preheader
396 ; CHECK: 'Dependence Analysis' for function 'symbolicrdiv6'
397 ; CHECK: da analyze - output [* *]!
398 ; CHECK: da analyze - none!
399 ; CHECK: da analyze - confused!
400 ; CHECK: da analyze - consistent input [S S]!
401 ; CHECK: da analyze - confused!
402 ; CHECK: da analyze - output [* *]!
404 for.cond1.preheader.preheader: ; preds = %entry
405 br label %for.cond1.preheader
407 for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.inc5
408 %B.addr.06 = phi i32* [ %B.addr.1.lcssa, %for.inc5 ], [ %B, %for.cond1.preheader.preheader ]
409 %i.05 = phi i64 [ %inc6, %for.inc5 ], [ 0, %for.cond1.preheader.preheader ]
410 %cmp21 = icmp eq i64 %n2, 0
411 br i1 %cmp21, label %for.inc5, label %for.body3.preheader
413 for.body3.preheader: ; preds = %for.cond1.preheader
416 for.body3: ; preds = %for.body3.preheader, %for.body3
417 %j.03 = phi i64 [ %inc, %for.body3 ], [ 0, %for.body3.preheader ]
418 %B.addr.12 = phi i32* [ %incdec.ptr, %for.body3 ], [ %B.addr.06, %for.body3.preheader ]
419 %conv = trunc i64 %i.05 to i32
420 %sub = sub nsw i64 %j.03, %i.05
421 %add = add i64 %sub, %n2
422 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
423 store i32 %conv, i32* %arrayidx, align 4
424 %mul = shl i64 %n2, 1
425 %arrayidx4 = getelementptr inbounds i32, i32* %A, i64 %mul
426 %0 = load i32, i32* %arrayidx4, align 4
427 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.12, i64 1
428 store i32 %0, i32* %B.addr.12, align 4
429 %inc = add nsw i64 %j.03, 1
430 %exitcond = icmp ne i64 %inc, %n2
431 br i1 %exitcond, label %for.body3, label %for.inc5.loopexit
433 for.inc5.loopexit: ; preds = %for.body3
434 %scevgep = getelementptr i32, i32* %B.addr.06, i64 %n2
437 for.inc5: ; preds = %for.inc5.loopexit, %for.cond1.preheader
438 %B.addr.1.lcssa = phi i32* [ %B.addr.06, %for.cond1.preheader ], [ %scevgep, %for.inc5.loopexit ]
439 %inc6 = add nsw i64 %i.05, 1
440 %exitcond7 = icmp ne i64 %inc6, %n1
441 br i1 %exitcond7, label %for.cond1.preheader, label %for.end7.loopexit
443 for.end7.loopexit: ; preds = %for.inc5
446 for.end7: ; preds = %for.end7.loopexit, %entry