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 i64 4097
16 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (1 + (4096 umin %n))<nuw><nsw>
17 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
20 %min.cmp = icmp ult i64 4096, %n
21 %min.n = select i1 %min.cmp, i64 4096, i64 %n
24 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
25 %iv.next = add i64 %iv, 1
26 %exit = icmp ugt i64 %iv, %min.n
27 br i1 %exit, label %loop_exit, label %loop
33 define void @umin_signed_check(i64 %n) {
34 ; CHECK-LABEL: 'umin_signed_check'
35 ; CHECK-NEXT: Classifying expressions for: @umin_signed_check
36 ; CHECK-NEXT: %min.n = select i1 %min.cmp, i64 4096, i64 %n
37 ; CHECK-NEXT: --> (4096 umin %n) U: [0,4097) S: [0,4097)
38 ; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
39 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,4098) S: [0,4098) Exits: (1 + (4096 umin %n))<nuw><nsw> LoopDispositions: { %loop: Computable }
40 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
41 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,4099) S: [1,4099) Exits: (2 + (4096 umin %n))<nuw><nsw> LoopDispositions: { %loop: Computable }
42 ; CHECK-NEXT: Determining loop execution counts for: @umin_signed_check
43 ; CHECK-NEXT: Loop %loop: backedge-taken count is (1 + (4096 umin %n))<nuw><nsw>
44 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i64 4097
45 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (1 + (4096 umin %n))<nuw><nsw>
46 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
49 %min.cmp = icmp ult i64 4096, %n
50 %min.n = select i1 %min.cmp, i64 4096, i64 %n
53 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
54 %iv.next = add i64 %iv, 1
55 %exit = icmp sgt i64 %iv, %min.n
56 br i1 %exit, label %loop_exit, label %loop
62 define void @smin_signed_check(i64 %n) {
63 ; CHECK-LABEL: 'smin_signed_check'
64 ; CHECK-NEXT: Classifying expressions for: @smin_signed_check
65 ; CHECK-NEXT: %min.n = select i1 %min.cmp, i64 4096, i64 %n
66 ; CHECK-NEXT: --> (4096 smin %n) U: [-9223372036854775808,4097) S: [-9223372036854775808,4097)
67 ; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
68 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,4098) S: [0,4098) Exits: (0 smax (1 + (4096 smin %n))<nsw>) LoopDispositions: { %loop: Computable }
69 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
70 ; 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 }
71 ; CHECK-NEXT: Determining loop execution counts for: @smin_signed_check
72 ; CHECK-NEXT: Loop %loop: backedge-taken count is (0 smax (1 + (4096 smin %n))<nsw>)
73 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i64 4097
74 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (0 smax (1 + (4096 smin %n))<nsw>)
75 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
78 %min.cmp = icmp slt i64 4096, %n
79 %min.n = select i1 %min.cmp, i64 4096, i64 %n
82 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
83 %iv.next = add i64 %iv, 1
84 %exit = icmp sgt i64 %iv, %min.n
85 br i1 %exit, label %loop_exit, label %loop
91 define void @smin_unsigned_check(i64 %n) {
92 ; CHECK-LABEL: 'smin_unsigned_check'
93 ; CHECK-NEXT: Classifying expressions for: @smin_unsigned_check
94 ; CHECK-NEXT: %min.n = select i1 %min.cmp, i64 4096, i64 %n
95 ; CHECK-NEXT: --> (4096 smin %n) U: [-9223372036854775808,4097) S: [-9223372036854775808,4097)
96 ; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
97 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
98 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
99 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
100 ; CHECK-NEXT: Determining loop execution counts for: @smin_unsigned_check
101 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
102 ; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
103 ; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
106 %min.cmp = icmp slt i64 4096, %n
107 %min.n = select i1 %min.cmp, i64 4096, i64 %n
110 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
111 %iv.next = add i64 %iv, 1
112 %exit = icmp ugt i64 %iv, %min.n
113 br i1 %exit, label %loop_exit, label %loop