blob: 4c99bc73880bace3a352dc2dcc53a3033c8386da [file] [log] [blame]
Michael Zolotukhin8c681712015-05-12 17:20:03 +00001; Check that we don't crash on corner cases.
2; RUN: opt < %s -S -loop-unroll -unroll-max-iteration-count-to-analyze=1000 -unroll-absolute-threshold=10 -unroll-threshold=10 -unroll-percent-of-optimized-for-complete-unroll=20 -o /dev/null
3target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
4
5define void @foo1() {
6entry:
7 br label %for.body
8
9for.body:
10 %phi = phi i64 [ 0, %entry ], [ %inc, %for.body ]
11 %idx = zext i32 undef to i64
12 %add.ptr = getelementptr inbounds i64, i64* null, i64 %idx
13 %inc = add nuw nsw i64 %phi, 1
14 %cmp = icmp ult i64 %inc, 999
15 br i1 %cmp, label %for.body, label %for.exit
16
17for.exit:
18 ret void
19}
20
21define void @foo2() {
22entry:
23 br label %for.body
24
25for.body:
26 %phi = phi i64 [ 0, %entry ], [ %inc, %for.body ]
27 %x = getelementptr i32, <4 x i32*> undef, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
28 %inc = add nuw nsw i64 %phi, 1
29 %cmp = icmp ult i64 %inc, 999
30 br i1 %cmp, label %for.body, label %for.exit
31
32for.exit:
33 ret void
34}