Nick Lewycky | c768d38 | 2008-11-18 15:10:54 +0000 | [diff] [blame^] | 1 | ; RUN: llvm-as < %s | opt -analyze -scalar-evolution |& \ |
| 2 | ; RUN: grep {Loop bb: (7 + (-1 \\* %argc)) iterations!} |
| 3 | |
| 4 | define i32 @main(i32 %argc, i8** %argv) nounwind { |
| 5 | entry: |
| 6 | %0 = icmp ugt i32 %argc, 7 ; <i1> [#uses=1] |
| 7 | br i1 %0, label %bb2, label %bb.nph |
| 8 | |
| 9 | bb.nph: ; preds = %entry |
| 10 | br label %bb |
| 11 | |
| 12 | bb: ; preds = %bb.nph, %bb1 |
| 13 | %indvar = phi i32 [ 0, %bb.nph ], [ %indvar.next, %bb1 ] ; <i32> [#uses=2] |
| 14 | %argc_addr.04 = add i32 %indvar, %argc ; <i32> [#uses=1] |
| 15 | tail call void (...)* @Test() nounwind |
| 16 | %1 = add i32 %argc_addr.04, 1 ; <i32> [#uses=1] |
| 17 | br label %bb1 |
| 18 | |
| 19 | bb1: ; preds = %bb |
| 20 | %phitmp = icmp ugt i32 %1, 7 ; <i1> [#uses=1] |
| 21 | %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1] |
| 22 | br i1 %phitmp, label %bb1.bb2_crit_edge, label %bb |
| 23 | |
| 24 | bb1.bb2_crit_edge: ; preds = %bb1 |
| 25 | br label %bb2 |
| 26 | |
| 27 | bb2: ; preds = %bb1.bb2_crit_edge, %entry |
| 28 | ret i32 0 |
| 29 | } |
| 30 | |
| 31 | declare void @Test(...) |