[Unroll] Rework the naming and structure of the new unroll heuristics.
[oota-llvm.git] / test / Transforms / LoopUnroll / full-unroll-bad-geps.ll
1 ; Check that we don't crash on corner cases.
2 ; RUN: opt < %s -S -loop-unroll -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=10 -unroll-percent-dynamic-cost-saved-threshold=20 -o /dev/null
3 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
4
5 define void @foo1() {
6 entry:
7   br label %for.body
8
9 for.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
17 for.exit:
18   ret void
19 }
20
21 define void @foo2() {
22 entry:
23   br label %for.body
24
25 for.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
32 for.exit:
33   ret void
34 }