1 ; RUN: opt < %s -analyze -scalar-evolution -disable-output \
2 ; RUN: -scalar-evolution-max-iterations=0 | \
3 ; RUN: grep -F "backedge-taken count is (-2147483632 + ((-1 + (-1 * %x)) smax (-1 + (-1 * %y))))"
6 define i32 @b(i32 %x, i32 %y) nounwind {
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
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
21 afterfor: ; preds = %forinc, %entry
22 %j.0.lcssa = phi i32 [ -2147483632, %entry ], [ %dec, %forinc ]