blob: 2a1b4e7e971df815b1583c86ffd23e6927abc72e [file] [log] [blame]
Sebastian Pop59b61b92012-10-11 07:32:34 +00001; 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] = ...
10;; for (long int j = 0; j < n2; j++)
11;; ... = 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
17
18for.cond1.preheader: ; preds = %for.body, %entry
19 %cmp21 = icmp eq i64 %n2, 0
20 br i1 %cmp21, label %for.end11, label %for.body4
21
22for.body: ; preds = %for.body, %entry
23 %i.05 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
24 %conv = trunc i64 %i.05 to i32
25 %mul = shl nsw i64 %i.05, 1
26 %add = add i64 %mul, %n1
27 %arrayidx = getelementptr inbounds i32* %A, i64 %add
28 store i32 %conv, i32* %arrayidx, align 4
29 %inc = add nsw i64 %i.05, 1
30 %cmp = icmp ult i64 %inc, %n1
31 br i1 %cmp, label %for.body, label %for.cond1.preheader
32
33for.body4: ; preds = %for.body4, %for.cond1.preheader
34 %j.03 = phi i64 [ %inc10, %for.body4 ], [ 0, %for.cond1.preheader ]
35 %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.cond1.preheader ]
36 %mul56 = add i64 %j.03, %n1
37 %add7 = mul i64 %mul56, 3
38 %arrayidx8 = getelementptr inbounds i32* %A, i64 %add7
39 %0 = load i32* %arrayidx8, align 4
40; CHECK: da analyze - none!
41 %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
42 store i32 %0, i32* %B.addr.02, align 4
43 %inc10 = add nsw i64 %j.03, 1
44 %cmp2 = icmp ult i64 %inc10, %n2
45 br i1 %cmp2, label %for.body4, label %for.end11
46
47for.end11: ; preds = %for.body4, %for.cond1.preheader
48 ret void
49}
50
51
52;; for (long int i = 0; i < n1; i++)
53;; A[2*i + 5*n2] = ...
54;; for (long int j = 0; j < n2; j++)
55;; ... = A[3*j + 2*n2];
56
57define void @symbolicrdiv1(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
58entry:
59 %cmp4 = icmp eq i64 %n1, 0
60 br i1 %cmp4, label %for.cond2.preheader, label %for.body
61
62for.cond2.preheader: ; preds = %for.body, %entry
63 %cmp31 = icmp eq i64 %n2, 0
64 br i1 %cmp31, label %for.end12, label %for.body5
65
66for.body: ; preds = %for.body, %entry
67 %i.05 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
68 %conv = trunc i64 %i.05 to i32
69 %mul = shl nsw i64 %i.05, 1
70 %mul1 = mul i64 %n2, 5
71 %add = add i64 %mul, %mul1
72 %arrayidx = getelementptr inbounds i32* %A, i64 %add
73 store i32 %conv, i32* %arrayidx, align 4
74 %inc = add nsw i64 %i.05, 1
75 %cmp = icmp ult i64 %inc, %n1
76 br i1 %cmp, label %for.body, label %for.cond2.preheader
77
78for.body5: ; preds = %for.body5, %for.cond2.preheader
79 %j.03 = phi i64 [ %inc11, %for.body5 ], [ 0, %for.cond2.preheader ]
80 %B.addr.02 = phi i32* [ %incdec.ptr, %for.body5 ], [ %B, %for.cond2.preheader ]
81 %mul6 = mul nsw i64 %j.03, 3
82 %mul7 = shl i64 %n2, 1
83 %add8 = add i64 %mul6, %mul7
84 %arrayidx9 = getelementptr inbounds i32* %A, i64 %add8
85 %0 = load i32* %arrayidx9, align 4
86; CHECK: da analyze - none!
87 %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
88 store i32 %0, i32* %B.addr.02, align 4
89 %inc11 = add nsw i64 %j.03, 1
90 %cmp3 = icmp ult i64 %inc11, %n2
91 br i1 %cmp3, label %for.body5, label %for.end12
92
93for.end12: ; preds = %for.body5, %for.cond2.preheader
94 ret void
95}
96
97
98;; for (long int i = 0; i < n1; i++)
99;; A[2*i - n2] = ...
100;; for (long int j = 0; j < n2; j++)
101;; ... = A[-j + 2*n1];
102
103define void @symbolicrdiv2(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
104entry:
105 %cmp4 = icmp eq i64 %n1, 0
106 br i1 %cmp4, label %for.cond1.preheader, label %for.body
107
108for.cond1.preheader: ; preds = %for.body, %entry
109 %cmp21 = icmp eq i64 %n2, 0
110 br i1 %cmp21, label %for.end10, label %for.body4
111
112for.body: ; preds = %for.body, %entry
113 %i.05 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
114 %conv = trunc i64 %i.05 to i32
115 %mul = shl nsw i64 %i.05, 1
116 %sub = sub i64 %mul, %n2
117 %arrayidx = getelementptr inbounds i32* %A, i64 %sub
118 store i32 %conv, i32* %arrayidx, align 4
119 %inc = add nsw i64 %i.05, 1
120 %cmp = icmp ult i64 %inc, %n1
121 br i1 %cmp, label %for.body, label %for.cond1.preheader
122
123for.body4: ; preds = %for.body4, %for.cond1.preheader
124 %j.03 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.cond1.preheader ]
125 %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.cond1.preheader ]
126 %mul6 = shl i64 %n1, 1
127 %add = sub i64 %mul6, %j.03
128 %arrayidx7 = getelementptr inbounds i32* %A, i64 %add
129 %0 = load i32* %arrayidx7, align 4
130; CHECK: da analyze - none!
131 %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
132 store i32 %0, i32* %B.addr.02, align 4
133 %inc9 = add nsw i64 %j.03, 1
134 %cmp2 = icmp ult i64 %inc9, %n2
135 br i1 %cmp2, label %for.body4, label %for.end10
136
137for.end10: ; preds = %for.body4, %for.cond1.preheader
138 ret void
139}
140
141
142;; for (long int i = 0; i < n1; i++)
143;; A[-i + n2] = ...
144;; for (long int j = 0; j < n2; j++)
145;; ... = A[j - n1];
146
147define void @symbolicrdiv3(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
148entry:
149 %cmp4 = icmp eq i64 %n1, 0
150 br i1 %cmp4, label %for.cond1.preheader, label %for.body
151
152for.cond1.preheader: ; preds = %for.body, %entry
153 %cmp21 = icmp eq i64 %n2, 0
154 br i1 %cmp21, label %for.end9, label %for.body4
155
156for.body: ; preds = %for.body, %entry
157 %i.05 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
158 %conv = trunc i64 %i.05 to i32
159 %add = sub i64 %n2, %i.05
160 %arrayidx = getelementptr inbounds i32* %A, i64 %add
161 store i32 %conv, i32* %arrayidx, align 4
162 %inc = add nsw i64 %i.05, 1
163 %cmp = icmp ult i64 %inc, %n1
164 br i1 %cmp, label %for.body, label %for.cond1.preheader
165
166for.body4: ; preds = %for.body4, %for.cond1.preheader
167 %j.03 = phi i64 [ %inc8, %for.body4 ], [ 0, %for.cond1.preheader ]
168 %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.cond1.preheader ]
169 %sub5 = sub i64 %j.03, %n1
170 %arrayidx6 = getelementptr inbounds i32* %A, i64 %sub5
171 %0 = load i32* %arrayidx6, align 4
172; CHECK: da analyze - none!
173 %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
174 store i32 %0, i32* %B.addr.02, align 4
175 %inc8 = add nsw i64 %j.03, 1
176 %cmp2 = icmp ult i64 %inc8, %n2
177 br i1 %cmp2, label %for.body4, label %for.end9
178
179for.end9: ; preds = %for.body4, %for.cond1.preheader
180 ret void
181}
182
183
184;; for (long int i = 0; i < n1; i++)
185;; A[-i + 2*n1] = ...
186;; for (long int j = 0; j < n2; j++)
187;; ... = A[-j + n1];
188
189define void @symbolicrdiv4(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
190entry:
191 %cmp4 = icmp eq i64 %n1, 0
192 br i1 %cmp4, label %for.cond1.preheader, label %for.body
193
194for.cond1.preheader: ; preds = %for.body, %entry
195 %cmp21 = icmp eq i64 %n2, 0
196 br i1 %cmp21, label %for.end10, label %for.body4
197
198for.body: ; preds = %for.body, %entry
199 %i.05 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
200 %conv = trunc i64 %i.05 to i32
201 %mul = shl i64 %n1, 1
202 %add = sub i64 %mul, %i.05
203 %arrayidx = getelementptr inbounds i32* %A, i64 %add
204 store i32 %conv, i32* %arrayidx, align 4
205 %inc = add nsw i64 %i.05, 1
206 %cmp = icmp ult i64 %inc, %n1
207 br i1 %cmp, label %for.body, label %for.cond1.preheader
208
209for.body4: ; preds = %for.body4, %for.cond1.preheader
210 %j.03 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.cond1.preheader ]
211 %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.cond1.preheader ]
212 %add6 = sub i64 %n1, %j.03
213 %arrayidx7 = getelementptr inbounds i32* %A, i64 %add6
214 %0 = load i32* %arrayidx7, align 4
215; CHECK: da analyze - none!
216 %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
217 store i32 %0, i32* %B.addr.02, align 4
218 %inc9 = add nsw i64 %j.03, 1
219 %cmp2 = icmp ult i64 %inc9, %n2
220 br i1 %cmp2, label %for.body4, label %for.end10
221
222for.end10: ; preds = %for.body4, %for.cond1.preheader
223 ret void
224}
225
226
227;; for (long int i = 0; i < n1; i++)
228;; A[-i + n2] = ...
229;; for (long int j = 0; j < n2; j++)
230;; ... = A[-j + 2*n2];
231
232define void @symbolicrdiv5(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
233entry:
234 %cmp4 = icmp eq i64 %n1, 0
235 br i1 %cmp4, label %for.cond1.preheader, label %for.body
236
237for.cond1.preheader: ; preds = %for.body, %entry
238 %cmp21 = icmp eq i64 %n2, 0
239 br i1 %cmp21, label %for.end10, label %for.body4
240
241for.body: ; preds = %for.body, %entry
242 %i.05 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
243 %conv = trunc i64 %i.05 to i32
244 %add = sub i64 %n2, %i.05
245 %arrayidx = getelementptr inbounds i32* %A, i64 %add
246 store i32 %conv, i32* %arrayidx, align 4
247 %inc = add nsw i64 %i.05, 1
248 %cmp = icmp ult i64 %inc, %n1
249 br i1 %cmp, label %for.body, label %for.cond1.preheader
250
251for.body4: ; preds = %for.body4, %for.cond1.preheader
252 %j.03 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.cond1.preheader ]
253 %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.cond1.preheader ]
254 %mul = shl i64 %n2, 1
255 %add6 = sub i64 %mul, %j.03
256 %arrayidx7 = getelementptr inbounds i32* %A, i64 %add6
257 %0 = load i32* %arrayidx7, align 4
258; CHECK: da analyze - none!
259 %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
260 store i32 %0, i32* %B.addr.02, align 4
261 %inc9 = add nsw i64 %j.03, 1
262 %cmp2 = icmp ult i64 %inc9, %n2
263 br i1 %cmp2, label %for.body4, label %for.end10
264
265for.end10: ; preds = %for.body4, %for.cond1.preheader
266 ret void
267}
268
269
270;; for (long int i = 0; i < n1; i++)
271;; for (long int j = 0; j < n2; j++)
272;; A[j -i + n2] = ...
273;; ... = A[2*n2];
274
275define void @symbolicrdiv6(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
276entry:
277 %cmp4 = icmp eq i64 %n1, 0
278 br i1 %cmp4, label %for.end7, label %for.cond1.preheader
279
280for.cond1.preheader: ; preds = %for.inc5, %entry
281 %B.addr.06 = phi i32* [ %B.addr.1.lcssa, %for.inc5 ], [ %B, %entry ]
282 %i.05 = phi i64 [ %inc6, %for.inc5 ], [ 0, %entry ]
283 %cmp21 = icmp eq i64 %n2, 0
284 br i1 %cmp21, label %for.inc5, label %for.body3
285
286for.body3: ; preds = %for.body3, %for.cond1.preheader
287 %j.03 = phi i64 [ %inc, %for.body3 ], [ 0, %for.cond1.preheader ]
288 %B.addr.12 = phi i32* [ %incdec.ptr, %for.body3 ], [ %B.addr.06, %for.cond1.preheader ]
289 %conv = trunc i64 %i.05 to i32
290 %sub = sub nsw i64 %j.03, %i.05
291 %add = add i64 %sub, %n2
292 %arrayidx = getelementptr inbounds i32* %A, i64 %add
293 store i32 %conv, i32* %arrayidx, align 4
294 %mul = shl i64 %n2, 1
295 %arrayidx4 = getelementptr inbounds i32* %A, i64 %mul
296 %0 = load i32* %arrayidx4, align 4
297; CHECK: da analyze - none!
298 %incdec.ptr = getelementptr inbounds i32* %B.addr.12, i64 1
299 store i32 %0, i32* %B.addr.12, align 4
300 %inc = add nsw i64 %j.03, 1
301 %cmp2 = icmp ult i64 %inc, %n2
302 br i1 %cmp2, label %for.body3, label %for.inc5
303
304for.inc5: ; preds = %for.body3, %for.cond1.preheader
305 %B.addr.1.lcssa = phi i32* [ %B.addr.06, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ]
306 %inc6 = add nsw i64 %i.05, 1
307 %cmp = icmp ult i64 %inc6, %n1
308 br i1 %cmp, label %for.cond1.preheader, label %for.end7
309
310for.end7: ; preds = %for.inc5, %entry
311 ret void
312}