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"
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
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