Stop creating extraneous smax/umax in SCEV. This removes a regression where we
[oota-llvm.git] / test / Analysis / ScalarEvolution / 2008-06-12-BinomialInt64.ll
1 ; RUN: llvm-as < %s | opt -analyze -scalar-evolution 2>/dev/null
2 ; PR2433
3
4 define i32 @main1(i32 %argc, i8** %argv) nounwind  {
5 entry:
6         br i1 false, label %bb10, label %bb23
7
8 bb10:           ; preds = %bb10, %entry
9         %accum.03 = phi i64 [ %tmp14, %bb10 ], [ 0, %entry ]            ; <i64> [#uses=1]
10         %i.02 = phi i32 [ %tmp16, %bb10 ], [ 0, %entry ]                ; <i32> [#uses=1]
11         %d.1.01 = phi i64 [ %tmp5.i, %bb10 ], [ 0, %entry ]             ; <i64> [#uses=1]
12         %tmp5.i = add i64 %d.1.01, 1            ; <i64> [#uses=2]
13         %tmp14 = add i64 %accum.03, %tmp5.i             ; <i64> [#uses=2]
14         %tmp16 = add i32 %i.02, 1               ; <i32> [#uses=2]
15         %tmp20 = icmp slt i32 %tmp16, 0         ; <i1> [#uses=1]
16         br i1 %tmp20, label %bb10, label %bb23
17
18 bb23:           ; preds = %bb10, %entry
19         %accum.0.lcssa = phi i64 [ 0, %entry ], [ %tmp14, %bb10 ]               ; <i64> [#uses=0]
20         ret i32 0
21 }
22
23 define i32 @main2(i32 %argc, i8** %argv) {
24 entry:
25         %tmp8 = tail call i32 @atoi( i8* null ) nounwind readonly               ; <i32> [#uses=1]
26         br i1 false, label %bb9, label %bb21
27
28 bb9:            ; preds = %bb9, %entry
29         %accum.03 = phi i64 [ %tmp12, %bb9 ], [ 0, %entry ]             ; <i64> [#uses=1]
30         %i.02 = phi i32 [ %tmp14, %bb9 ], [ 0, %entry ]         ; <i32> [#uses=1]
31         %d.1.01 = phi i64 [ %tmp4.i, %bb9 ], [ 0, %entry ]              ; <i64> [#uses=1]
32         %tmp4.i = add i64 %d.1.01, 1            ; <i64> [#uses=2]
33         %tmp12 = add i64 %accum.03, %tmp4.i             ; <i64> [#uses=2]
34         %tmp14 = add i32 %i.02, 1               ; <i32> [#uses=2]
35         %tmp18 = icmp slt i32 %tmp14, %tmp8             ; <i1> [#uses=1]
36         br i1 %tmp18, label %bb9, label %bb21
37
38 bb21:           ; preds = %bb9, %entry
39         %accum.0.lcssa = phi i64 [ 0, %entry ], [ %tmp12, %bb9 ]                ; <i64> [#uses=0]
40         ret i32 0
41 }
42
43 declare i32 @atoi(i8*) nounwind readonly