1; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
2; PR1101
3
4@A = weak global [1000 x i32] zeroinitializer, align 32
5
6; CHECK: backedge-taken count is 4
7
8define void @test(i32 %N) {
9entry:
10        br label %bb3
11
12bb:             ; preds = %bb3
13        %tmp = getelementptr [1000 x i32], [1000 x i32]* @A, i32 0, i32 %i.0          ; <i32*> [#uses=1]
14        store i32 123, i32* %tmp
15        %tmp4 = mul i32 %i.0, 4         ; <i32> [#uses=1]
16        %tmp5 = or i32 %tmp4, 1
17        %tmp61 = xor i32 %tmp5, -2147483648
18        %tmp6 = trunc i32 %tmp61 to i16
19        %tmp71 = shl i16 %tmp6, 2
20        %tmp7 = zext i16 %tmp71 to i32
21        %tmp2 = add i32 %tmp7, %i.0
22        br label %bb3
23
24bb3:            ; preds = %bb, %entry
25        %i.0 = phi i32 [ 0, %entry ], [ %tmp2, %bb ]            ; <i32> [#uses=3]
26        %tmp3 = icmp sle i32 %i.0, 9999          ; <i1> [#uses=1]
27        br i1 %tmp3, label %bb, label %bb5
28
29bb5:            ; preds = %bb3
30        br label %return
31
32return:         ; preds = %bb5
33        ret void
34}
35