1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -S -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -bonus-inst-threshold=1 | FileCheck %s --check-prefixes=ALL,CHEAP
3 ; RUN: opt < %s -S -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -bonus-inst-threshold=10 | FileCheck %s --check-prefixes=ALL,COSTLY
5 declare void @sideeffect0(i8)
6 declare void @sideeffect1(i8)
7 declare void @sideeffect1.vec(<2 x i8>)
8 declare void @sideeffect2(i8)
11 define void @incompatible_ivs_of_single_phi.falsedest.falsedest(i8 %v0, i8 %v1, i8 %iv.of.final_left.from.dispatch, i8 %iv.of.final_right.from.pred, i8 %iv.of.final_right.from.dispatch) {
12 ; ALL-LABEL: @incompatible_ivs_of_single_phi.falsedest.falsedest(
14 ; ALL-NEXT: [[C0:%.*]] = icmp eq i8 [[V0:%.*]], 0
15 ; ALL-NEXT: br i1 [[C0]], label [[DISPATCH:%.*]], label [[FINAL_RIGHT:%.*]]
17 ; ALL-NEXT: [[C1:%.*]] = icmp eq i8 [[V1:%.*]], 0
18 ; ALL-NEXT: br i1 [[C1]], label [[FINAL_LEFT:%.*]], label [[FINAL_RIGHT]]
22 ; ALL-NEXT: [[FINAL_LEFT_PHI:%.*]] = phi i8 [ [[IV_OF_FINAL_LEFT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
23 ; ALL-NEXT: call void @sideeffect0(i8 [[FINAL_LEFT_PHI]])
24 ; ALL-NEXT: br label [[COMMON_RET:%.*]]
26 ; ALL-NEXT: [[FINAL_RIGHT_PHI:%.*]] = phi i8 [ [[IV_OF_FINAL_RIGHT_FROM_PRED:%.*]], [[PRED:%.*]] ], [ [[IV_OF_FINAL_RIGHT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
27 ; ALL-NEXT: call void @sideeffect1(i8 [[FINAL_RIGHT_PHI]])
28 ; ALL-NEXT: br label [[COMMON_RET]]
31 %c0 = icmp eq i8 %v0, 0
32 br i1 %c0, label %dispatch, label %final_right
34 %c1 = icmp eq i8 %v1, 0
35 br i1 %c1, label %final_left, label %final_right
37 %final_left.phi = phi i8 [ %iv.of.final_left.from.dispatch, %dispatch ]
38 call void @sideeffect0(i8 %final_left.phi)
41 %final_right.phi = phi i8 [ %iv.of.final_right.from.pred, %pred ], [ %iv.of.final_right.from.dispatch, %dispatch ]
42 call void @sideeffect1(i8 %final_right.phi)
46 define void @incompatible_ivs_of_single_phi.falsedest.falsedest.extrause(i8 %v0, i8 %v1, i8 %iv.of.final_left.from.dispatch, i8 %iv.of.final_right.from.pred, i8 %iv.of.final_right.from.dispatch) {
47 ; ALL-LABEL: @incompatible_ivs_of_single_phi.falsedest.falsedest.extrause(
49 ; ALL-NEXT: [[C0:%.*]] = icmp eq i8 [[V0:%.*]], 0
50 ; ALL-NEXT: call void @use1(i1 [[C0]])
51 ; ALL-NEXT: br i1 [[C0]], label [[DISPATCH:%.*]], label [[FINAL_RIGHT:%.*]]
53 ; ALL-NEXT: [[C1:%.*]] = icmp eq i8 [[V1:%.*]], 0
54 ; ALL-NEXT: br i1 [[C1]], label [[FINAL_LEFT:%.*]], label [[FINAL_RIGHT]]
58 ; ALL-NEXT: [[FINAL_LEFT_PHI:%.*]] = phi i8 [ [[IV_OF_FINAL_LEFT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
59 ; ALL-NEXT: call void @sideeffect0(i8 [[FINAL_LEFT_PHI]])
60 ; ALL-NEXT: br label [[COMMON_RET:%.*]]
62 ; ALL-NEXT: [[FINAL_RIGHT_PHI:%.*]] = phi i8 [ [[IV_OF_FINAL_RIGHT_FROM_PRED:%.*]], [[PRED:%.*]] ], [ [[IV_OF_FINAL_RIGHT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
63 ; ALL-NEXT: call void @sideeffect1(i8 [[FINAL_RIGHT_PHI]])
64 ; ALL-NEXT: br label [[COMMON_RET]]
67 %c0 = icmp eq i8 %v0, 0
68 call void @use1(i1 %c0)
69 br i1 %c0, label %dispatch, label %final_right
71 %c1 = icmp eq i8 %v1, 0
72 br i1 %c1, label %final_left, label %final_right
74 %final_left.phi = phi i8 [ %iv.of.final_left.from.dispatch, %dispatch ]
75 call void @sideeffect0(i8 %final_left.phi)
78 %final_right.phi = phi i8 [ %iv.of.final_right.from.pred, %pred ], [ %iv.of.final_right.from.dispatch, %dispatch ]
79 call void @sideeffect1(i8 %final_right.phi)
83 define void @incompatible_ivs_of_single_phi.falsedest.truedest(i8 %v0, i8 %v1, i8 %iv.of.final_left.from.dispatch, i8 %iv.of.final_right.from.pred, i8 %iv.of.final_right.from.dispatch) {
84 ; ALL-LABEL: @incompatible_ivs_of_single_phi.falsedest.truedest(
86 ; ALL-NEXT: [[C0:%.*]] = icmp eq i8 [[V0:%.*]], 0
87 ; ALL-NEXT: br i1 [[C0]], label [[DISPATCH:%.*]], label [[FINAL_RIGHT:%.*]]
89 ; ALL-NEXT: [[C1:%.*]] = icmp eq i8 [[V1:%.*]], 0
90 ; ALL-NEXT: br i1 [[C1]], label [[FINAL_RIGHT]], label [[FINAL_LEFT:%.*]]
94 ; ALL-NEXT: [[FINAL_LEFT_PHI:%.*]] = phi i8 [ [[IV_OF_FINAL_LEFT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
95 ; ALL-NEXT: call void @sideeffect0(i8 [[FINAL_LEFT_PHI]])
96 ; ALL-NEXT: br label [[COMMON_RET:%.*]]
98 ; ALL-NEXT: [[FINAL_RIGHT_PHI:%.*]] = phi i8 [ [[IV_OF_FINAL_RIGHT_FROM_PRED:%.*]], [[PRED:%.*]] ], [ [[IV_OF_FINAL_RIGHT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
99 ; ALL-NEXT: call void @sideeffect1(i8 [[FINAL_RIGHT_PHI]])
100 ; ALL-NEXT: br label [[COMMON_RET]]
103 %c0 = icmp eq i8 %v0, 0
104 br i1 %c0, label %dispatch, label %final_right
106 %c1 = icmp eq i8 %v1, 0
107 br i1 %c1, label %final_right, label %final_left
109 %final_left.phi = phi i8 [ %iv.of.final_left.from.dispatch, %dispatch ]
110 call void @sideeffect0(i8 %final_left.phi)
113 %final_right.phi = phi i8 [ %iv.of.final_right.from.pred, %pred ], [ %iv.of.final_right.from.dispatch, %dispatch ]
114 call void @sideeffect1(i8 %final_right.phi)
118 define void @incompatible_ivs_of_single_phi.falsedest.truedest.extrause(i8 %v0, i8 %v1, i8 %iv.of.final_left.from.dispatch, i8 %iv.of.final_right.from.pred, i8 %iv.of.final_right.from.dispatch) {
119 ; ALL-LABEL: @incompatible_ivs_of_single_phi.falsedest.truedest.extrause(
121 ; ALL-NEXT: [[C0:%.*]] = icmp eq i8 [[V0:%.*]], 0
122 ; ALL-NEXT: call void @use1(i1 [[C0]])
123 ; ALL-NEXT: br i1 [[C0]], label [[DISPATCH:%.*]], label [[FINAL_RIGHT:%.*]]
125 ; ALL-NEXT: [[C1:%.*]] = icmp eq i8 [[V1:%.*]], 0
126 ; ALL-NEXT: br i1 [[C1]], label [[FINAL_RIGHT]], label [[FINAL_LEFT:%.*]]
130 ; ALL-NEXT: [[FINAL_LEFT_PHI:%.*]] = phi i8 [ [[IV_OF_FINAL_LEFT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
131 ; ALL-NEXT: call void @sideeffect0(i8 [[FINAL_LEFT_PHI]])
132 ; ALL-NEXT: br label [[COMMON_RET:%.*]]
134 ; ALL-NEXT: [[FINAL_RIGHT_PHI:%.*]] = phi i8 [ [[IV_OF_FINAL_RIGHT_FROM_PRED:%.*]], [[PRED:%.*]] ], [ [[IV_OF_FINAL_RIGHT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
135 ; ALL-NEXT: call void @sideeffect1(i8 [[FINAL_RIGHT_PHI]])
136 ; ALL-NEXT: br label [[COMMON_RET]]
139 %c0 = icmp eq i8 %v0, 0
140 call void @use1(i1 %c0)
141 br i1 %c0, label %dispatch, label %final_right
143 %c1 = icmp eq i8 %v1, 0
144 br i1 %c1, label %final_right, label %final_left
146 %final_left.phi = phi i8 [ %iv.of.final_left.from.dispatch, %dispatch ]
147 call void @sideeffect0(i8 %final_left.phi)
150 %final_right.phi = phi i8 [ %iv.of.final_right.from.pred, %pred ], [ %iv.of.final_right.from.dispatch, %dispatch ]
151 call void @sideeffect1(i8 %final_right.phi)
155 define void @incompatible_ivs_of_single_phi.truedest.falsedest(i8 %v0, i8 %v1, i8 %iv.of.final_left.from.dispatch, i8 %iv.of.final_right.from.pred, i8 %iv.of.final_right.from.dispatch) {
156 ; ALL-LABEL: @incompatible_ivs_of_single_phi.truedest.falsedest(
158 ; ALL-NEXT: [[C0:%.*]] = icmp eq i8 [[V0:%.*]], 0
159 ; ALL-NEXT: br i1 [[C0]], label [[FINAL_RIGHT:%.*]], label [[DISPATCH:%.*]]
161 ; ALL-NEXT: [[C1:%.*]] = icmp eq i8 [[V1:%.*]], 0
162 ; ALL-NEXT: br i1 [[C1]], label [[FINAL_LEFT:%.*]], label [[FINAL_RIGHT]]
166 ; ALL-NEXT: [[FINAL_LEFT_PHI:%.*]] = phi i8 [ [[IV_OF_FINAL_LEFT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
167 ; ALL-NEXT: call void @sideeffect0(i8 [[FINAL_LEFT_PHI]])
168 ; ALL-NEXT: br label [[COMMON_RET:%.*]]
170 ; ALL-NEXT: [[FINAL_RIGHT_PHI:%.*]] = phi i8 [ [[IV_OF_FINAL_RIGHT_FROM_PRED:%.*]], [[PRED:%.*]] ], [ [[IV_OF_FINAL_RIGHT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
171 ; ALL-NEXT: call void @sideeffect1(i8 [[FINAL_RIGHT_PHI]])
172 ; ALL-NEXT: br label [[COMMON_RET]]
175 %c0 = icmp eq i8 %v0, 0
176 br i1 %c0, label %final_right, label %dispatch
178 %c1 = icmp eq i8 %v1, 0
179 br i1 %c1, label %final_left, label %final_right
181 %final_left.phi = phi i8 [ %iv.of.final_left.from.dispatch, %dispatch ]
182 call void @sideeffect0(i8 %final_left.phi)
185 %final_right.phi = phi i8 [ %iv.of.final_right.from.pred, %pred ], [ %iv.of.final_right.from.dispatch, %dispatch ]
186 call void @sideeffect1(i8 %final_right.phi)
190 define void @incompatible_ivs_of_single_phi.truedest.falsedest.extrause(i8 %v0, i8 %v1, i8 %iv.of.final_left.from.dispatch, i8 %iv.of.final_right.from.pred, i8 %iv.of.final_right.from.dispatch) {
191 ; ALL-LABEL: @incompatible_ivs_of_single_phi.truedest.falsedest.extrause(
193 ; ALL-NEXT: [[C0:%.*]] = icmp eq i8 [[V0:%.*]], 0
194 ; ALL-NEXT: call void @use1(i1 [[C0]])
195 ; ALL-NEXT: br i1 [[C0]], label [[FINAL_RIGHT:%.*]], label [[DISPATCH:%.*]]
197 ; ALL-NEXT: [[C1:%.*]] = icmp eq i8 [[V1:%.*]], 0
198 ; ALL-NEXT: br i1 [[C1]], label [[FINAL_LEFT:%.*]], label [[FINAL_RIGHT]]
202 ; ALL-NEXT: [[FINAL_LEFT_PHI:%.*]] = phi i8 [ [[IV_OF_FINAL_LEFT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
203 ; ALL-NEXT: call void @sideeffect0(i8 [[FINAL_LEFT_PHI]])
204 ; ALL-NEXT: br label [[COMMON_RET:%.*]]
206 ; ALL-NEXT: [[FINAL_RIGHT_PHI:%.*]] = phi i8 [ [[IV_OF_FINAL_RIGHT_FROM_PRED:%.*]], [[PRED:%.*]] ], [ [[IV_OF_FINAL_RIGHT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
207 ; ALL-NEXT: call void @sideeffect1(i8 [[FINAL_RIGHT_PHI]])
208 ; ALL-NEXT: br label [[COMMON_RET]]
211 %c0 = icmp eq i8 %v0, 0
212 call void @use1(i1 %c0)
213 br i1 %c0, label %final_right, label %dispatch
215 %c1 = icmp eq i8 %v1, 0
216 br i1 %c1, label %final_left, label %final_right
218 %final_left.phi = phi i8 [ %iv.of.final_left.from.dispatch, %dispatch ]
219 call void @sideeffect0(i8 %final_left.phi)
222 %final_right.phi = phi i8 [ %iv.of.final_right.from.pred, %pred ], [ %iv.of.final_right.from.dispatch, %dispatch ]
223 call void @sideeffect1(i8 %final_right.phi)
227 define void @incompatible_ivs_of_single_phi.truedest.truedest(i8 %v0, i8 %v1, i8 %iv.of.final_left.from.dispatch, i8 %iv.of.final_right.from.pred, i8 %iv.of.final_right.from.dispatch) {
228 ; ALL-LABEL: @incompatible_ivs_of_single_phi.truedest.truedest(
230 ; ALL-NEXT: [[C0:%.*]] = icmp eq i8 [[V0:%.*]], 0
231 ; ALL-NEXT: br i1 [[C0]], label [[FINAL_RIGHT:%.*]], label [[DISPATCH:%.*]]
233 ; ALL-NEXT: [[C1:%.*]] = icmp eq i8 [[V1:%.*]], 0
234 ; ALL-NEXT: br i1 [[C1]], label [[FINAL_RIGHT]], label [[FINAL_LEFT:%.*]]
238 ; ALL-NEXT: [[FINAL_LEFT_PHI:%.*]] = phi i8 [ [[IV_OF_FINAL_LEFT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
239 ; ALL-NEXT: call void @sideeffect0(i8 [[FINAL_LEFT_PHI]])
240 ; ALL-NEXT: br label [[COMMON_RET:%.*]]
242 ; ALL-NEXT: [[FINAL_RIGHT_PHI:%.*]] = phi i8 [ [[IV_OF_FINAL_RIGHT_FROM_PRED:%.*]], [[PRED:%.*]] ], [ [[IV_OF_FINAL_RIGHT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
243 ; ALL-NEXT: call void @sideeffect1(i8 [[FINAL_RIGHT_PHI]])
244 ; ALL-NEXT: br label [[COMMON_RET]]
247 %c0 = icmp eq i8 %v0, 0
248 br i1 %c0, label %final_right, label %dispatch
250 %c1 = icmp eq i8 %v1, 0
251 br i1 %c1, label %final_right, label %final_left
253 %final_left.phi = phi i8 [ %iv.of.final_left.from.dispatch, %dispatch ]
254 call void @sideeffect0(i8 %final_left.phi)
257 %final_right.phi = phi i8 [ %iv.of.final_right.from.pred, %pred ], [ %iv.of.final_right.from.dispatch, %dispatch ]
258 call void @sideeffect1(i8 %final_right.phi)
262 define void @incompatible_ivs_of_single_phi.truedest.truedest.extrause(i8 %v0, i8 %v1, i8 %iv.of.final_left.from.dispatch, i8 %iv.of.final_right.from.pred, i8 %iv.of.final_right.from.dispatch) {
263 ; ALL-LABEL: @incompatible_ivs_of_single_phi.truedest.truedest.extrause(
265 ; ALL-NEXT: [[C0:%.*]] = icmp eq i8 [[V0:%.*]], 0
266 ; ALL-NEXT: call void @use1(i1 [[C0]])
267 ; ALL-NEXT: br i1 [[C0]], label [[FINAL_RIGHT:%.*]], label [[DISPATCH:%.*]]
269 ; ALL-NEXT: [[C1:%.*]] = icmp eq i8 [[V1:%.*]], 0
270 ; ALL-NEXT: br i1 [[C1]], label [[FINAL_RIGHT]], label [[FINAL_LEFT:%.*]]
274 ; ALL-NEXT: [[FINAL_LEFT_PHI:%.*]] = phi i8 [ [[IV_OF_FINAL_LEFT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
275 ; ALL-NEXT: call void @sideeffect0(i8 [[FINAL_LEFT_PHI]])
276 ; ALL-NEXT: br label [[COMMON_RET:%.*]]
278 ; ALL-NEXT: [[FINAL_RIGHT_PHI:%.*]] = phi i8 [ [[IV_OF_FINAL_RIGHT_FROM_PRED:%.*]], [[PRED:%.*]] ], [ [[IV_OF_FINAL_RIGHT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
279 ; ALL-NEXT: call void @sideeffect1(i8 [[FINAL_RIGHT_PHI]])
280 ; ALL-NEXT: br label [[COMMON_RET]]
283 %c0 = icmp eq i8 %v0, 0
284 call void @use1(i1 %c0)
285 br i1 %c0, label %final_right, label %dispatch
287 %c1 = icmp eq i8 %v1, 0
288 br i1 %c1, label %final_right, label %final_left
290 %final_left.phi = phi i8 [ %iv.of.final_left.from.dispatch, %dispatch ]
291 call void @sideeffect0(i8 %final_left.phi)
294 %final_right.phi = phi i8 [ %iv.of.final_right.from.pred, %pred ], [ %iv.of.final_right.from.dispatch, %dispatch ]
295 call void @sideeffect1(i8 %final_right.phi)
299 ;; -----------------------------------------------------------------------------
301 define void @incompatible_ivs_of_single_phi.insertpos(i8 %v0, i8 %v1, i8 %iv.of.final_left.from.dispatch, ptr dereferenceable(1) %src0, ptr dereferenceable(1) %src1) {
302 ; ALL-LABEL: @incompatible_ivs_of_single_phi.insertpos(
304 ; ALL-NEXT: [[IV_OF_FINAL_RIGHT_FROM_PRED:%.*]] = load i8, ptr [[SRC0:%.*]], align 1
305 ; ALL-NEXT: [[C0:%.*]] = icmp eq i8 [[V0:%.*]], 0
306 ; ALL-NEXT: br i1 [[C0]], label [[DISPATCH:%.*]], label [[FINAL_RIGHT:%.*]]
308 ; ALL-NEXT: [[IV_OF_FINAL_RIGHT_FROM_DISPATCH:%.*]] = load i8, ptr [[SRC1:%.*]], align 1
309 ; ALL-NEXT: [[C1:%.*]] = icmp eq i8 [[V1:%.*]], 0
310 ; ALL-NEXT: br i1 [[C1]], label [[FINAL_LEFT:%.*]], label [[FINAL_RIGHT]]
314 ; ALL-NEXT: [[FINAL_LEFT_PHI:%.*]] = phi i8 [ [[IV_OF_FINAL_LEFT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
315 ; ALL-NEXT: call void @sideeffect0(i8 [[FINAL_LEFT_PHI]])
316 ; ALL-NEXT: br label [[COMMON_RET:%.*]]
318 ; ALL-NEXT: [[FINAL_RIGHT_PHI:%.*]] = phi i8 [ [[IV_OF_FINAL_RIGHT_FROM_PRED]], [[PRED:%.*]] ], [ [[IV_OF_FINAL_RIGHT_FROM_DISPATCH]], [[DISPATCH]] ]
319 ; ALL-NEXT: call void @sideeffect1(i8 [[FINAL_RIGHT_PHI]])
320 ; ALL-NEXT: br label [[COMMON_RET]]
323 %iv.of.final_right.from.pred = load i8, ptr %src0
324 %c0 = icmp eq i8 %v0, 0
325 br i1 %c0, label %dispatch, label %final_right
327 %iv.of.final_right.from.dispatch = load i8, ptr %src1
328 %c1 = icmp eq i8 %v1, 0
329 br i1 %c1, label %final_left, label %final_right
331 %final_left.phi = phi i8 [ %iv.of.final_left.from.dispatch, %dispatch ]
332 call void @sideeffect0(i8 %final_left.phi)
335 %final_right.phi = phi i8 [ %iv.of.final_right.from.pred, %pred ], [ %iv.of.final_right.from.dispatch, %dispatch ]
336 call void @sideeffect1(i8 %final_right.phi)
340 define void @incompatible_ivs_of_one_of_two_phis(i8 %v0, i8 %v1, i8 %iv.of.final_left.from.dispatch, i8 %iv.of.final_right.from.pred, i8 %iv.of.final_right.from.dispatch) {
341 ; ALL-LABEL: @incompatible_ivs_of_one_of_two_phis(
343 ; ALL-NEXT: [[C0:%.*]] = icmp eq i8 [[V0:%.*]], 0
344 ; ALL-NEXT: br i1 [[C0]], label [[DISPATCH:%.*]], label [[FINAL_RIGHT:%.*]]
346 ; ALL-NEXT: [[C1:%.*]] = icmp eq i8 [[V1:%.*]], 0
347 ; ALL-NEXT: br i1 [[C1]], label [[FINAL_LEFT:%.*]], label [[FINAL_RIGHT]]
351 ; ALL-NEXT: [[FINAL_LEFT_PHI:%.*]] = phi i8 [ [[IV_OF_FINAL_LEFT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
352 ; ALL-NEXT: call void @sideeffect0(i8 [[FINAL_LEFT_PHI]])
353 ; ALL-NEXT: br label [[COMMON_RET:%.*]]
355 ; ALL-NEXT: [[FINAL_RIGHT_PHI_0:%.*]] = phi i8 [ [[IV_OF_FINAL_RIGHT_FROM_PRED:%.*]], [[PRED:%.*]] ], [ [[IV_OF_FINAL_RIGHT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
356 ; ALL-NEXT: [[FINAL_RIGHT_PHI_1:%.*]] = phi i8 [ 42, [[PRED]] ], [ 42, [[DISPATCH]] ]
357 ; ALL-NEXT: call void @sideeffect1(i8 [[FINAL_RIGHT_PHI_0]])
358 ; ALL-NEXT: call void @sideeffect1(i8 [[FINAL_RIGHT_PHI_1]])
359 ; ALL-NEXT: br label [[COMMON_RET]]
362 %c0 = icmp eq i8 %v0, 0
363 br i1 %c0, label %dispatch, label %final_right
365 %c1 = icmp eq i8 %v1, 0
366 br i1 %c1, label %final_left, label %final_right
368 %final_left.phi = phi i8 [ %iv.of.final_left.from.dispatch, %dispatch ]
369 call void @sideeffect0(i8 %final_left.phi)
372 %final_right.phi.0 = phi i8 [ %iv.of.final_right.from.pred, %pred ], [ %iv.of.final_right.from.dispatch, %dispatch ]
373 %final_right.phi.1 = phi i8 [ 42, %pred ], [ 42, %dispatch ]
374 call void @sideeffect1(i8 %final_right.phi.0)
375 call void @sideeffect1(i8 %final_right.phi.1)
379 define void @incompatible_ivs_of_two_phis(i8 %v0, i8 %v1, i8 %iv.of.final_left.from.dispatch, i8 %iv0.of.final_right.from.pred, i8 %iv0.of.final_right.from.dispatch, i8 %iv1.of.final_right.from.pred, i8 %iv1.of.final_right.from.dispatch) {
380 ; ALL-LABEL: @incompatible_ivs_of_two_phis(
382 ; ALL-NEXT: [[C0:%.*]] = icmp eq i8 [[V0:%.*]], 0
383 ; ALL-NEXT: br i1 [[C0]], label [[DISPATCH:%.*]], label [[FINAL_RIGHT:%.*]]
385 ; ALL-NEXT: [[C1:%.*]] = icmp eq i8 [[V1:%.*]], 0
386 ; ALL-NEXT: br i1 [[C1]], label [[FINAL_LEFT:%.*]], label [[FINAL_RIGHT]]
390 ; ALL-NEXT: [[FINAL_LEFT_PHI:%.*]] = phi i8 [ [[IV_OF_FINAL_LEFT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
391 ; ALL-NEXT: call void @sideeffect0(i8 [[FINAL_LEFT_PHI]])
392 ; ALL-NEXT: br label [[COMMON_RET:%.*]]
394 ; ALL-NEXT: [[FINAL_RIGHT_PHI_0:%.*]] = phi i8 [ [[IV0_OF_FINAL_RIGHT_FROM_PRED:%.*]], [[PRED:%.*]] ], [ [[IV0_OF_FINAL_RIGHT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
395 ; ALL-NEXT: [[FINAL_RIGHT_PHI_1:%.*]] = phi i8 [ [[IV1_OF_FINAL_RIGHT_FROM_PRED:%.*]], [[PRED]] ], [ [[IV1_OF_FINAL_RIGHT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
396 ; ALL-NEXT: call void @sideeffect1(i8 [[FINAL_RIGHT_PHI_0]])
397 ; ALL-NEXT: call void @sideeffect1(i8 [[FINAL_RIGHT_PHI_1]])
398 ; ALL-NEXT: br label [[COMMON_RET]]
401 %c0 = icmp eq i8 %v0, 0
402 br i1 %c0, label %dispatch, label %final_right
404 %c1 = icmp eq i8 %v1, 0
405 br i1 %c1, label %final_left, label %final_right
407 %final_left.phi = phi i8 [ %iv.of.final_left.from.dispatch, %dispatch ]
408 call void @sideeffect0(i8 %final_left.phi)
411 %final_right.phi.0 = phi i8 [ %iv0.of.final_right.from.pred, %pred ], [ %iv0.of.final_right.from.dispatch, %dispatch ]
412 %final_right.phi.1 = phi i8 [ %iv1.of.final_right.from.pred, %pred ], [ %iv1.of.final_right.from.dispatch, %dispatch ]
413 call void @sideeffect1(i8 %final_right.phi.0)
414 call void @sideeffect1(i8 %final_right.phi.1)
418 define void @incompatible_ivs_of_two_phis.vec(i8 %v0, i8 %v1, i8 %iv.of.final_left.from.dispatch, <2 x i8> %iv0.of.final_right.from.pred, <2 x i8> %iv0.of.final_right.from.dispatch, <2 x i8> %iv1.of.final_right.from.pred, <2 x i8> %iv1.of.final_right.from.dispatch) {
419 ; ALL-LABEL: @incompatible_ivs_of_two_phis.vec(
421 ; ALL-NEXT: [[C0:%.*]] = icmp eq i8 [[V0:%.*]], 0
422 ; ALL-NEXT: br i1 [[C0]], label [[DISPATCH:%.*]], label [[FINAL_RIGHT:%.*]]
424 ; ALL-NEXT: [[C1:%.*]] = icmp eq i8 [[V1:%.*]], 0
425 ; ALL-NEXT: br i1 [[C1]], label [[FINAL_LEFT:%.*]], label [[FINAL_RIGHT]]
429 ; ALL-NEXT: [[FINAL_LEFT_PHI:%.*]] = phi i8 [ [[IV_OF_FINAL_LEFT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
430 ; ALL-NEXT: call void @sideeffect0(i8 [[FINAL_LEFT_PHI]])
431 ; ALL-NEXT: br label [[COMMON_RET:%.*]]
433 ; ALL-NEXT: [[FINAL_RIGHT_PHI_0:%.*]] = phi <2 x i8> [ [[IV0_OF_FINAL_RIGHT_FROM_PRED:%.*]], [[PRED:%.*]] ], [ [[IV0_OF_FINAL_RIGHT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
434 ; ALL-NEXT: [[FINAL_RIGHT_PHI_1:%.*]] = phi <2 x i8> [ [[IV1_OF_FINAL_RIGHT_FROM_PRED:%.*]], [[PRED]] ], [ [[IV1_OF_FINAL_RIGHT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
435 ; ALL-NEXT: call void @sideeffect1.vec(<2 x i8> [[FINAL_RIGHT_PHI_0]])
436 ; ALL-NEXT: call void @sideeffect1.vec(<2 x i8> [[FINAL_RIGHT_PHI_1]])
437 ; ALL-NEXT: br label [[COMMON_RET]]
440 %c0 = icmp eq i8 %v0, 0
441 br i1 %c0, label %dispatch, label %final_right
443 %c1 = icmp eq i8 %v1, 0
444 br i1 %c1, label %final_left, label %final_right
446 %final_left.phi = phi i8 [ %iv.of.final_left.from.dispatch, %dispatch ]
447 call void @sideeffect0(i8 %final_left.phi)
450 %final_right.phi.0 = phi <2 x i8> [ %iv0.of.final_right.from.pred, %pred ], [ %iv0.of.final_right.from.dispatch, %dispatch ]
451 %final_right.phi.1 = phi <2 x i8> [ %iv1.of.final_right.from.pred, %pred ], [ %iv1.of.final_right.from.dispatch, %dispatch ]
452 call void @sideeffect1.vec(<2 x i8> %final_right.phi.0)
453 call void @sideeffect1.vec(<2 x i8> %final_right.phi.1)
457 ; From https://reviews.llvm.org/D139275#4001580
458 define float @D139275_c4001580(float %val) {
459 ; ALL-LABEL: @D139275_c4001580(
461 ; ALL-NEXT: [[CMP:%.*]] = fcmp ugt float [[VAL:%.*]], 0.000000e+00
462 ; ALL-NEXT: br i1 [[CMP]], label [[IF_END:%.*]], label [[RETURN:%.*]]
464 ; ALL-NEXT: [[CMP1:%.*]] = fcmp ult float [[VAL]], 1.000000e+00
465 ; ALL-NEXT: br i1 [[CMP1]], label [[IF_END3:%.*]], label [[RETURN]]
467 ; ALL-NEXT: [[CMP4:%.*]] = fcmp olt float [[VAL]], 0x3FC99999A0000000
468 ; ALL-NEXT: br i1 [[CMP4]], label [[RETURN]], label [[IF_END6:%.*]]
470 ; ALL-NEXT: [[SUB:%.*]] = fadd float [[VAL]], 0xBFB99999A0000000
471 ; ALL-NEXT: br label [[RETURN]]
473 ; ALL-NEXT: [[RETVAL_0:%.*]] = phi float [ [[SUB]], [[IF_END6]] ], [ 0.000000e+00, [[ENTRY:%.*]] ], [ 0x3FB99999A0000000, [[IF_END]] ], [ 0.000000e+00, [[IF_END3]] ]
474 ; ALL-NEXT: ret float [[RETVAL_0]]
477 %cmp = fcmp ugt float %val, 0.000000e+00
478 br i1 %cmp, label %if.end, label %return
481 %cmp1 = fcmp ult float %val, 1.000000e+00
482 br i1 %cmp1, label %if.end3, label %return
485 %cmp4 = fcmp olt float %val, 0x3FC99999A0000000
486 br i1 %cmp4, label %return, label %if.end6
489 %sub = fadd float %val, 0xBFB99999A0000000
493 %retval.0 = phi float [ %sub, %if.end6 ], [ 0.000000e+00, %entry ], [ 0x3FB99999A0000000, %if.end ], [ 0.000000e+00, %if.end3 ]
497 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: