• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
2
3; ModuleID = 'SymbolicRDIV.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 int i = 0; i < n1; i++)
9;;    A[2*i + n1] = i;
10;;  for (long int j = 0; j < n2; j++)
11;;    *B++ = A[3*j + 3*n1];
12
13define void @symbolicrdiv0(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
14entry:
15  %cmp4 = icmp eq i64 %n1, 0
16  br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader
17
18; CHECK: 'Dependence Analysis' for function 'symbolicrdiv0'
19; CHECK: da analyze - none!
20; CHECK: da analyze - none!
21; CHECK: da analyze - confused!
22; CHECK: da analyze - none!
23; CHECK: da analyze - confused!
24; CHECK: da analyze - none!
25
26for.body.preheader:                               ; preds = %entry
27  br label %for.body
28
29for.cond1.preheader.loopexit:                     ; preds = %for.body
30  br label %for.cond1.preheader
31
32for.cond1.preheader:                              ; preds = %for.cond1.preheader.loopexit, %entry
33  %cmp21 = icmp eq i64 %n2, 0
34  br i1 %cmp21, label %for.end11, label %for.body4.preheader
35
36for.body4.preheader:                              ; preds = %for.cond1.preheader
37  br label %for.body4
38
39for.body:                                         ; preds = %for.body.preheader, %for.body
40  %i.05 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
41  %conv = trunc i64 %i.05 to i32
42  %mul = shl nsw i64 %i.05, 1
43  %add = add i64 %mul, %n1
44  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
45  store i32 %conv, i32* %arrayidx, align 4
46  %inc = add nsw i64 %i.05, 1
47  %exitcond = icmp ne i64 %inc, %n1
48  br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit
49
50for.body4:                                        ; preds = %for.body4.preheader, %for.body4
51  %j.03 = phi i64 [ %inc10, %for.body4 ], [ 0, %for.body4.preheader ]
52  %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
53  %mul56 = add i64 %j.03, %n1
54  %add7 = mul i64 %mul56, 3
55  %arrayidx8 = getelementptr inbounds i32, i32* %A, i64 %add7
56  %0 = load i32, i32* %arrayidx8, align 4
57  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
58  store i32 %0, i32* %B.addr.02, align 4
59  %inc10 = add nsw i64 %j.03, 1
60  %exitcond7 = icmp ne i64 %inc10, %n2
61  br i1 %exitcond7, label %for.body4, label %for.end11.loopexit
62
63for.end11.loopexit:                               ; preds = %for.body4
64  br label %for.end11
65
66for.end11:                                        ; preds = %for.end11.loopexit, %for.cond1.preheader
67  ret void
68}
69
70
71;;  for (long int i = 0; i < n1; i++)
72;;    A[2*i + 5*n2] = i;
73;;  for (long int j = 0; j < n2; j++)
74;;    *B++ = A[3*j + 2*n2];
75
76define void @symbolicrdiv1(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
77entry:
78  %cmp4 = icmp eq i64 %n1, 0
79  br i1 %cmp4, label %for.cond2.preheader, label %for.body.preheader
80
81; CHECK: 'Dependence Analysis' for function 'symbolicrdiv1'
82; CHECK: da analyze - none!
83; CHECK: da analyze - none!
84; CHECK: da analyze - confused!
85; CHECK: da analyze - none!
86; CHECK: da analyze - confused!
87; CHECK: da analyze - none!
88
89for.body.preheader:                               ; preds = %entry
90  br label %for.body
91
92for.cond2.preheader.loopexit:                     ; preds = %for.body
93  br label %for.cond2.preheader
94
95for.cond2.preheader:                              ; preds = %for.cond2.preheader.loopexit, %entry
96  %cmp31 = icmp eq i64 %n2, 0
97  br i1 %cmp31, label %for.end12, label %for.body5.preheader
98
99for.body5.preheader:                              ; preds = %for.cond2.preheader
100  br label %for.body5
101
102for.body:                                         ; preds = %for.body.preheader, %for.body
103  %i.05 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
104  %conv = trunc i64 %i.05 to i32
105  %mul = shl nsw i64 %i.05, 1
106  %mul1 = mul i64 %n2, 5
107  %add = add i64 %mul, %mul1
108  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
109  store i32 %conv, i32* %arrayidx, align 4
110  %inc = add nsw i64 %i.05, 1
111  %exitcond = icmp ne i64 %inc, %n1
112  br i1 %exitcond, label %for.body, label %for.cond2.preheader.loopexit
113
114for.body5:                                        ; preds = %for.body5.preheader, %for.body5
115  %j.03 = phi i64 [ %inc11, %for.body5 ], [ 0, %for.body5.preheader ]
116  %B.addr.02 = phi i32* [ %incdec.ptr, %for.body5 ], [ %B, %for.body5.preheader ]
117  %mul6 = mul nsw i64 %j.03, 3
118  %mul7 = shl i64 %n2, 1
119  %add8 = add i64 %mul6, %mul7
120  %arrayidx9 = getelementptr inbounds i32, i32* %A, i64 %add8
121  %0 = load i32, i32* %arrayidx9, align 4
122  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
123  store i32 %0, i32* %B.addr.02, align 4
124  %inc11 = add nsw i64 %j.03, 1
125  %exitcond6 = icmp ne i64 %inc11, %n2
126  br i1 %exitcond6, label %for.body5, label %for.end12.loopexit
127
128for.end12.loopexit:                               ; preds = %for.body5
129  br label %for.end12
130
131for.end12:                                        ; preds = %for.end12.loopexit, %for.cond2.preheader
132  ret void
133}
134
135
136;;  for (long int i = 0; i < n1; i++)
137;;    A[2*i - n2] = i;
138;;  for (long int j = 0; j < n2; j++)
139;;    *B++ = A[-j + 2*n1];
140
141define void @symbolicrdiv2(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
142entry:
143  %cmp4 = icmp eq i64 %n1, 0
144  br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader
145
146; CHECK: 'Dependence Analysis' for function 'symbolicrdiv2'
147; CHECK: da analyze - none!
148; CHECK: da analyze - none!
149; CHECK: da analyze - confused!
150; CHECK: da analyze - none!
151; CHECK: da analyze - confused!
152; CHECK: da analyze - none!
153
154for.body.preheader:                               ; preds = %entry
155  br label %for.body
156
157for.cond1.preheader.loopexit:                     ; preds = %for.body
158  br label %for.cond1.preheader
159
160for.cond1.preheader:                              ; preds = %for.cond1.preheader.loopexit, %entry
161  %cmp21 = icmp eq i64 %n2, 0
162  br i1 %cmp21, label %for.end10, label %for.body4.preheader
163
164for.body4.preheader:                              ; preds = %for.cond1.preheader
165  br label %for.body4
166
167for.body:                                         ; preds = %for.body.preheader, %for.body
168  %i.05 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
169  %conv = trunc i64 %i.05 to i32
170  %mul = shl nsw i64 %i.05, 1
171  %sub = sub i64 %mul, %n2
172  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %sub
173  store i32 %conv, i32* %arrayidx, align 4
174  %inc = add nsw i64 %i.05, 1
175  %exitcond = icmp ne i64 %inc, %n1
176  br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit
177
178for.body4:                                        ; preds = %for.body4.preheader, %for.body4
179  %j.03 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.body4.preheader ]
180  %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
181  %mul6 = shl i64 %n1, 1
182  %add = sub i64 %mul6, %j.03
183  %arrayidx7 = getelementptr inbounds i32, i32* %A, i64 %add
184  %0 = load i32, i32* %arrayidx7, align 4
185  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
186  store i32 %0, i32* %B.addr.02, align 4
187  %inc9 = add nsw i64 %j.03, 1
188  %exitcond6 = icmp ne i64 %inc9, %n2
189  br i1 %exitcond6, label %for.body4, label %for.end10.loopexit
190
191for.end10.loopexit:                               ; preds = %for.body4
192  br label %for.end10
193
194for.end10:                                        ; preds = %for.end10.loopexit, %for.cond1.preheader
195  ret void
196}
197
198
199;;  for (long int i = 0; i < n1; i++)
200;;    A[-i + n2] = i;
201;;  for (long int j = 0; j < n2; j++)
202;;    *B++ = A[j - n1];
203
204define void @symbolicrdiv3(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
205entry:
206  %cmp4 = icmp eq i64 %n1, 0
207  br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader
208
209; CHECK: 'Dependence Analysis' for function 'symbolicrdiv3'
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.preheader:                               ; preds = %entry
218  br label %for.body
219
220for.cond1.preheader.loopexit:                     ; preds = %for.body
221  br label %for.cond1.preheader
222
223for.cond1.preheader:                              ; preds = %for.cond1.preheader.loopexit, %entry
224  %cmp21 = icmp eq i64 %n2, 0
225  br i1 %cmp21, label %for.end9, label %for.body4.preheader
226
227for.body4.preheader:                              ; preds = %for.cond1.preheader
228  br label %for.body4
229
230for.body:                                         ; preds = %for.body.preheader, %for.body
231  %i.05 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
232  %conv = trunc i64 %i.05 to i32
233  %add = sub i64 %n2, %i.05
234  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
235  store i32 %conv, i32* %arrayidx, align 4
236  %inc = add nsw i64 %i.05, 1
237  %exitcond = icmp ne i64 %inc, %n1
238  br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit
239
240for.body4:                                        ; preds = %for.body4.preheader, %for.body4
241  %j.03 = phi i64 [ %inc8, %for.body4 ], [ 0, %for.body4.preheader ]
242  %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
243  %sub5 = sub i64 %j.03, %n1
244  %arrayidx6 = getelementptr inbounds i32, i32* %A, i64 %sub5
245  %0 = load i32, i32* %arrayidx6, align 4
246  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
247  store i32 %0, i32* %B.addr.02, align 4
248  %inc8 = add nsw i64 %j.03, 1
249  %exitcond6 = icmp ne i64 %inc8, %n2
250  br i1 %exitcond6, label %for.body4, label %for.end9.loopexit
251
252for.end9.loopexit:                                ; preds = %for.body4
253  br label %for.end9
254
255for.end9:                                         ; preds = %for.end9.loopexit, %for.cond1.preheader
256  ret void
257}
258
259
260;;  for (long int i = 0; i < n1; i++)
261;;    A[-i + 2*n1] = i;
262;;  for (long int j = 0; j < n2; j++)
263;;    *B++ = A[-j + n1];
264
265define void @symbolicrdiv4(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
266entry:
267  %cmp4 = icmp eq i64 %n1, 0
268  br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader
269
270; CHECK: 'Dependence Analysis' for function 'symbolicrdiv4'
271; CHECK: da analyze - none!
272; CHECK: da analyze - none!
273; CHECK: da analyze - confused!
274; CHECK: da analyze - none!
275; CHECK: da analyze - confused!
276; CHECK: da analyze - none!
277
278for.body.preheader:                               ; preds = %entry
279  br label %for.body
280
281for.cond1.preheader.loopexit:                     ; preds = %for.body
282  br label %for.cond1.preheader
283
284for.cond1.preheader:                              ; preds = %for.cond1.preheader.loopexit, %entry
285  %cmp21 = icmp eq i64 %n2, 0
286  br i1 %cmp21, label %for.end10, label %for.body4.preheader
287
288for.body4.preheader:                              ; preds = %for.cond1.preheader
289  br label %for.body4
290
291for.body:                                         ; preds = %for.body.preheader, %for.body
292  %i.05 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
293  %conv = trunc i64 %i.05 to i32
294  %mul = shl i64 %n1, 1
295  %add = sub i64 %mul, %i.05
296  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
297  store i32 %conv, i32* %arrayidx, align 4
298  %inc = add nsw i64 %i.05, 1
299  %exitcond = icmp ne i64 %inc, %n1
300  br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit
301
302for.body4:                                        ; preds = %for.body4.preheader, %for.body4
303  %j.03 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.body4.preheader ]
304  %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
305  %add6 = sub i64 %n1, %j.03
306  %arrayidx7 = getelementptr inbounds i32, i32* %A, i64 %add6
307  %0 = load i32, i32* %arrayidx7, align 4
308  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
309  store i32 %0, i32* %B.addr.02, align 4
310  %inc9 = add nsw i64 %j.03, 1
311  %exitcond6 = icmp ne i64 %inc9, %n2
312  br i1 %exitcond6, label %for.body4, label %for.end10.loopexit
313
314for.end10.loopexit:                               ; preds = %for.body4
315  br label %for.end10
316
317for.end10:                                        ; preds = %for.end10.loopexit, %for.cond1.preheader
318  ret void
319}
320
321
322;;  for (long int i = 0; i < n1; i++)
323;;    A[-i + n2] = i;
324;;  for (long int j = 0; j < n2; j++)
325;;    *B++ = A[-j + 2*n2];
326
327define void @symbolicrdiv5(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
328entry:
329  %cmp4 = icmp eq i64 %n1, 0
330  br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader
331
332; CHECK: 'Dependence Analysis' for function 'symbolicrdiv5'
333; CHECK: da analyze - none!
334; CHECK: da analyze - none!
335; CHECK: da analyze - confused!
336; CHECK: da analyze - none!
337; CHECK: da analyze - confused!
338; CHECK: da analyze - none!
339
340for.body.preheader:                               ; preds = %entry
341  br label %for.body
342
343for.cond1.preheader.loopexit:                     ; preds = %for.body
344  br label %for.cond1.preheader
345
346for.cond1.preheader:                              ; preds = %for.cond1.preheader.loopexit, %entry
347  %cmp21 = icmp eq i64 %n2, 0
348  br i1 %cmp21, label %for.end10, label %for.body4.preheader
349
350for.body4.preheader:                              ; preds = %for.cond1.preheader
351  br label %for.body4
352
353for.body:                                         ; preds = %for.body.preheader, %for.body
354  %i.05 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
355  %conv = trunc i64 %i.05 to i32
356  %add = sub i64 %n2, %i.05
357  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
358  store i32 %conv, i32* %arrayidx, align 4
359  %inc = add nsw i64 %i.05, 1
360  %exitcond = icmp ne i64 %inc, %n1
361  br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit
362
363for.body4:                                        ; preds = %for.body4.preheader, %for.body4
364  %j.03 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.body4.preheader ]
365  %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
366  %mul = shl i64 %n2, 1
367  %add6 = sub i64 %mul, %j.03
368  %arrayidx7 = getelementptr inbounds i32, i32* %A, i64 %add6
369  %0 = load i32, i32* %arrayidx7, align 4
370  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
371  store i32 %0, i32* %B.addr.02, align 4
372  %inc9 = add nsw i64 %j.03, 1
373  %exitcond6 = icmp ne i64 %inc9, %n2
374  br i1 %exitcond6, label %for.body4, label %for.end10.loopexit
375
376for.end10.loopexit:                               ; preds = %for.body4
377  br label %for.end10
378
379for.end10:                                        ; preds = %for.end10.loopexit, %for.cond1.preheader
380  ret void
381}
382
383
384;;  for (long int i = 0; i < n1; i++)
385;;    for (long int j = 0; j < n2; j++) {
386;;      A[j -i + n2] = i;
387;;      *B++ = A[2*n2];
388
389define void @symbolicrdiv6(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
390entry:
391  %cmp4 = icmp eq i64 %n1, 0
392  br i1 %cmp4, label %for.end7, label %for.cond1.preheader.preheader
393
394; CHECK: 'Dependence Analysis' for function 'symbolicrdiv6'
395; CHECK: da analyze - output [* *]!
396; CHECK: da analyze - none!
397; CHECK: da analyze - confused!
398; CHECK: da analyze - consistent input [S S]!
399; CHECK: da analyze - confused!
400; CHECK: da analyze - output [* *]!
401
402for.cond1.preheader.preheader:                    ; preds = %entry
403  br label %for.cond1.preheader
404
405for.cond1.preheader:                              ; preds = %for.cond1.preheader.preheader, %for.inc5
406  %B.addr.06 = phi i32* [ %B.addr.1.lcssa, %for.inc5 ], [ %B, %for.cond1.preheader.preheader ]
407  %i.05 = phi i64 [ %inc6, %for.inc5 ], [ 0, %for.cond1.preheader.preheader ]
408  %cmp21 = icmp eq i64 %n2, 0
409  br i1 %cmp21, label %for.inc5, label %for.body3.preheader
410
411for.body3.preheader:                              ; preds = %for.cond1.preheader
412  br label %for.body3
413
414for.body3:                                        ; preds = %for.body3.preheader, %for.body3
415  %j.03 = phi i64 [ %inc, %for.body3 ], [ 0, %for.body3.preheader ]
416  %B.addr.12 = phi i32* [ %incdec.ptr, %for.body3 ], [ %B.addr.06, %for.body3.preheader ]
417  %conv = trunc i64 %i.05 to i32
418  %sub = sub nsw i64 %j.03, %i.05
419  %add = add i64 %sub, %n2
420  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
421  store i32 %conv, i32* %arrayidx, align 4
422  %mul = shl i64 %n2, 1
423  %arrayidx4 = getelementptr inbounds i32, i32* %A, i64 %mul
424  %0 = load i32, i32* %arrayidx4, align 4
425  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.12, i64 1
426  store i32 %0, i32* %B.addr.12, align 4
427  %inc = add nsw i64 %j.03, 1
428  %exitcond = icmp ne i64 %inc, %n2
429  br i1 %exitcond, label %for.body3, label %for.inc5.loopexit
430
431for.inc5.loopexit:                                ; preds = %for.body3
432  %scevgep = getelementptr i32, i32* %B.addr.06, i64 %n2
433  br label %for.inc5
434
435for.inc5:                                         ; preds = %for.inc5.loopexit, %for.cond1.preheader
436  %B.addr.1.lcssa = phi i32* [ %B.addr.06, %for.cond1.preheader ], [ %scevgep, %for.inc5.loopexit ]
437  %inc6 = add nsw i64 %i.05, 1
438  %exitcond7 = icmp ne i64 %inc6, %n1
439  br i1 %exitcond7, label %for.cond1.preheader, label %for.end7.loopexit
440
441for.end7.loopexit:                                ; preds = %for.inc5
442  br label %for.end7
443
444for.end7:                                         ; preds = %for.end7.loopexit, %entry
445  ret void
446}
447