Devang Patel | 5e98a99 | 2007-08-17 22:02:15 +0000 | [diff] [blame] | 1 | ; Loop is elimianted. Save last value assignments, including induction variable. |
Dan Gohman | 3c7d308 | 2009-09-11 18:01:28 +0000 | [diff] [blame] | 2 | ; RUN: opt < %s -loop-index-split -disable-output -stats | not grep "loop-index-split" |
Devang Patel | 5e98a99 | 2007-08-17 22:02:15 +0000 | [diff] [blame] | 3 | |
| 4 | declare i32 @foo(i32) |
| 5 | declare i32 @bar(i32, i32) |
| 6 | |
| 7 | define void @foobar(i32 %a, i32 %b) { |
| 8 | entry: |
| 9 | br label %bb |
| 10 | |
| 11 | bb: ; preds = %cond_next, %entry |
| 12 | %i.01.0 = phi i32 [ 0, %entry ], [ %tmp8, %cond_next ] ; <i32> [#uses=3] |
| 13 | %tsum.16.0 = phi i32 [ 42, %entry ], [ %tsum.0, %cond_next ] ; <i32> [#uses=2] |
| 14 | %tmp1 = icmp eq i32 %i.01.0, 50 ; <i1> [#uses=1] |
| 15 | br i1 %tmp1, label %cond_true, label %cond_next |
| 16 | |
| 17 | cond_true: ; preds = %bb |
| 18 | %tmp4 = tail call i32 @foo( i32 %i.01.0 ) ; <i32> [#uses=1] |
| 19 | %tmp6 = add i32 %tmp4, %tsum.16.0 ; <i32> [#uses=1] |
| 20 | br label %cond_next |
| 21 | |
| 22 | cond_next: ; preds = %bb, %cond_true |
| 23 | %tsum.0 = phi i32 [ %tmp6, %cond_true ], [ %tsum.16.0, %bb ] ; <i32> [#uses=2] |
| 24 | %tmp8 = add i32 %i.01.0, 1 ; <i32> [#uses=3] |
| 25 | %tmp11 = icmp slt i32 %tmp8, 100 ; <i1> [#uses=1] |
| 26 | br i1 %tmp11, label %bb, label %bb14 |
| 27 | |
| 28 | bb14: ; preds = %cond_next |
| 29 | %tmp8.lcssa = phi i32 [ %tmp8, %cond_next ] ; <i32> [#uses=1] |
| 30 | %tsum.0.lcssa = phi i32 [ %tsum.0, %cond_next ] ; <i32> [#uses=1] |
| 31 | %tmp17 = tail call i32 @bar( i32 %tmp8.lcssa, i32 %tsum.0.lcssa ) ; <i32> [#uses=0] |
| 32 | ret void |
| 33 | } |
| 34 | |