xref: /llvm-project/llvm/test/Analysis/ScalarEvolution/exit-count-select.ll (revision 0d38f21e4ab7fe7cebe76a9d7c218ec54dba1e98)
1509fa8e0SJuneyoung Lee; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2509fa8e0SJuneyoung Lee; RUN: opt -disable-output "-passes=print<scalar-evolution>" %s 2>&1 | FileCheck %s
3509fa8e0SJuneyoung Lee
4509fa8e0SJuneyoung Lee; If m is constant, exact-not-taken is umin(n, m)
5509fa8e0SJuneyoung Lee; https://alive2.llvm.org/ce/z/ZTNXgY
6509fa8e0SJuneyoung Leedefine void @logical_and_m_const(i32 %n) {
7509fa8e0SJuneyoung Lee; CHECK-LABEL: 'logical_and_m_const'
8509fa8e0SJuneyoung Lee; CHECK-NEXT:  Classifying expressions for: @logical_and_m_const
9509fa8e0SJuneyoung Lee; CHECK-NEXT:    %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
107019624eSFlorian Hahn; CHECK-NEXT:    --> {0,+,1}<nuw><nsw><%loop> U: [0,3) S: [0,3) Exits: (2 umin %n) LoopDispositions: { %loop: Computable }
11509fa8e0SJuneyoung Lee; CHECK-NEXT:    %i.next = add i32 %i, 1
127019624eSFlorian Hahn; CHECK-NEXT:    --> {1,+,1}<nuw><nsw><%loop> U: [1,4) S: [1,4) Exits: (1 + (2 umin %n))<nuw><nsw> LoopDispositions: { %loop: Computable }
13509fa8e0SJuneyoung Lee; CHECK-NEXT:    %cond = select i1 %cond_i, i1 %cond_i2, i1 false
148a3efcd4SFlorian Hahn; CHECK-NEXT:    --> (%cond_i2 umin %cond_i) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
15509fa8e0SJuneyoung Lee; CHECK-NEXT:  Determining loop execution counts for: @logical_and_m_const
16509fa8e0SJuneyoung Lee; CHECK-NEXT:  Loop %loop: backedge-taken count is (2 umin %n)
177755c261SPhilip Reames; CHECK-NEXT:  Loop %loop: constant max backedge-taken count is i32 2
18e5fa7eb1SMax Kazantsev; CHECK-NEXT:  Loop %loop: symbolic max backedge-taken count is (2 umin %n)
1988f7dc17SNikita Popov; CHECK-NEXT:  Loop %loop: Trip multiple is 1
20509fa8e0SJuneyoung Lee;
21509fa8e0SJuneyoung Leeentry:
22509fa8e0SJuneyoung Lee  br label %loop
23509fa8e0SJuneyoung Leeloop:
24509fa8e0SJuneyoung Lee  %i = phi i32 [0, %entry], [%i.next, %loop]
25509fa8e0SJuneyoung Lee  %i.next = add i32 %i, 1
26509fa8e0SJuneyoung Lee  %cond_i = icmp ult i32 %i, %n
27509fa8e0SJuneyoung Lee  %cond_i2 = icmp ult i32 %i, 2
28509fa8e0SJuneyoung Lee  %cond = select i1 %cond_i, i1 %cond_i2, i1 false
29509fa8e0SJuneyoung Lee  br i1 %cond, label %loop, label %exit
30509fa8e0SJuneyoung Leeexit:
31509fa8e0SJuneyoung Lee  ret void
32509fa8e0SJuneyoung Lee}
33509fa8e0SJuneyoung Lee
34509fa8e0SJuneyoung Lee; exact-not-taken is umin(2, m) because m participates in the exit branch condition.
35509fa8e0SJuneyoung Lee; https://alive2.llvm.org/ce/z/rCVMmp
36509fa8e0SJuneyoung Leedefine void @logical_and_nonzero(i32 %m) {
37509fa8e0SJuneyoung Lee; CHECK-LABEL: 'logical_and_nonzero'
38509fa8e0SJuneyoung Lee; CHECK-NEXT:  Classifying expressions for: @logical_and_nonzero
39509fa8e0SJuneyoung Lee; CHECK-NEXT:    %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
407019624eSFlorian Hahn; CHECK-NEXT:    --> {0,+,1}<nuw><nsw><%loop> U: [0,3) S: [0,3) Exits: (2 umin %m) LoopDispositions: { %loop: Computable }
41509fa8e0SJuneyoung Lee; CHECK-NEXT:    %i.next = add i32 %i, 1
427019624eSFlorian Hahn; CHECK-NEXT:    --> {1,+,1}<nuw><nsw><%loop> U: [1,4) S: [1,4) Exits: (1 + (2 umin %m))<nuw><nsw> LoopDispositions: { %loop: Computable }
43509fa8e0SJuneyoung Lee; CHECK-NEXT:    %cond = select i1 %cond_i, i1 %cond_i2, i1 false
4416bc24e7SRoman Lebedev; CHECK-NEXT:    --> (%cond_i umin_seq %cond_i2) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
45509fa8e0SJuneyoung Lee; CHECK-NEXT:  Determining loop execution counts for: @logical_and_nonzero
46509fa8e0SJuneyoung Lee; CHECK-NEXT:  Loop %loop: backedge-taken count is (2 umin %m)
477755c261SPhilip Reames; CHECK-NEXT:  Loop %loop: constant max backedge-taken count is i32 2
48e5fa7eb1SMax Kazantsev; CHECK-NEXT:  Loop %loop: symbolic max backedge-taken count is (2 umin %m)
4988f7dc17SNikita Popov; CHECK-NEXT:  Loop %loop: Trip multiple is 1
50509fa8e0SJuneyoung Lee;
51509fa8e0SJuneyoung Leeentry:
52509fa8e0SJuneyoung Lee  br label %loop
53509fa8e0SJuneyoung Leeloop:
54509fa8e0SJuneyoung Lee  %i = phi i32 [0, %entry], [%i.next, %loop]
55509fa8e0SJuneyoung Lee  %i.next = add i32 %i, 1
56509fa8e0SJuneyoung Lee  %cond_i = icmp ult i32 %i, 2
57509fa8e0SJuneyoung Lee  %cond_i2 = icmp ult i32 %i, %m
58509fa8e0SJuneyoung Lee  %cond = select i1 %cond_i, i1 %cond_i2, i1 false
59509fa8e0SJuneyoung Lee  br i1 %cond, label %loop, label %exit
60509fa8e0SJuneyoung Leeexit:
61509fa8e0SJuneyoung Lee  ret void
62509fa8e0SJuneyoung Lee}
63509fa8e0SJuneyoung Lee
64509fa8e0SJuneyoung Lee; exact-not-taken cannot be umin(0, m) because m never participates in the exit branch condition.
65509fa8e0SJuneyoung Lee; https://alive2.llvm.org/ce/z/rlaN4a
66509fa8e0SJuneyoung Lee; Instead, it should be just 0.
67509fa8e0SJuneyoung Leedefine void @logical_and_zero(i32 %m) {
68509fa8e0SJuneyoung Lee; CHECK-LABEL: 'logical_and_zero'
69509fa8e0SJuneyoung Lee; CHECK-NEXT:  Classifying expressions for: @logical_and_zero
70509fa8e0SJuneyoung Lee; CHECK-NEXT:    %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
717019624eSFlorian Hahn; CHECK-NEXT:    --> {0,+,1}<nuw><nsw><%loop> U: [0,1) S: [0,1) Exits: 0 LoopDispositions: { %loop: Computable }
72509fa8e0SJuneyoung Lee; CHECK-NEXT:    %i.next = add i32 %i, 1
737019624eSFlorian Hahn; CHECK-NEXT:    --> {1,+,1}<nuw><nsw><%loop> U: [1,2) S: [1,2) Exits: 1 LoopDispositions: { %loop: Computable }
74509fa8e0SJuneyoung Lee; CHECK-NEXT:    %cond = select i1 %cond_i, i1 %cond_i2, i1 false
7516bc24e7SRoman Lebedev; CHECK-NEXT:    --> (%cond_i umin_seq %cond_i2) U: full-set S: full-set Exits: false LoopDispositions: { %loop: Variant }
76509fa8e0SJuneyoung Lee; CHECK-NEXT:  Determining loop execution counts for: @logical_and_zero
77*0d38f21eSPhilip Reames; CHECK-NEXT:  Loop %loop: backedge-taken count is i32 0
787755c261SPhilip Reames; CHECK-NEXT:  Loop %loop: constant max backedge-taken count is i32 0
79*0d38f21eSPhilip Reames; CHECK-NEXT:  Loop %loop: symbolic max backedge-taken count is i32 0
8088f7dc17SNikita Popov; CHECK-NEXT:  Loop %loop: Trip multiple is 1
81509fa8e0SJuneyoung Lee;
82509fa8e0SJuneyoung Leeentry:
83509fa8e0SJuneyoung Lee  br label %loop
84509fa8e0SJuneyoung Leeloop:
85509fa8e0SJuneyoung Lee  %i = phi i32 [0, %entry], [%i.next, %loop]
86509fa8e0SJuneyoung Lee  %i.next = add i32 %i, 1
87509fa8e0SJuneyoung Lee  %cond_i = icmp ult i32 %i, 0
88509fa8e0SJuneyoung Lee  %cond_i2 = icmp ult i32 %i, %m
89509fa8e0SJuneyoung Lee  %cond = select i1 %cond_i, i1 %cond_i2, i1 false
90509fa8e0SJuneyoung Lee  br i1 %cond, label %loop, label %exit
91509fa8e0SJuneyoung Leeexit:
92509fa8e0SJuneyoung Lee  ret void
93509fa8e0SJuneyoung Lee}
94509fa8e0SJuneyoung Lee
95509fa8e0SJuneyoung Lee; exact-not-taken is umax(n, m) because both conditions (cond_i, cond_i2) participate in branching,
96509fa8e0SJuneyoung Lee; preventing them from being poison.
97509fa8e0SJuneyoung Lee; https://alive2.llvm.org/ce/z/8_p-zu
98509fa8e0SJuneyoung Lee; Currently SCEV is conservative in this case and simply returns unknown.
99509fa8e0SJuneyoung Leedefine void @logical_and_inversed(i32 %n, i32 %m) {
100509fa8e0SJuneyoung Lee; CHECK-LABEL: 'logical_and_inversed'
101509fa8e0SJuneyoung Lee; CHECK-NEXT:  Classifying expressions for: @logical_and_inversed
102509fa8e0SJuneyoung Lee; CHECK-NEXT:    %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
103509fa8e0SJuneyoung Lee; CHECK-NEXT:    --> {0,+,1}<%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
104509fa8e0SJuneyoung Lee; CHECK-NEXT:    %i.next = add i32 %i, 1
105509fa8e0SJuneyoung Lee; CHECK-NEXT:    --> {1,+,1}<%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
106509fa8e0SJuneyoung Lee; CHECK-NEXT:    %cond = select i1 %cond_i, i1 %cond_i2, i1 false
10716bc24e7SRoman Lebedev; CHECK-NEXT:    --> (%cond_i umin_seq %cond_i2) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
108509fa8e0SJuneyoung Lee; CHECK-NEXT:  Determining loop execution counts for: @logical_and_inversed
109509fa8e0SJuneyoung Lee; CHECK-NEXT:  Loop %loop: Unpredictable backedge-taken count.
110211d9411SMax Kazantsev; CHECK-NEXT:  Loop %loop: Unpredictable constant max backedge-taken count.
111e5fa7eb1SMax Kazantsev; CHECK-NEXT:  Loop %loop: Unpredictable symbolic max backedge-taken count.
112509fa8e0SJuneyoung Lee;
113509fa8e0SJuneyoung Leeentry:
114509fa8e0SJuneyoung Lee  br label %loop
115509fa8e0SJuneyoung Leeloop:
116509fa8e0SJuneyoung Lee  %i = phi i32 [0, %entry], [%i.next, %loop]
117509fa8e0SJuneyoung Lee  %i.next = add i32 %i, 1
118509fa8e0SJuneyoung Lee  %cond_i = icmp uge i32 %i, %n
119509fa8e0SJuneyoung Lee  %cond_i2 = icmp uge i32 %i, %m
120509fa8e0SJuneyoung Lee  %cond = select i1 %cond_i, i1 %cond_i2, i1 false
121509fa8e0SJuneyoung Lee  br i1 %cond, label %exit, label %loop
122509fa8e0SJuneyoung Leeexit:
123509fa8e0SJuneyoung Lee  ret void
124509fa8e0SJuneyoung Lee}
125509fa8e0SJuneyoung Lee
126509fa8e0SJuneyoung Lee; If m is constant,  exact-not-taken is umin(n, m)
127509fa8e0SJuneyoung Lee; https://alive2.llvm.org/ce/z/RQmJiq
128509fa8e0SJuneyoung Leedefine void @logical_or_m_const(i32 %n) {
129509fa8e0SJuneyoung Lee; CHECK-LABEL: 'logical_or_m_const'
130509fa8e0SJuneyoung Lee; CHECK-NEXT:  Classifying expressions for: @logical_or_m_const
131509fa8e0SJuneyoung Lee; CHECK-NEXT:    %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
1327019624eSFlorian Hahn; CHECK-NEXT:    --> {0,+,1}<nuw><nsw><%loop> U: [0,3) S: [0,3) Exits: (2 umin %n) LoopDispositions: { %loop: Computable }
133509fa8e0SJuneyoung Lee; CHECK-NEXT:    %i.next = add i32 %i, 1
1347019624eSFlorian Hahn; CHECK-NEXT:    --> {1,+,1}<nuw><nsw><%loop> U: [1,4) S: [1,4) Exits: (1 + (2 umin %n))<nuw><nsw> LoopDispositions: { %loop: Computable }
135509fa8e0SJuneyoung Lee; CHECK-NEXT:    %cond = select i1 %cond_i, i1 true, i1 %cond_i2
1368a3efcd4SFlorian Hahn; CHECK-NEXT:    --> (true + ((true + %cond_i) umin (true + %cond_i2))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
137509fa8e0SJuneyoung Lee; CHECK-NEXT:  Determining loop execution counts for: @logical_or_m_const
138509fa8e0SJuneyoung Lee; CHECK-NEXT:  Loop %loop: backedge-taken count is (2 umin %n)
1397755c261SPhilip Reames; CHECK-NEXT:  Loop %loop: constant max backedge-taken count is i32 2
140e5fa7eb1SMax Kazantsev; CHECK-NEXT:  Loop %loop: symbolic max backedge-taken count is (2 umin %n)
14188f7dc17SNikita Popov; CHECK-NEXT:  Loop %loop: Trip multiple is 1
142509fa8e0SJuneyoung Lee;
143509fa8e0SJuneyoung Leeentry:
144509fa8e0SJuneyoung Lee  br label %loop
145509fa8e0SJuneyoung Leeloop:
146509fa8e0SJuneyoung Lee  %i = phi i32 [0, %entry], [%i.next, %loop]
147509fa8e0SJuneyoung Lee  %i.next = add i32 %i, 1
148509fa8e0SJuneyoung Lee  %cond_i = icmp uge i32 %i, %n
149509fa8e0SJuneyoung Lee  %cond_i2 = icmp uge i32 %i, 2
150509fa8e0SJuneyoung Lee  %cond = select i1 %cond_i, i1 true, i1 %cond_i2
151509fa8e0SJuneyoung Lee  br i1 %cond, label %exit, label %loop
152509fa8e0SJuneyoung Leeexit:
153509fa8e0SJuneyoung Lee  ret void
154509fa8e0SJuneyoung Lee}
155509fa8e0SJuneyoung Lee
156509fa8e0SJuneyoung Lee; exact-not-taken is umin(2, m) because m participates in exit branch condition.
157509fa8e0SJuneyoung Lee; https://alive2.llvm.org/ce/z/zcHS_d
158509fa8e0SJuneyoung Leedefine void @logical_or_nonzero(i32 %m) {
159509fa8e0SJuneyoung Lee; CHECK-LABEL: 'logical_or_nonzero'
160509fa8e0SJuneyoung Lee; CHECK-NEXT:  Classifying expressions for: @logical_or_nonzero
161509fa8e0SJuneyoung Lee; CHECK-NEXT:    %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
1627019624eSFlorian Hahn; CHECK-NEXT:    --> {0,+,1}<nuw><nsw><%loop> U: [0,3) S: [0,3) Exits: (2 umin %m) LoopDispositions: { %loop: Computable }
163509fa8e0SJuneyoung Lee; CHECK-NEXT:    %i.next = add i32 %i, 1
1647019624eSFlorian Hahn; CHECK-NEXT:    --> {1,+,1}<nuw><nsw><%loop> U: [1,4) S: [1,4) Exits: (1 + (2 umin %m))<nuw><nsw> LoopDispositions: { %loop: Computable }
165509fa8e0SJuneyoung Lee; CHECK-NEXT:    %cond = select i1 %cond_i, i1 true, i1 %cond_i2
16649d9acc2SRoman Lebedev; CHECK-NEXT:    --> (true + ((true + %cond_i) umin_seq (true + %cond_i2))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
167509fa8e0SJuneyoung Lee; CHECK-NEXT:  Determining loop execution counts for: @logical_or_nonzero
168509fa8e0SJuneyoung Lee; CHECK-NEXT:  Loop %loop: backedge-taken count is (2 umin %m)
1697755c261SPhilip Reames; CHECK-NEXT:  Loop %loop: constant max backedge-taken count is i32 2
170e5fa7eb1SMax Kazantsev; CHECK-NEXT:  Loop %loop: symbolic max backedge-taken count is (2 umin %m)
17188f7dc17SNikita Popov; CHECK-NEXT:  Loop %loop: Trip multiple is 1
172509fa8e0SJuneyoung Lee;
173509fa8e0SJuneyoung Leeentry:
174509fa8e0SJuneyoung Lee  br label %loop
175509fa8e0SJuneyoung Leeloop:
176509fa8e0SJuneyoung Lee  %i = phi i32 [0, %entry], [%i.next, %loop]
177509fa8e0SJuneyoung Lee  %i.next = add i32 %i, 1
178509fa8e0SJuneyoung Lee  %cond_i = icmp uge i32 %i, 2
179509fa8e0SJuneyoung Lee  %cond_i2 = icmp uge i32 %i, %m
180509fa8e0SJuneyoung Lee  %cond = select i1 %cond_i, i1 true, i1 %cond_i2
181509fa8e0SJuneyoung Lee  br i1 %cond, label %exit, label %loop
182509fa8e0SJuneyoung Leeexit:
183509fa8e0SJuneyoung Lee  ret void
184509fa8e0SJuneyoung Lee}
185509fa8e0SJuneyoung Lee
186509fa8e0SJuneyoung Lee; exact-not-taken cannot be umin(0, m) because m does not participate in exit branch condition.
187509fa8e0SJuneyoung Lee; https://alive2.llvm.org/ce/z/-dUmmc
188509fa8e0SJuneyoung Lee; Instead, exact-not-taken should be just 0.
189509fa8e0SJuneyoung Leedefine void @logical_or_zero(i32 %m) {
190509fa8e0SJuneyoung Lee; CHECK-LABEL: 'logical_or_zero'
191509fa8e0SJuneyoung Lee; CHECK-NEXT:  Classifying expressions for: @logical_or_zero
192509fa8e0SJuneyoung Lee; CHECK-NEXT:    %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
1937019624eSFlorian Hahn; CHECK-NEXT:    --> {0,+,1}<nuw><nsw><%loop> U: [0,1) S: [0,1) Exits: 0 LoopDispositions: { %loop: Computable }
194509fa8e0SJuneyoung Lee; CHECK-NEXT:    %i.next = add i32 %i, 1
1957019624eSFlorian Hahn; CHECK-NEXT:    --> {1,+,1}<nuw><nsw><%loop> U: [1,2) S: [1,2) Exits: 1 LoopDispositions: { %loop: Computable }
196509fa8e0SJuneyoung Lee; CHECK-NEXT:    %cond = select i1 %cond_i, i1 true, i1 %cond_i2
19749d9acc2SRoman Lebedev; CHECK-NEXT:    --> (true + ((true + %cond_i) umin_seq (true + %cond_i2))) U: full-set S: full-set Exits: true LoopDispositions: { %loop: Variant }
198509fa8e0SJuneyoung Lee; CHECK-NEXT:  Determining loop execution counts for: @logical_or_zero
199*0d38f21eSPhilip Reames; CHECK-NEXT:  Loop %loop: backedge-taken count is i32 0
2007755c261SPhilip Reames; CHECK-NEXT:  Loop %loop: constant max backedge-taken count is i32 0
201*0d38f21eSPhilip Reames; CHECK-NEXT:  Loop %loop: symbolic max backedge-taken count is i32 0
20288f7dc17SNikita Popov; CHECK-NEXT:  Loop %loop: Trip multiple is 1
203509fa8e0SJuneyoung Lee;
204509fa8e0SJuneyoung Leeentry:
205509fa8e0SJuneyoung Lee  br label %loop
206509fa8e0SJuneyoung Leeloop:
207509fa8e0SJuneyoung Lee  %i = phi i32 [0, %entry], [%i.next, %loop]
208509fa8e0SJuneyoung Lee  %i.next = add i32 %i, 1
209509fa8e0SJuneyoung Lee  %cond_i = icmp uge i32 %i, 0
210509fa8e0SJuneyoung Lee  %cond_i2 = icmp uge i32 %i, %m
211509fa8e0SJuneyoung Lee  %cond = select i1 %cond_i, i1 true, i1 %cond_i2
212509fa8e0SJuneyoung Lee  br i1 %cond, label %exit, label %loop
213509fa8e0SJuneyoung Leeexit:
214509fa8e0SJuneyoung Lee  ret void
215509fa8e0SJuneyoung Lee}
216509fa8e0SJuneyoung Lee
217509fa8e0SJuneyoung Lee; exact-not-taken is umax(n, m) because both conditions (cond_i, cond_i2) participate in branching,
218509fa8e0SJuneyoung Lee; preventing them from being poison.
219509fa8e0SJuneyoung Lee; https://alive2.llvm.org/ce/z/VaCu9C
220509fa8e0SJuneyoung Lee; Currently SCEV is conservative in this case and simply returns unknown.
221509fa8e0SJuneyoung Leedefine void @logical_or_inversed(i32 %n, i32 %m) {
222509fa8e0SJuneyoung Lee; CHECK-LABEL: 'logical_or_inversed'
223509fa8e0SJuneyoung Lee; CHECK-NEXT:  Classifying expressions for: @logical_or_inversed
224509fa8e0SJuneyoung Lee; CHECK-NEXT:    %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
225509fa8e0SJuneyoung Lee; CHECK-NEXT:    --> {0,+,1}<%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
226509fa8e0SJuneyoung Lee; CHECK-NEXT:    %i.next = add i32 %i, 1
227509fa8e0SJuneyoung Lee; CHECK-NEXT:    --> {1,+,1}<%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
228509fa8e0SJuneyoung Lee; CHECK-NEXT:    %cond = select i1 %cond_i, i1 true, i1 %cond_i2
22949d9acc2SRoman Lebedev; CHECK-NEXT:    --> (true + ((true + %cond_i) umin_seq (true + %cond_i2))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
230509fa8e0SJuneyoung Lee; CHECK-NEXT:  Determining loop execution counts for: @logical_or_inversed
231509fa8e0SJuneyoung Lee; CHECK-NEXT:  Loop %loop: Unpredictable backedge-taken count.
232211d9411SMax Kazantsev; CHECK-NEXT:  Loop %loop: Unpredictable constant max backedge-taken count.
233e5fa7eb1SMax Kazantsev; CHECK-NEXT:  Loop %loop: Unpredictable symbolic max backedge-taken count.
234509fa8e0SJuneyoung Lee;
235509fa8e0SJuneyoung Leeentry:
236509fa8e0SJuneyoung Lee  br label %loop
237509fa8e0SJuneyoung Leeloop:
238509fa8e0SJuneyoung Lee  %i = phi i32 [0, %entry], [%i.next, %loop]
239509fa8e0SJuneyoung Lee  %i.next = add i32 %i, 1
240509fa8e0SJuneyoung Lee  %cond_i = icmp ult i32 %i, %n
241509fa8e0SJuneyoung Lee  %cond_i2 = icmp ult i32 %i, %m
242509fa8e0SJuneyoung Lee  %cond = select i1 %cond_i, i1 true, i1 %cond_i2
243509fa8e0SJuneyoung Lee  br i1 %cond, label %loop, label %exit
244509fa8e0SJuneyoung Leeexit:
245509fa8e0SJuneyoung Lee  ret void
246509fa8e0SJuneyoung Lee}
247