blob: 6bacfabd4d72dee2a51f0bfed9fb1d184ac105ed [file] [log] [blame]
Nick Lewyckyc768d382008-11-18 15:10:54 +00001; RUN: llvm-as < %s | opt -analyze -scalar-evolution |& \
2; RUN: grep {Loop bb: (7 + (-1 \\* %argc)) iterations!}
3
4define i32 @main(i32 %argc, i8** %argv) nounwind {
5entry:
6 %0 = icmp ugt i32 %argc, 7 ; <i1> [#uses=1]
7 br i1 %0, label %bb2, label %bb.nph
8
9bb.nph: ; preds = %entry
10 br label %bb
11
12bb: ; 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
19bb1: ; 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
24bb1.bb2_crit_edge: ; preds = %bb1
25 br label %bb2
26
27bb2: ; preds = %bb1.bb2_crit_edge, %entry
28 ret i32 0
29}
30
31declare void @Test(...)