1 ; RUN: opt < %s -S -indvars -verify-scev
2 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"
3 target triple = "x86_64-apple-macosx10.8.0"
5 define void @test1() nounwind uwtable ssp {
7 br i1 undef, label %for.end, label %for.body
9 for.body: ; preds = %for.body, %entry
10 br i1 false, label %for.end, label %for.body
12 for.end: ; preds = %for.body, %entry
13 br i1 undef, label %for.end11, label %for.body3
15 for.body3: ; preds = %for.end
18 for.end11: ; preds = %for.end
19 br i1 undef, label %while.body, label %while.end
21 while.body: ; preds = %for.end11
24 while.end: ; preds = %for.end11
25 br i1 undef, label %if.end115, label %for.cond109
27 for.cond109: ; preds = %while.end
30 if.end115: ; preds = %while.end
31 br i1 undef, label %while.body119.lr.ph.lr.ph, label %for.cond612
33 while.body119.lr.ph.lr.ph: ; preds = %if.end115
34 br i1 undef, label %for.cond612, label %if.end123.us
36 if.end123.us: ; preds = %while.body119.lr.ph.lr.ph
37 br label %for.cond132.us
39 for.cond132.us: ; preds = %for.cond132.us, %if.end123.us
40 br i1 undef, label %if.then136.us, label %for.cond132.us
42 if.then136.us: ; preds = %for.cond132.us
43 br i1 undef, label %while.end220, label %while.body211
45 while.body211: ; preds = %while.body211, %if.then136.us
46 br i1 undef, label %while.end220, label %while.body211
48 while.end220: ; preds = %while.body211, %if.then136.us
49 br label %for.cond246.outer
51 for.cond246.outer: ; preds = %for.inc558, %for.cond394.preheader, %if.then274, %for.cond404.preheader, %while.end220
54 for.cond246: ; preds = %for.cond372.loopexit, %for.cond246.outer
55 br i1 undef, label %for.end562, label %if.end250
57 if.end250: ; preds = %for.cond246
58 br i1 undef, label %if.end256, label %for.end562
60 if.end256: ; preds = %if.end250
61 %cmp272 = icmp eq i32 undef, undef
62 br i1 %cmp272, label %if.then274, label %for.cond404.preheader
64 for.cond404.preheader: ; preds = %if.end256
65 br i1 undef, label %for.cond246.outer, label %for.body409.lr.ph
67 for.body409.lr.ph: ; preds = %for.cond404.preheader
70 if.then274: ; preds = %if.end256
71 br i1 undef, label %for.cond246.outer, label %if.end309
73 if.end309: ; preds = %if.then274
74 br i1 undef, label %for.cond372.loopexit, label %for.body361
76 for.body361: ; preds = %for.body361, %if.end309
77 br i1 undef, label %for.cond372.loopexit, label %for.body361
79 for.cond372.loopexit: ; preds = %for.body361, %if.end309
80 br i1 undef, label %for.cond394.preheader, label %for.cond246
82 for.cond394.preheader: ; preds = %for.cond372.loopexit
83 br i1 undef, label %for.cond246.outer, label %for.body397
85 for.body397: ; preds = %for.cond394.preheader
88 for.body409: ; preds = %for.inc558, %for.body409.lr.ph
89 %k.029 = phi i32 [ 1, %for.body409.lr.ph ], [ %inc559, %for.inc558 ]
90 br i1 undef, label %if.then412, label %if.else433
92 if.then412: ; preds = %for.body409
95 if.else433: ; preds = %for.body409
98 if.end440: ; preds = %if.else433, %if.then412
99 br i1 undef, label %for.inc558, label %if.end461
101 if.end461: ; preds = %if.end440
102 br i1 undef, label %for.cond528.loopexit, label %for.body517
104 for.body517: ; preds = %for.body517, %if.end461
105 br i1 undef, label %for.cond528.loopexit, label %for.body517
107 for.cond528.loopexit: ; preds = %for.body517, %if.end461
110 for.inc558: ; preds = %for.cond528.loopexit, %if.end440
111 %inc559 = add nsw i32 %k.029, 1
112 %cmp407 = icmp sgt i32 %inc559, undef
113 br i1 %cmp407, label %for.cond246.outer, label %for.body409
115 for.end562: ; preds = %if.end250, %for.cond246
118 for.cond612: ; preds = %while.body119.lr.ph.lr.ph, %if.end115
122 define void @test2() nounwind uwtable ssp {
124 br i1 undef, label %for.end, label %for.body
126 for.body: ; preds = %for.body, %entry
127 br i1 undef, label %for.end, label %for.body
129 for.end: ; preds = %for.body, %entry
130 br i1 undef, label %for.end11, label %for.body3
132 for.body3: ; preds = %for.end
135 for.end11: ; preds = %for.end
136 br i1 undef, label %while.body, label %while.end
138 while.body: ; preds = %for.end11
141 while.end: ; preds = %for.end11
142 br i1 undef, label %if.end115, label %for.cond109
144 for.cond109: ; preds = %while.end
147 if.end115: ; preds = %while.end
148 br i1 undef, label %while.body119.lr.ph.lr.ph, label %for.cond612
150 while.body119.lr.ph.lr.ph: ; preds = %if.end115
151 br i1 undef, label %for.cond612, label %if.end123.us
153 if.end123.us: ; preds = %while.body119.lr.ph.lr.ph
154 br label %for.cond132.us
156 for.cond132.us: ; preds = %for.cond132.us, %if.end123.us
157 br i1 undef, label %if.then136.us, label %for.cond132.us
159 if.then136.us: ; preds = %for.cond132.us
160 br i1 undef, label %while.end220, label %while.body211
162 while.body211: ; preds = %while.body211, %if.then136.us
163 br i1 undef, label %while.end220, label %while.body211
165 while.end220: ; preds = %while.body211, %if.then136.us
166 br label %for.cond246.outer
168 for.cond246.outer: ; preds = %for.inc558, %for.cond394.preheader, %if.then274, %for.cond404.preheader, %while.end220
169 br label %for.cond246
171 for.cond246: ; preds = %for.cond372.loopexit, %for.cond246.outer
172 br i1 undef, label %for.end562, label %if.end250
174 if.end250: ; preds = %for.cond246
175 br i1 undef, label %if.end256, label %for.end562
177 if.end256: ; preds = %if.end250
178 %0 = load i32, i32* undef, align 4
179 br i1 undef, label %if.then274, label %for.cond404.preheader
181 for.cond404.preheader: ; preds = %if.end256
182 %add406 = add i32 0, %0
183 br i1 undef, label %for.cond246.outer, label %for.body409.lr.ph
185 for.body409.lr.ph: ; preds = %for.cond404.preheader
186 br label %for.body409
188 if.then274: ; preds = %if.end256
189 br i1 undef, label %for.cond246.outer, label %if.end309
191 if.end309: ; preds = %if.then274
192 br i1 undef, label %for.cond372.loopexit, label %for.body361
194 for.body361: ; preds = %for.body361, %if.end309
195 br i1 undef, label %for.cond372.loopexit, label %for.body361
197 for.cond372.loopexit: ; preds = %for.body361, %if.end309
198 br i1 undef, label %for.cond394.preheader, label %for.cond246
200 for.cond394.preheader: ; preds = %for.cond372.loopexit
201 br i1 undef, label %for.cond246.outer, label %for.body397
203 for.body397: ; preds = %for.cond394.preheader
206 for.body409: ; preds = %for.inc558, %for.body409.lr.ph
207 %k.029 = phi i32 [ 1, %for.body409.lr.ph ], [ %inc559, %for.inc558 ]
208 br i1 undef, label %if.then412, label %if.else433
210 if.then412: ; preds = %for.body409
213 if.else433: ; preds = %for.body409
216 if.end440: ; preds = %if.else433, %if.then412
217 br i1 undef, label %for.inc558, label %if.end461
219 if.end461: ; preds = %if.end440
220 br i1 undef, label %for.cond528.loopexit, label %for.body517
222 for.body517: ; preds = %for.body517, %if.end461
223 br i1 undef, label %for.cond528.loopexit, label %for.body517
225 for.cond528.loopexit: ; preds = %for.body517, %if.end461
228 for.inc558: ; preds = %for.cond528.loopexit, %if.end440
229 %inc559 = add nsw i32 %k.029, 1
230 %cmp407 = icmp sgt i32 %inc559, %add406
231 br i1 %cmp407, label %for.cond246.outer, label %for.body409
233 for.end562: ; preds = %if.end250, %for.cond246
236 for.cond612: ; preds = %while.body119.lr.ph.lr.ph, %if.end115
240 define void @test3() nounwind uwtable ssp {
242 br i1 undef, label %for.end, label %for.body
244 for.body: ; preds = %for.body, %entry
245 br i1 undef, label %for.end, label %for.body
247 for.end: ; preds = %for.body, %entry
248 br i1 undef, label %for.end11, label %for.body3
250 for.body3: ; preds = %for.end
253 for.end11: ; preds = %for.end
254 br i1 undef, label %while.body, label %while.end
256 while.body: ; preds = %for.end11
259 while.end: ; preds = %for.end11
260 br i1 undef, label %if.end115, label %for.cond109
262 for.cond109: ; preds = %while.end
265 if.end115: ; preds = %while.end
266 br i1 undef, label %while.body119.lr.ph.lr.ph, label %for.cond612
268 while.body119.lr.ph.lr.ph: ; preds = %if.end115
269 br i1 undef, label %for.cond612, label %if.end123.us
271 if.end123.us: ; preds = %while.body119.lr.ph.lr.ph
272 br label %for.cond132.us
274 for.cond132.us: ; preds = %for.cond132.us, %if.end123.us
275 br i1 undef, label %if.then136.us, label %for.cond132.us
277 if.then136.us: ; preds = %for.cond132.us
278 br i1 undef, label %while.end220, label %while.body211
280 while.body211: ; preds = %while.body211, %if.then136.us
281 br i1 undef, label %while.end220, label %while.body211
283 while.end220: ; preds = %while.body211, %if.then136.us
284 br label %for.cond246.outer
286 for.cond246.outer: ; preds = %for.inc558, %for.cond394.preheader, %if.then274, %for.cond404.preheader, %while.end220
287 br label %for.cond246
289 for.cond246: ; preds = %for.cond372.loopexit, %for.cond246.outer
290 br i1 undef, label %for.end562, label %if.end250
292 if.end250: ; preds = %for.cond246
293 br i1 undef, label %if.end256, label %for.end562
295 if.end256: ; preds = %if.end250
296 br i1 undef, label %if.then274, label %for.cond404.preheader
298 for.cond404.preheader: ; preds = %if.end256
299 br i1 undef, label %for.cond246.outer, label %for.body409.lr.ph
301 for.body409.lr.ph: ; preds = %for.cond404.preheader
302 br label %for.body409
304 if.then274: ; preds = %if.end256
305 br i1 undef, label %for.cond246.outer, label %if.end309
307 if.end309: ; preds = %if.then274
308 br i1 undef, label %for.cond372.loopexit, label %for.body361
310 for.body361: ; preds = %for.body361, %if.end309
311 br i1 undef, label %for.cond372.loopexit, label %for.body361
313 for.cond372.loopexit: ; preds = %for.body361, %if.end309
314 br i1 undef, label %for.cond394.preheader, label %for.cond246
316 for.cond394.preheader: ; preds = %for.cond372.loopexit
317 br i1 undef, label %for.cond246.outer, label %for.body397
319 for.body397: ; preds = %for.cond394.preheader
322 for.body409: ; preds = %for.inc558, %for.body409.lr.ph
323 br i1 undef, label %if.then412, label %if.else433
325 if.then412: ; preds = %for.body409
328 if.else433: ; preds = %for.body409
331 if.end440: ; preds = %if.else433, %if.then412
332 br i1 undef, label %for.inc558, label %if.end461
334 if.end461: ; preds = %if.end440
335 br i1 undef, label %for.cond528.loopexit, label %for.body517
337 for.body517: ; preds = %for.body517, %if.end461
338 br i1 undef, label %for.cond528.loopexit, label %for.body517
340 for.cond528.loopexit: ; preds = %for.body517, %if.end461
343 for.inc558: ; preds = %for.cond528.loopexit, %if.end440
344 br i1 undef, label %for.cond246.outer, label %for.body409
346 for.end562: ; preds = %if.end250, %for.cond246
349 for.cond612: ; preds = %while.body119.lr.ph.lr.ph, %if.end115
353 define void @test4() nounwind uwtable ssp {
355 br i1 undef, label %if.end8, label %if.else
357 if.else: ; preds = %entry
360 if.end8: ; preds = %if.else, %entry
361 br i1 undef, label %if.end26, label %if.else22
363 if.else22: ; preds = %if.end8
366 if.end26: ; preds = %if.else22, %if.end8
367 br i1 undef, label %if.end35, label %if.else31
369 if.else31: ; preds = %if.end26
372 if.end35: ; preds = %if.else31, %if.end26
373 br i1 undef, label %for.end226, label %for.body.lr.ph
375 for.body.lr.ph: ; preds = %if.end35
378 for.body48: ; preds = %for.inc221, %for.body.lr.ph
379 br i1 undef, label %for.inc221, label %for.body65.lr.ph
381 for.body65.lr.ph: ; preds = %for.body48
382 %0 = load i32, i32* undef, align 4
383 %1 = sext i32 %0 to i64
384 br label %for.body65.us
386 for.body65.us: ; preds = %for.inc219.us, %for.body65.lr.ph
387 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc219.us ], [ 1, %for.body65.lr.ph ]
388 br i1 undef, label %for.inc219.us, label %if.end72.us
390 if.end72.us: ; preds = %for.body65.us
391 br i1 undef, label %if.end93.us, label %if.then76.us
393 if.then76.us: ; preds = %if.end72.us
394 br label %if.end93.us
396 if.end93.us: ; preds = %if.then76.us, %if.end72.us
397 br i1 undef, label %if.end110.us, label %for.inc219.us
399 if.end110.us: ; preds = %if.end93.us
400 br i1 undef, label %for.inc219.us, label %for.body142.us
402 for.body142.us: ; preds = %for.cond139.loopexit.us, %if.end110.us
403 br label %for.cond152.us
405 for.cond152.us: ; preds = %for.cond152.us, %for.body142.us
406 br i1 undef, label %for.cond139.loopexit.us, label %for.cond152.us
408 for.inc219.us: ; preds = %for.cond139.loopexit.us, %if.end110.us, %if.end93.us, %for.body65.us
409 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
410 %cmp64.us = icmp sgt i64 %indvars.iv.next, %1
411 br i1 %cmp64.us, label %for.inc221, label %for.body65.us
413 for.cond139.loopexit.us: ; preds = %for.cond152.us
414 br i1 undef, label %for.inc219.us, label %for.body142.us
416 for.inc221: ; preds = %for.inc219.us, %for.body48
419 for.end226: ; preds = %if.end35