1; RUN: opt < %s -analyze -enable-new-pm=0 -scalar-evolution | FileCheck %s
2; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" 2>&1 | FileCheck %s
3; PR4569
4
5define i16 @main() nounwind {
6entry:
7        br label %bb.i
8
9bb.i:           ; preds = %bb1.i, %bb.nph
10; We should be able to find the range for this expression.
11; CHECK: %l_95.0.i1 = phi i8
12; CHECK: -->  {0,+,-1}<%bb.i> U: [2,1) S: [2,1){{ *}}Exits: 2
13
14        %l_95.0.i1 = phi i8 [ %tmp1, %bb.i ], [ 0, %entry ]
15
16; This cast shouldn't be folded into the addrec.
17; CHECK: %tmp = zext i8 %l_95.0.i1 to i16
18; CHECK: -->  (zext i8 {0,+,-1}<%bb.i> to i16){{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 2
19
20        %tmp = zext i8 %l_95.0.i1 to i16
21
22        %tmp1 = add i8 %l_95.0.i1, -1
23        %phitmp = icmp eq i8 %tmp1, 1
24        br i1 %phitmp, label %bb1.i.func_36.exit_crit_edge, label %bb.i
25
26bb1.i.func_36.exit_crit_edge:
27        ret i16 %tmp
28}
29