1 ; RUN: opt < %s "-passes=print<scalar-evolution>" -disable-output 2>&1 | FileCheck %s
3 define void @test1(i32 %n) {
8 %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
9 %i.next = add i32 %i, 32
10 %t = icmp ne i32 %i.next, %s
11 br i1 %t, label %loop, label %exit
16 ; CHECK: Loop %loop: backedge-taken count is ((-32 + (96 * %n)) /u 32)
17 ; CHECK: Loop %loop: constant max backedge-taken count is 134217727
21 define i32 @test2(i32 %n) {
26 %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
27 %i.next = add i32 %i, 32
28 %t = icmp ne i32 %i.next, %s
29 br i1 %t, label %loop, label %exit
34 ; CHECK: Loop %loop: backedge-taken count is ((-32 + (32 * (%n /u 32))<nuw>) /u 32)
35 ; CHECK: Loop %loop: constant max backedge-taken count is 134217727
38 define void @test3(i32 %n) {
43 %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
44 %i.next = add i32 %i, 96
45 %t = icmp ne i32 %i.next, %s
46 br i1 %t, label %loop, label %exit
51 ; CHECK: Loop %loop: backedge-taken count is ((-32 + (32 * %n)) /u 32)
52 ; CHECK: Loop %loop: constant max backedge-taken count is 134217727
55 define void @test4(i32 %n) {
60 %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
61 %i.next = add i32 %i, 12
62 %t = icmp ne i32 %i.next, %s
63 br i1 %t, label %loop, label %exit
68 ; CHECK: Loop %loop: backedge-taken count is ((-4 + (-1431655764 * %n)) /u 4)
69 ; CHECK: Loop %loop: constant max backedge-taken count is 1073741823
72 define void @test5(i32 %n) {
77 %i = phi i32 [ %s, %entry ], [ %i.next, %loop ]
78 %i.next = add i32 %i, -4
79 %t = icmp ne i32 %i.next, 0
80 br i1 %t, label %loop, label %exit
85 ; CHECK: Loop %loop: backedge-taken count is ((-4 + (4 * %n)) /u 4)
86 ; CHECK: Loop %loop: constant max backedge-taken count is 1073741823