Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame^] | 1 | ; The induction variable canonicalization pass shouldn't leave dead |
| 2 | ; instructions laying around! |
| 3 | ; |
| 4 | ; RUN: llvm-upgrade < %s | llvm-as | opt -indvars | llvm-dis | \ |
| 5 | ; RUN: not grep {#uses=0} |
| 6 | |
| 7 | int %mul(int %x, int %y) { |
| 8 | entry: |
| 9 | br label %tailrecurse |
| 10 | |
| 11 | tailrecurse: ; preds = %entry, %endif |
| 12 | %accumulator.tr = phi int [ %x, %entry ], [ %tmp.9, %endif ] ; <int> [#uses=2] |
| 13 | %y.tr = phi int [ %y, %entry ], [ %tmp.8, %endif ] ; <int> [#uses=2] |
| 14 | %tmp.1 = seteq int %y.tr, 0 ; <bool> [#uses=1] |
| 15 | br bool %tmp.1, label %return, label %endif |
| 16 | |
| 17 | endif: ; preds = %tailrecurse |
| 18 | %tmp.8 = add int %y.tr, -1 ; <int> [#uses=1] |
| 19 | %tmp.9 = add int %accumulator.tr, %x ; <int> [#uses=1] |
| 20 | br label %tailrecurse |
| 21 | |
| 22 | return: ; preds = %tailrecurse |
| 23 | ret int %accumulator.tr |
| 24 | } |