new testcase
[oota-llvm.git] / test / Transforms / IndVarsSimplify / lftr_simple.llx
1 ; LFTR should eliminate the need for the computation of i*i completely.  It 
2 ; is only used to compute the exit value.
3 ; RUN: llvm-as < %s | opt -indvars -dce | llvm-dis | not grep mul
4
5 %A = external global int
6
7 implementation
8
9 int %quadratic_setlt() {   ;; for (i = 7; i*i < 1000; ++i)
10 entry:
11         br label %loop
12 loop:
13         %i = phi int [ 7, %entry ], [ %i.next, %loop ]
14         %i.next = add int %i, 1
15         store int %i, int* %A
16         
17         %i2 = mul int %i, %i
18         %c = setlt int %i2, 1000
19         br bool %c, label %loop, label %loopexit
20 loopexit:
21         ret int %i
22 }
23