1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2 ; RUN: opt -S -disable-output "-passes=print<scalar-evolution>" < %s 2>&1 | FileCheck %s
4 define void @umin_unsigned_check(i64 %n) {
5 ; CHECK-LABEL: 'umin_unsigned_check'
6 ; CHECK-NEXT: Classifying expressions for: @umin_unsigned_check
7 ; CHECK-NEXT: %min.n = select i1 %min.cmp, i64 4096, i64 %n
8 ; CHECK-NEXT: --> (4096 umin %n) U: [0,4097) S: [0,4097)
9 ; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
10 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,4098) S: [0,4098) Exits: (1 + (4096 umin %n))<nuw><nsw> LoopDispositions: { %loop: Computable }
11 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
12 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,4099) S: [1,4099) Exits: (2 + (4096 umin %n))<nuw><nsw> LoopDispositions: { %loop: Computable }
13 ; CHECK-NEXT: Determining loop execution counts for: @umin_unsigned_check
14 ; CHECK-NEXT: Loop %loop: backedge-taken count is (1 + (4096 umin %n))<nuw><nsw>
15 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 4097
16 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (1 + (4096 umin %n))<nuw><nsw>
17 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (1 + (4096 umin %n))<nuw><nsw>
18 ; CHECK-NEXT: Predicates:
19 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
22 %min.cmp = icmp ult i64 4096, %n
23 %min.n = select i1 %min.cmp, i64 4096, i64 %n
26 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
27 %iv.next = add i64 %iv, 1
28 %exit = icmp ugt i64 %iv, %min.n
29 br i1 %exit, label %loop_exit, label %loop
35 define void @umin_signed_check(i64 %n) {
36 ; CHECK-LABEL: 'umin_signed_check'
37 ; CHECK-NEXT: Classifying expressions for: @umin_signed_check
38 ; CHECK-NEXT: %min.n = select i1 %min.cmp, i64 4096, i64 %n
39 ; CHECK-NEXT: --> (4096 umin %n) U: [0,4097) S: [0,4097)
40 ; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
41 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,4098) S: [0,4098) Exits: (1 + (4096 umin %n))<nuw><nsw> LoopDispositions: { %loop: Computable }
42 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
43 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,4099) S: [1,4099) Exits: (2 + (4096 umin %n))<nuw><nsw> LoopDispositions: { %loop: Computable }
44 ; CHECK-NEXT: Determining loop execution counts for: @umin_signed_check
45 ; CHECK-NEXT: Loop %loop: backedge-taken count is (1 + (4096 umin %n))<nuw><nsw>
46 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 4097
47 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (1 + (4096 umin %n))<nuw><nsw>
48 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (1 + (4096 umin %n))<nuw><nsw>
49 ; CHECK-NEXT: Predicates:
50 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
53 %min.cmp = icmp ult i64 4096, %n
54 %min.n = select i1 %min.cmp, i64 4096, i64 %n
57 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
58 %iv.next = add i64 %iv, 1
59 %exit = icmp sgt i64 %iv, %min.n
60 br i1 %exit, label %loop_exit, label %loop
66 define void @smin_signed_check(i64 %n) {
67 ; CHECK-LABEL: 'smin_signed_check'
68 ; CHECK-NEXT: Classifying expressions for: @smin_signed_check
69 ; CHECK-NEXT: %min.n = select i1 %min.cmp, i64 4096, i64 %n
70 ; CHECK-NEXT: --> (4096 smin %n) U: [-9223372036854775808,4097) S: [-9223372036854775808,4097)
71 ; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
72 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,4098) S: [0,4098) Exits: (0 smax (1 + (4096 smin %n))<nsw>) LoopDispositions: { %loop: Computable }
73 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
74 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,4099) S: [1,4099) Exits: (1 + (0 smax (1 + (4096 smin %n))<nsw>))<nuw><nsw> LoopDispositions: { %loop: Computable }
75 ; CHECK-NEXT: Determining loop execution counts for: @smin_signed_check
76 ; CHECK-NEXT: Loop %loop: backedge-taken count is (0 smax (1 + (4096 smin %n))<nsw>)
77 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 4097
78 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (0 smax (1 + (4096 smin %n))<nsw>)
79 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (0 smax (1 + (4096 smin %n))<nsw>)
80 ; CHECK-NEXT: Predicates:
81 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
84 %min.cmp = icmp slt i64 4096, %n
85 %min.n = select i1 %min.cmp, i64 4096, i64 %n
88 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
89 %iv.next = add i64 %iv, 1
90 %exit = icmp sgt i64 %iv, %min.n
91 br i1 %exit, label %loop_exit, label %loop
97 define void @smin_unsigned_check(i64 %n) {
98 ; CHECK-LABEL: 'smin_unsigned_check'
99 ; CHECK-NEXT: Classifying expressions for: @smin_unsigned_check
100 ; CHECK-NEXT: %min.n = select i1 %min.cmp, i64 4096, i64 %n
101 ; CHECK-NEXT: --> (4096 smin %n) U: [-9223372036854775808,4097) S: [-9223372036854775808,4097)
102 ; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
103 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
104 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
105 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
106 ; CHECK-NEXT: Determining loop execution counts for: @smin_unsigned_check
107 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
108 ; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
109 ; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
110 ; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count.
113 %min.cmp = icmp slt i64 4096, %n
114 %min.n = select i1 %min.cmp, i64 4096, i64 %n
117 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
118 %iv.next = add i64 %iv, 1
119 %exit = icmp ugt i64 %iv, %min.n
120 br i1 %exit, label %loop_exit, label %loop