a90c8049027d27e0b712d26329a4faa086022a7d
[oota-llvm.git] / test / Analysis / ScalarEvolution / 2008-07-29-SMinExpr.ll
1 ; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output \
2 ; RUN:   -scalar-evolution-max-iterations=0 | \
3 ; RUN: grep -F "backedge-taken count is (-2147483632 + (2147483632 smax (-1 + (-1 * %x)) smax (-1 + (-1 * %y))))"
4 ; PR2607
5
6 define i32 @b(i32 %x, i32 %y) {
7 entry:
8         %cmp2 = icmp slt i32 %y, %x
9         %cond3 = select i1 %cmp2, i32 %y, i32 %x
10         %cmp54 = icmp slt i32 %cond3, -2147483632
11         br i1 %cmp54, label %forinc, label %afterfor
12
13 forinc:         ; preds = %forinc, %entry
14         %j.01 = phi i32 [ %dec, %forinc ], [ -2147483632, %entry ]
15         %dec = add i32 %j.01, -1
16         %cmp = icmp slt i32 %y, %x
17         %cond = select i1 %cmp, i32 %y, i32 %x
18         %cmp5 = icmp sgt i32 %dec, %cond
19         br i1 %cmp5, label %forinc, label %afterfor
20
21 afterfor:               ; preds = %forinc, %entry
22         %j.0.lcssa = phi i32 [ -2147483632, %entry ], [ %dec, %forinc ]
23         ret i32 %j.0.lcssa
24 }