Another testcase
[oota-llvm.git] / test / Transforms / IndVarsSimplify / 2003-12-10-IndVarDeadCode.ll
1 ; The induction variable canonicalization pass shouldn't leave dead
2 ; instructions laying around!
3 ;
4 ; RUN: llvm-as < %s | opt -indvars | llvm-dis | not grep '#uses=0'
5
6 int %mul(int %x, int %y) {
7 entry:
8         br label %tailrecurse
9
10 tailrecurse:            ; preds = %entry, %endif
11         %accumulator.tr = phi int [ %x, %entry ], [ %tmp.9, %endif ]            ; <int> [#uses=2]
12         %y.tr = phi int [ %y, %entry ], [ %tmp.8, %endif ]              ; <int> [#uses=2]
13         %tmp.1 = seteq int %y.tr, 0             ; <bool> [#uses=1]
14         br bool %tmp.1, label %return, label %endif
15
16 endif:          ; preds = %tailrecurse
17         %tmp.8 = add int %y.tr, -1              ; <int> [#uses=1]
18         %tmp.9 = add int %accumulator.tr, %x            ; <int> [#uses=1]
19         br label %tailrecurse
20
21 return:         ; preds = %tailrecurse
22         ret int %accumulator.tr
23 }