1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 4
2 ; RUN: opt -S -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-classify-expressions=0 < %s 2>&1 | FileCheck %s
4 define void @u_0(i8 %rhs) {
5 ; E.g.: %rhs = 255, %start = 99, backedge taken 156 times
8 ; CHECK-NEXT: Determining loop execution counts for: @u_0
9 ; CHECK-NEXT: Loop %loop: backedge-taken count is (-100 + (-1 * %rhs) + ((100 + %rhs) umax %rhs))
10 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i8 -100, actual taken count either this or zero.
11 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-100 + (-1 * %rhs) + ((100 + %rhs) umax %rhs)), actual taken count either this or zero.
12 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
15 %start = add i8 %rhs, 100
19 %iv = phi i8 [ %start, %entry ], [ %iv.inc, %loop ]
20 %iv.inc = add nuw i8 %iv, 1 ;; Note: this never unsigned-wraps
21 %iv.cmp = icmp ult i8 %iv, %rhs
22 br i1 %iv.cmp, label %loop, label %leave
29 define void @u_1(i8 %start) {
32 ; CHECK-NEXT: Determining loop execution counts for: @u_1
33 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((-1 * %start) + ((-100 + %start) umax %start))
34 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i8 -100, actual taken count either this or zero.
35 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-1 * %start) + ((-100 + %start) umax %start)), actual taken count either this or zero.
36 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
39 ; E.g.: %start = 99, %rhs = 255, backedge taken 156 times
40 %rhs = add i8 %start, -100
44 %iv = phi i8 [ %start, %entry ], [ %iv.inc, %loop ]
45 %iv.inc = add nuw i8 %iv, 1 ;; Note: this never unsigned-wraps
46 %iv.cmp = icmp ult i8 %iv, %rhs
47 br i1 %iv.cmp, label %loop, label %leave
54 define void @s_0(i8 %rhs) {
57 ; CHECK-NEXT: Determining loop execution counts for: @s_0
58 ; CHECK-NEXT: Loop %loop: backedge-taken count is (-100 + (-1 * %rhs) + ((100 + %rhs) smax %rhs))
59 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i8 -100, actual taken count either this or zero.
60 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (-100 + (-1 * %rhs) + ((100 + %rhs) smax %rhs)), actual taken count either this or zero.
61 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
64 ; E.g.: %rhs = 127, %start = -29, backedge taken 156 times
65 %start = add i8 %rhs, 100
69 %iv = phi i8 [ %start, %entry ], [ %iv.inc, %loop ]
70 %iv.inc = add nsw i8 %iv, 1 ;; Note: this never signed-wraps
71 %iv.cmp = icmp slt i8 %iv, %rhs
72 br i1 %iv.cmp, label %loop, label %leave
79 define void @s_1(i8 %start) {
82 ; CHECK-NEXT: Determining loop execution counts for: @s_1
83 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((-1 * %start) + ((-100 + %start) smax %start))
84 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i8 -100, actual taken count either this or zero.
85 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-1 * %start) + ((-100 + %start) smax %start)), actual taken count either this or zero.
86 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
89 ; E.g.: start = -29, %rhs = 127, %backedge taken 156 times
90 %rhs = add i8 %start, -100
94 %iv = phi i8 [ %start, %entry ], [ %iv.inc, %loop ]
95 %iv.inc = add nsw i8 %iv, 1
96 %iv.cmp = icmp slt i8 %iv, %rhs
97 br i1 %iv.cmp, label %loop, label %leave
104 define void @s_2(i8 %start) {
107 ; CHECK-NEXT: Determining loop execution counts for: @s_2
108 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((-1 * ((-100 + %start) smin %start)) + %start)
109 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i8 -1
110 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-1 * ((-100 + %start) smin %start)) + %start)
111 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
114 %rhs = add i8 %start, -100
118 %iv = phi i8 [ %start, %entry ], [ %iv.inc, %loop ]
119 %iv.inc = add nsw i8 %iv, -1
120 %iv.cmp = icmp sgt i8 %iv, %rhs
121 br i1 %iv.cmp, label %loop, label %leave