1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -aa-pipeline=basic-aa -enable-load-pre -enable-pre -passes=gvn -S < %s | FileCheck %s
4 declare void @side_effect()
5 declare i1 @side_effect_cond()
7 declare i32 @personality_function()
9 ; TODO: We can PRE the load away from the hot path.
10 define i32 @test_load_on_cold_path(ptr %p) {
11 ; CHECK-LABEL: @test_load_on_cold_path(
13 ; CHECK-NEXT: br label [[LOOP:%.*]]
15 ; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
16 ; CHECK-NEXT: [[X:%.*]] = load i32, ptr [[P:%.*]], align 4
17 ; CHECK-NEXT: [[COND:%.*]] = icmp ne i32 [[X]], 0
18 ; CHECK-NEXT: br i1 [[COND]], label [[HOT_PATH:%.*]], label [[COLD_PATH:%.*]]
20 ; CHECK-NEXT: br label [[BACKEDGE]]
22 ; CHECK-NEXT: call void @side_effect()
23 ; CHECK-NEXT: br label [[BACKEDGE]]
25 ; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], [[X]]
26 ; CHECK-NEXT: [[LOOP_COND:%.*]] = icmp ult i32 [[IV_NEXT]], 1000
27 ; CHECK-NEXT: br i1 [[LOOP_COND]], label [[LOOP]], label [[EXIT:%.*]]
29 ; CHECK-NEXT: ret i32 [[X]]
35 %iv = phi i32 [ 0, %entry], [%iv.next, %backedge]
37 %cond = icmp ne i32 %x, 0
38 br i1 %cond, label %hot_path, label %cold_path
44 call void @side_effect()
48 %iv.next = add i32 %iv, %x
49 %loop.cond = icmp ult i32 %iv.next, 1000
50 br i1 %loop.cond, label %loop, label %exit
56 ; PRE here is meaningless, so we should not do it.
57 define i32 @test_load_on_both_paths(ptr %p) {
58 ; CHECK-LABEL: @test_load_on_both_paths(
60 ; CHECK-NEXT: br label [[LOOP:%.*]]
62 ; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
63 ; CHECK-NEXT: [[X:%.*]] = load i32, ptr [[P:%.*]], align 4
64 ; CHECK-NEXT: [[COND:%.*]] = icmp ne i32 [[X]], 0
65 ; CHECK-NEXT: br i1 [[COND]], label [[HOT_PATH:%.*]], label [[COLD_PATH:%.*]]
67 ; CHECK-NEXT: call void @side_effect()
68 ; CHECK-NEXT: br label [[BACKEDGE]]
70 ; CHECK-NEXT: call void @side_effect()
71 ; CHECK-NEXT: br label [[BACKEDGE]]
73 ; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], [[X]]
74 ; CHECK-NEXT: [[LOOP_COND:%.*]] = icmp ult i32 [[IV_NEXT]], 1000
75 ; CHECK-NEXT: br i1 [[LOOP_COND]], label [[LOOP]], label [[EXIT:%.*]]
77 ; CHECK-NEXT: ret i32 [[X]]
83 %iv = phi i32 [ 0, %entry], [%iv.next, %backedge]
85 %cond = icmp ne i32 %x, 0
86 br i1 %cond, label %hot_path, label %cold_path
89 call void @side_effect()
93 call void @side_effect()
97 %iv.next = add i32 %iv, %x
98 %loop.cond = icmp ult i32 %iv.next, 1000
99 br i1 %loop.cond, label %loop, label %exit
106 ; We could PRE here, but it doesn't seem very profitable.
107 define i32 @test_load_on_backedge(ptr %p) {
108 ; CHECK-LABEL: @test_load_on_backedge(
110 ; CHECK-NEXT: br label [[LOOP:%.*]]
112 ; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
113 ; CHECK-NEXT: [[X:%.*]] = load i32, ptr [[P:%.*]], align 4
114 ; CHECK-NEXT: [[COND:%.*]] = icmp ne i32 [[X]], 0
115 ; CHECK-NEXT: br i1 [[COND]], label [[HOT_PATH:%.*]], label [[COLD_PATH:%.*]]
117 ; CHECK-NEXT: br label [[BACKEDGE]]
119 ; CHECK-NEXT: br label [[BACKEDGE]]
121 ; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], [[X]]
122 ; CHECK-NEXT: call void @side_effect()
123 ; CHECK-NEXT: [[LOOP_COND:%.*]] = icmp ult i32 [[IV_NEXT]], 1000
124 ; CHECK-NEXT: br i1 [[LOOP_COND]], label [[LOOP]], label [[EXIT:%.*]]
126 ; CHECK-NEXT: ret i32 [[X]]
132 %iv = phi i32 [ 0, %entry], [%iv.next, %backedge]
133 %x = load i32, ptr %p
134 %cond = icmp ne i32 %x, 0
135 br i1 %cond, label %hot_path, label %cold_path
144 %iv.next = add i32 %iv, %x
145 call void @side_effect()
146 %loop.cond = icmp ult i32 %iv.next, 1000
147 br i1 %loop.cond, label %loop, label %exit
153 ; TODO: We can PRE via splitting of the critical edge in the cold path.
154 define i32 @test_load_on_exiting_cold_path_01(ptr %p) {
155 ; CHECK-LABEL: @test_load_on_exiting_cold_path_01(
157 ; CHECK-NEXT: br label [[LOOP:%.*]]
159 ; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
160 ; CHECK-NEXT: [[X:%.*]] = load i32, ptr [[P:%.*]], align 4
161 ; CHECK-NEXT: [[COND:%.*]] = icmp ne i32 [[X]], 0
162 ; CHECK-NEXT: br i1 [[COND]], label [[HOT_PATH:%.*]], label [[COLD_PATH:%.*]]
164 ; CHECK-NEXT: br label [[BACKEDGE]]
166 ; CHECK-NEXT: [[SIDE_COND:%.*]] = call i1 @side_effect_cond()
167 ; CHECK-NEXT: br i1 [[SIDE_COND]], label [[BACKEDGE]], label [[COLD_EXIT:%.*]]
169 ; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], [[X]]
170 ; CHECK-NEXT: [[LOOP_COND:%.*]] = icmp ult i32 [[IV_NEXT]], 1000
171 ; CHECK-NEXT: br i1 [[LOOP_COND]], label [[LOOP]], label [[EXIT:%.*]]
173 ; CHECK-NEXT: ret i32 [[X]]
175 ; CHECK-NEXT: ret i32 -1
181 %iv = phi i32 [ 0, %entry], [%iv.next, %backedge]
182 %x = load i32, ptr %p
183 %cond = icmp ne i32 %x, 0
184 br i1 %cond, label %hot_path, label %cold_path
190 %side_cond = call i1 @side_effect_cond()
191 br i1 %side_cond, label %backedge, label %cold_exit
194 %iv.next = add i32 %iv, %x
195 %loop.cond = icmp ult i32 %iv.next, 1000
196 br i1 %loop.cond, label %loop, label %exit
205 ; TODO: We can PRE via splitting of the critical edge in the cold path.
206 define i32 @test_load_on_exiting_cold_path_02(ptr %p) gc "statepoint-example" personality ptr @personality_function {
207 ; CHECK-LABEL: @test_load_on_exiting_cold_path_02(
209 ; CHECK-NEXT: br label [[LOOP:%.*]]
211 ; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
212 ; CHECK-NEXT: [[X:%.*]] = load i32, ptr [[P:%.*]], align 4
213 ; CHECK-NEXT: [[COND:%.*]] = icmp ne i32 [[X]], 0
214 ; CHECK-NEXT: br i1 [[COND]], label [[HOT_PATH:%.*]], label [[COLD_PATH:%.*]]
216 ; CHECK-NEXT: br label [[BACKEDGE]]
218 ; CHECK-NEXT: invoke void @side_effect()
219 ; CHECK-NEXT: to label [[BACKEDGE]] unwind label [[COLD_EXIT:%.*]]
221 ; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], [[X]]
222 ; CHECK-NEXT: [[LOOP_COND:%.*]] = icmp ult i32 [[IV_NEXT]], 1000
223 ; CHECK-NEXT: br i1 [[LOOP_COND]], label [[LOOP]], label [[EXIT:%.*]]
225 ; CHECK-NEXT: ret i32 [[X]]
227 ; CHECK-NEXT: [[LANDING_PAD:%.*]] = landingpad token
228 ; CHECK-NEXT: cleanup
229 ; CHECK-NEXT: ret i32 -1
235 %iv = phi i32 [ 0, %entry], [%iv.next, %backedge]
236 %x = load i32, ptr %p
237 %cond = icmp ne i32 %x, 0
238 br i1 %cond, label %hot_path, label %cold_path
244 invoke void @side_effect() to label %backedge unwind label %cold_exit
247 %iv.next = add i32 %iv, %x
248 %loop.cond = icmp ult i32 %iv.next, 1000
249 br i1 %loop.cond, label %loop, label %exit
255 %landing_pad = landingpad token
260 ; Make sure we do not insert load into both cold path & backedge.
261 define i32 @test_load_on_cold_path_and_backedge(ptr %p) {
262 ; CHECK-LABEL: @test_load_on_cold_path_and_backedge(
264 ; CHECK-NEXT: br label [[LOOP:%.*]]
266 ; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
267 ; CHECK-NEXT: [[X:%.*]] = load i32, ptr [[P:%.*]], align 4
268 ; CHECK-NEXT: [[COND:%.*]] = icmp ne i32 [[X]], 0
269 ; CHECK-NEXT: br i1 [[COND]], label [[HOT_PATH:%.*]], label [[COLD_PATH:%.*]]
271 ; CHECK-NEXT: br label [[BACKEDGE]]
273 ; CHECK-NEXT: call void @side_effect()
274 ; CHECK-NEXT: br label [[BACKEDGE]]
276 ; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], [[X]]
277 ; CHECK-NEXT: [[LOOP_COND:%.*]] = icmp ult i32 [[IV_NEXT]], 1000
278 ; CHECK-NEXT: call void @side_effect()
279 ; CHECK-NEXT: br i1 [[LOOP_COND]], label [[LOOP]], label [[EXIT:%.*]]
281 ; CHECK-NEXT: ret i32 [[X]]
287 %iv = phi i32 [ 0, %entry], [%iv.next, %backedge]
288 %x = load i32, ptr %p
289 %cond = icmp ne i32 %x, 0
290 br i1 %cond, label %hot_path, label %cold_path
296 call void @side_effect()
300 %iv.next = add i32 %iv, %x
301 %loop.cond = icmp ult i32 %iv.next, 1000
302 call void @side_effect()
303 br i1 %loop.cond, label %loop, label %exit
309 ; TODO: We can PRE the load away from the hot path. Make sure we only insert 1 load.
310 define i32 @test_load_multi_block_cold_path(ptr %p) {
311 ; CHECK-LABEL: @test_load_multi_block_cold_path(
313 ; CHECK-NEXT: br label [[LOOP:%.*]]
315 ; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
316 ; CHECK-NEXT: [[X:%.*]] = load i32, ptr [[P:%.*]], align 4
317 ; CHECK-NEXT: [[COND:%.*]] = icmp ne i32 [[X]], 0
318 ; CHECK-NEXT: br i1 [[COND]], label [[HOT_PATH:%.*]], label [[COLD_PATH_1:%.*]]
320 ; CHECK-NEXT: br label [[BACKEDGE]]
321 ; CHECK: cold_path.1:
322 ; CHECK-NEXT: call void @side_effect()
323 ; CHECK-NEXT: call void @side_effect()
324 ; CHECK-NEXT: call void @side_effect()
325 ; CHECK-NEXT: br label [[BACKEDGE]]
327 ; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], [[X]]
328 ; CHECK-NEXT: [[LOOP_COND:%.*]] = icmp ult i32 [[IV_NEXT]], 1000
329 ; CHECK-NEXT: call void @side_effect()
330 ; CHECK-NEXT: br i1 [[LOOP_COND]], label [[LOOP]], label [[EXIT:%.*]]
332 ; CHECK-NEXT: ret i32 [[X]]
338 %iv = phi i32 [ 0, %entry], [%iv.next, %backedge]
339 %x = load i32, ptr %p
340 %cond = icmp ne i32 %x, 0
341 br i1 %cond, label %hot_path, label %cold_path.1
347 call void @side_effect()
348 br label %cold_path.2
351 call void @side_effect()
352 br label %cold_path.3
355 call void @side_effect()
359 %iv.next = add i32 %iv, %x
360 %loop.cond = icmp ult i32 %iv.next, 1000
361 call void @side_effect()
362 br i1 %loop.cond, label %loop, label %exit
368 ; TODO: We can PRE via splitting of the critical edge in the cold path. Make sure we only insert 1 load.
369 define i32 @test_load_on_multi_exiting_cold_path(ptr %p) {
370 ; CHECK-LABEL: @test_load_on_multi_exiting_cold_path(
372 ; CHECK-NEXT: br label [[LOOP:%.*]]
374 ; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
375 ; CHECK-NEXT: [[X:%.*]] = load i32, ptr [[P:%.*]], align 4
376 ; CHECK-NEXT: [[COND:%.*]] = icmp ne i32 [[X]], 0
377 ; CHECK-NEXT: br i1 [[COND]], label [[HOT_PATH:%.*]], label [[COLD_PATH_1:%.*]]
379 ; CHECK-NEXT: br label [[BACKEDGE]]
380 ; CHECK: cold_path.1:
381 ; CHECK-NEXT: [[SIDE_COND_1:%.*]] = call i1 @side_effect_cond()
382 ; CHECK-NEXT: br i1 [[SIDE_COND_1]], label [[COLD_PATH_2:%.*]], label [[COLD_EXIT:%.*]]
383 ; CHECK: cold_path.2:
384 ; CHECK-NEXT: [[SIDE_COND_2:%.*]] = call i1 @side_effect_cond()
385 ; CHECK-NEXT: br i1 [[SIDE_COND_2]], label [[COLD_PATH_3:%.*]], label [[COLD_EXIT]]
386 ; CHECK: cold_path.3:
387 ; CHECK-NEXT: [[SIDE_COND_3:%.*]] = call i1 @side_effect_cond()
388 ; CHECK-NEXT: br i1 [[SIDE_COND_3]], label [[BACKEDGE]], label [[COLD_EXIT]]
390 ; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], [[X]]
391 ; CHECK-NEXT: [[LOOP_COND:%.*]] = icmp ult i32 [[IV_NEXT]], 1000
392 ; CHECK-NEXT: br i1 [[LOOP_COND]], label [[LOOP]], label [[EXIT:%.*]]
394 ; CHECK-NEXT: ret i32 [[X]]
396 ; CHECK-NEXT: ret i32 -1
402 %iv = phi i32 [ 0, %entry], [%iv.next, %backedge]
403 %x = load i32, ptr %p
404 %cond = icmp ne i32 %x, 0
405 br i1 %cond, label %hot_path, label %cold_path.1
411 %side_cond.1 = call i1 @side_effect_cond()
412 br i1 %side_cond.1, label %cold_path.2, label %cold_exit
415 %side_cond.2 = call i1 @side_effect_cond()
416 br i1 %side_cond.2, label %cold_path.3, label %cold_exit
419 %side_cond.3 = call i1 @side_effect_cond()
420 br i1 %side_cond.3, label %backedge, label %cold_exit
423 %iv.next = add i32 %iv, %x
424 %loop.cond = icmp ult i32 %iv.next, 1000
425 br i1 %loop.cond, label %loop, label %exit
434 ; TODO: PRE via splittinga backedge in the cold loop. Make sure we don't insert a load into an inner loop.
435 define i32 @test_inner_loop(ptr %p) {
436 ; CHECK-LABEL: @test_inner_loop(
438 ; CHECK-NEXT: br label [[LOOP:%.*]]
440 ; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
441 ; CHECK-NEXT: [[X:%.*]] = load i32, ptr [[P:%.*]], align 4
442 ; CHECK-NEXT: [[COND:%.*]] = icmp ne i32 [[X]], 0
443 ; CHECK-NEXT: br i1 [[COND]], label [[HOT_PATH:%.*]], label [[COLD_PATH:%.*]]
445 ; CHECK-NEXT: br label [[BACKEDGE]]
447 ; CHECK-NEXT: br label [[INNER_LOOP:%.*]]
449 ; CHECK-NEXT: call void @side_effect()
450 ; CHECK-NEXT: br i1 undef, label [[INNER_LOOP]], label [[BACKEDGE]]
452 ; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], [[X]]
453 ; CHECK-NEXT: [[LOOP_COND:%.*]] = icmp ult i32 [[IV_NEXT]], 1000
454 ; CHECK-NEXT: br i1 [[LOOP_COND]], label [[LOOP]], label [[EXIT:%.*]]
456 ; CHECK-NEXT: ret i32 [[X]]
462 %iv = phi i32 [ 0, %entry], [%iv.next, %backedge]
463 %x = load i32, ptr %p
464 %cond = icmp ne i32 %x, 0
465 br i1 %cond, label %hot_path, label %cold_path
474 call void @side_effect()
475 br i1 undef, label %inner_loop, label %backedge
478 %iv.next = add i32 %iv, %x
479 %loop.cond = icmp ult i32 %iv.next, 1000
480 br i1 %loop.cond, label %loop, label %exit
486 ; TODO: We can PRE here, but profitablility depends on frequency of cold blocks. Conservatively, we should not do it unless there is a reason.
487 define i32 @test_multiple_cold_paths(ptr %p) {
488 ; CHECK-LABEL: @test_multiple_cold_paths(
490 ; CHECK-NEXT: br label [[LOOP:%.*]]
492 ; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
493 ; CHECK-NEXT: [[X:%.*]] = load i32, ptr [[P:%.*]], align 4
494 ; CHECK-NEXT: [[COND_1:%.*]] = icmp ne i32 [[X]], 0
495 ; CHECK-NEXT: br i1 [[COND_1]], label [[HOT_PATH_1:%.*]], label [[COLD_PATH_1:%.*]]
497 ; CHECK-NEXT: br label [[DOM_1:%.*]]
498 ; CHECK: cold_path.1:
499 ; CHECK-NEXT: call void @side_effect()
500 ; CHECK-NEXT: br label [[DOM_1]]
502 ; CHECK-NEXT: [[COND_2:%.*]] = icmp ne i32 [[X]], 1
503 ; CHECK-NEXT: br i1 [[COND_2]], label [[HOT_PATH_2:%.*]], label [[COLD_PATH_2:%.*]]
505 ; CHECK-NEXT: br label [[DOM_2:%.*]]
506 ; CHECK: cold_path.2:
507 ; CHECK-NEXT: call void @side_effect()
508 ; CHECK-NEXT: br label [[DOM_2]]
510 ; CHECK-NEXT: [[COND_3:%.*]] = icmp ne i32 [[X]], 2
511 ; CHECK-NEXT: br i1 [[COND_3]], label [[HOT_PATH_3:%.*]], label [[COLD_PATH_3:%.*]]
513 ; CHECK-NEXT: br label [[BACKEDGE]]
514 ; CHECK: cold_path.3:
515 ; CHECK-NEXT: call void @side_effect()
516 ; CHECK-NEXT: br label [[BACKEDGE]]
518 ; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], [[X]]
519 ; CHECK-NEXT: [[LOOP_COND:%.*]] = icmp ult i32 [[IV_NEXT]], 1000
520 ; CHECK-NEXT: br i1 [[LOOP_COND]], label [[LOOP]], label [[EXIT:%.*]]
522 ; CHECK-NEXT: ret i32 [[X]]
528 %iv = phi i32 [ 0, %entry], [%iv.next, %backedge]
529 %x = load i32, ptr %p
530 %cond.1 = icmp ne i32 %x, 0
531 br i1 %cond.1, label %hot_path.1, label %cold_path.1
537 call void @side_effect()
541 %cond.2 = icmp ne i32 %x, 1
542 br i1 %cond.2, label %hot_path.2, label %cold_path.2
548 call void @side_effect()
552 %cond.3 = icmp ne i32 %x, 2
553 br i1 %cond.3, label %hot_path.3, label %cold_path.3
559 call void @side_effect()
563 %iv.next = add i32 %iv, %x
564 %loop.cond = icmp ult i32 %iv.next, 1000
565 br i1 %loop.cond, label %loop, label %exit
571 ; TODO: We can PRE via split of critical edge.
572 define i32 @test_side_exit_after_merge(ptr %p) {
573 ; CHECK-LABEL: @test_side_exit_after_merge(
575 ; CHECK-NEXT: br label [[LOOP:%.*]]
577 ; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
578 ; CHECK-NEXT: [[X:%.*]] = load i32, ptr [[P:%.*]], align 4
579 ; CHECK-NEXT: [[COND:%.*]] = icmp ne i32 [[X]], 0
580 ; CHECK-NEXT: br i1 [[COND]], label [[HOT_PATH:%.*]], label [[COLD_PATH:%.*]]
582 ; CHECK-NEXT: br label [[BACKEDGE]]
584 ; CHECK-NEXT: [[COND_1:%.*]] = icmp ne i32 [[IV]], 1
585 ; CHECK-NEXT: br i1 [[COND_1]], label [[DO_CALL:%.*]], label [[SIDE_EXITING:%.*]]
587 ; CHECK-NEXT: [[SIDE_COND:%.*]] = call i1 @side_effect_cond()
588 ; CHECK-NEXT: br label [[SIDE_EXITING]]
589 ; CHECK: side_exiting:
590 ; CHECK-NEXT: [[SIDE_COND_PHI:%.*]] = phi i1 [ [[SIDE_COND]], [[DO_CALL]] ], [ true, [[COLD_PATH]] ]
591 ; CHECK-NEXT: br i1 [[SIDE_COND_PHI]], label [[BACKEDGE]], label [[COLD_EXIT:%.*]]
593 ; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], [[X]]
594 ; CHECK-NEXT: [[LOOP_COND:%.*]] = icmp ult i32 [[IV_NEXT]], 1000
595 ; CHECK-NEXT: br i1 [[LOOP_COND]], label [[LOOP]], label [[EXIT:%.*]]
597 ; CHECK-NEXT: ret i32 [[X]]
599 ; CHECK-NEXT: ret i32 -1
605 %iv = phi i32 [ 0, %entry], [%iv.next, %backedge]
606 %x = load i32, ptr %p
607 %cond = icmp ne i32 %x, 0
608 br i1 %cond, label %hot_path, label %cold_path
614 %cond.1 = icmp ne i32 %iv, 1
615 br i1 %cond.1, label %do_call, label %side_exiting
618 %side_cond = call i1 @side_effect_cond()
619 br label %side_exiting
622 %side_cond_phi = phi i1 [%side_cond, %do_call], [true, %cold_path]
623 br i1 %side_cond_phi, label %backedge, label %cold_exit
626 %iv.next = add i32 %iv, %x
627 %loop.cond = icmp ult i32 %iv.next, 1000
628 br i1 %loop.cond, label %loop, label %exit