indvars: Improve LFTR by eliminating truncation when comparing against a constant.
[oota-llvm.git] / test / Transforms / IndVarSimplify / exitcnt-const-arstart-const-opt.ll
1 ;RUN: opt -S %s -indvars | FileCheck %s
2
3 ; Function Attrs: nounwind uwtable
4 define void @foo() #0 {
5 entry:
6   br label %for.body
7
8 for.body:                                         ; preds = %entry, %for.body
9   %i.01 = phi i16 [ 0, %entry ], [ %inc, %for.body ]
10   %conv2 = sext i16 %i.01 to i32
11   call void @bar(i32 %conv2) #1
12   %inc = add i16 %i.01, 1
13 ;CHECK-NOT: %lftr.wideiv = trunc i32 %indvars.iv.next to i16
14 ;CHECK: %exitcond = icmp ne i32 %indvars.iv.next, 512
15   %cmp = icmp slt i16 %inc, 512
16   br i1 %cmp, label %for.body, label %for.end
17
18 for.end:                                          ; preds = %for.body
19   ret void
20 }
21
22 declare void @bar(i32)
23
24 attributes #0 = { nounwind uwtable }
25 attributes #1 = { nounwind }