1 ; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -disable-block-placement -verify-machineinstrs -fast-isel=false -machine-sink-split-probability-threshold=0 -cgp-freq-ratio-to-skip-merge=1000 | FileCheck %s
3 ; Test the CFG stackifier pass.
5 ; Explicitly disable fast-isel, since it gets implicitly enabled in the
8 target triple = "wasm32-unknown-unknown"
10 declare void @something()
12 ; Test that loops are made contiguous, even in the presence of split backedges.
20 ; CHECK-NEXT: .LBB{{[0-9]+}}_3:
21 ; CHECK-NEXT: end_block
22 ; CHECK-NEXT: i32.const
26 ; CHECK-NEXT: .LBB{{[0-9]+}}_4:
27 ; CHECK-NEXT: end_loop
28 define void @test0(i32 %n) {
33 %i = phi i32 [ 0, %entry ], [ %i.next, %back ]
34 %i.next = add i32 %i, 1
36 %c = icmp slt i32 %i.next, %n
37 br i1 %c, label %back, label %exit
43 call void @something()
47 ; Same as test0, but the branch condition is reversed.
55 ; CHECK-NEXT: .LBB{{[0-9]+}}_3:
56 ; CHECK-NEXT: end_block
57 ; CHECK-NEXT: i32.const
61 ; CHECK-NEXT: .LBB{{[0-9]+}}_4:
62 ; CHECK-NEXT: end_loop
63 define void @test1(i32 %n) {
68 %i = phi i32 [ 0, %entry ], [ %i.next, %back ]
69 %i.next = add i32 %i, 1
71 %c = icmp sge i32 %i.next, %n
72 br i1 %c, label %exit, label %back
78 call void @something()
82 ; Test that a simple loop is handled as expected.
87 ; CHECK: br_if 0, {{[^,]+}}{{$}}
88 ; CHECK: .LBB{{[0-9]+}}_{{[0-9]+}}:
90 ; CHECK: br_if 0, $pop{{[0-9]+}}{{$}}
91 ; CHECK: .LBB{{[0-9]+}}_{{[0-9]+}}:
95 define void @test2(double* nocapture %p, i32 %n) {
97 %cmp.4 = icmp sgt i32 %n, 0
98 br i1 %cmp.4, label %for.body.preheader, label %for.end
104 %i.05 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
105 %arrayidx = getelementptr inbounds double, double* %p, i32 %i.05
106 %0 = load double, double* %arrayidx, align 8
107 %mul = fmul double %0, 3.200000e+00
108 store double %mul, double* %arrayidx, align 8
109 %inc = add nuw nsw i32 %i.05, 1
110 %exitcond = icmp eq i32 %inc, %n
111 br i1 %exitcond, label %for.end.loopexit, label %for.body
120 ; CHECK-LABEL: doublediamond:
122 ; CHECK-NEXT: block {{$}}
123 ; CHECK: br_if 0, ${{[^,]+}}{{$}}
125 ; CHECK: .LBB{{[0-9]+}}_2:
126 ; CHECK-NEXT: end_block{{$}}
128 ; CHECK: br_if 0, ${{[^,]+}}{{$}}
130 ; CHECK: .LBB{{[0-9]+}}_4:
131 ; CHECK-NEXT: end_block{{$}}
132 ; CHECK: .LBB{{[0-9]+}}_5:
133 ; CHECK-NEXT: end_block{{$}}
134 ; CHECK: i32.const $push{{[0-9]+}}=, 0{{$}}
135 ; CHECK-NEXT: return $pop{{[0-9]+}}{{$}}
136 define i32 @doublediamond(i32 %a, i32 %b, i32* %p) {
138 %c = icmp eq i32 %a, 0
139 %d = icmp eq i32 %b, 0
140 store volatile i32 0, i32* %p
141 br i1 %c, label %true, label %false
143 store volatile i32 1, i32* %p
146 store volatile i32 2, i32* %p
147 br i1 %d, label %ft, label %ff
149 store volatile i32 3, i32* %p
152 store volatile i32 4, i32* %p
155 store volatile i32 5, i32* %p
159 ; CHECK-LABEL: triangle:
161 ; CHECK: br_if 0, $1{{$}}
162 ; CHECK: .LBB{{[0-9]+}}_2:
164 define i32 @triangle(i32* %p, i32 %a) {
166 %c = icmp eq i32 %a, 0
167 store volatile i32 0, i32* %p
168 br i1 %c, label %true, label %exit
170 store volatile i32 1, i32* %p
173 store volatile i32 2, i32* %p
177 ; CHECK-LABEL: diamond:
180 ; CHECK: br_if 0, $1{{$}}
182 ; CHECK: .LBB{{[0-9]+}}_2:
183 ; CHECK: .LBB{{[0-9]+}}_3:
184 ; CHECK: i32.const $push{{[0-9]+}}=, 0{{$}}
185 ; CHECK-NEXT: return $pop{{[0-9]+}}{{$}}
186 define i32 @diamond(i32* %p, i32 %a) {
188 %c = icmp eq i32 %a, 0
189 store volatile i32 0, i32* %p
190 br i1 %c, label %true, label %false
192 store volatile i32 1, i32* %p
195 store volatile i32 2, i32* %p
198 store volatile i32 3, i32* %p
202 ; CHECK-LABEL: single_block:
204 ; CHECK: return $pop{{[0-9]+}}{{$}}
205 define i32 @single_block(i32* %p) {
207 store volatile i32 0, i32* %p
211 ; CHECK-LABEL: minimal_loop:
213 ; CHECK: .LBB{{[0-9]+}}_1:
215 ; CHECK: i32.store 0($0), $pop{{[0-9]+}}{{$}}
217 ; CHECK: .LBB{{[0-9]+}}_2:
218 define i32 @minimal_loop(i32* %p) {
220 store volatile i32 0, i32* %p
223 store volatile i32 1, i32* %p
227 ; CHECK-LABEL: simple_loop:
229 ; CHECK: .LBB{{[0-9]+}}_1:
231 ; CHECK: br_if 0, $pop{{[0-9]+}}{{$}}
232 ; CHECK-NEXT: end_loop{{$}}
233 ; CHECK: i32.const $push{{[0-9]+}}=, 0{{$}}
234 ; CHECK-NEXT: return $pop{{[0-9]+}}{{$}}
235 define i32 @simple_loop(i32* %p, i32 %a) {
237 %c = icmp eq i32 %a, 0
238 store volatile i32 0, i32* %p
241 store volatile i32 1, i32* %p
242 br i1 %c, label %loop, label %exit
244 store volatile i32 2, i32* %p
248 ; CHECK-LABEL: doubletriangle:
250 ; CHECK: br_if 0, $0{{$}}
252 ; CHECK: br_if 0, $1{{$}}
253 ; CHECK: .LBB{{[0-9]+}}_3:
254 ; CHECK: .LBB{{[0-9]+}}_4:
256 define i32 @doubletriangle(i32 %a, i32 %b, i32* %p) {
258 %c = icmp eq i32 %a, 0
259 %d = icmp eq i32 %b, 0
260 store volatile i32 0, i32* %p
261 br i1 %c, label %true, label %exit
263 store volatile i32 2, i32* %p
264 br i1 %d, label %tt, label %tf
266 store volatile i32 3, i32* %p
269 store volatile i32 4, i32* %p
272 store volatile i32 5, i32* %p
276 ; CHECK-LABEL: ifelse_earlyexits:
279 ; CHECK: br_if 0, $0{{$}}
281 ; CHECK: .LBB{{[0-9]+}}_2:
282 ; CHECK: br_if 0, $1{{$}}
283 ; CHECK: .LBB{{[0-9]+}}_4:
284 ; CHECK: i32.const $push{{[0-9]+}}=, 0{{$}}
285 ; CHECK-NEXT: return $pop{{[0-9]+}}{{$}}
286 define i32 @ifelse_earlyexits(i32 %a, i32 %b, i32* %p) {
288 %c = icmp eq i32 %a, 0
289 %d = icmp eq i32 %b, 0
290 store volatile i32 0, i32* %p
291 br i1 %c, label %true, label %false
293 store volatile i32 1, i32* %p
296 store volatile i32 2, i32* %p
297 br i1 %d, label %ft, label %exit
299 store volatile i32 3, i32* %p
302 store volatile i32 4, i32* %p
306 ; CHECK-LABEL: doublediamond_in_a_loop:
307 ; CHECK: .LBB{{[0-9]+}}_1:
308 ; CHECK: loop i32{{$}}
310 ; CHECK: br_if 0, $0{{$}}
312 ; CHECK: .LBB{{[0-9]+}}_3:
313 ; CHECK: end_block{{$}}
315 ; CHECK: br_if 0, $1{{$}}
317 ; CHECK: .LBB{{[0-9]+}}_5:
319 ; CHECK: .LBB{{[0-9]+}}_6:
320 ; CHECK-NEXT: end_loop{{$}}
321 define i32 @doublediamond_in_a_loop(i32 %a, i32 %b, i32* %p) {
325 %c = icmp eq i32 %a, 0
326 %d = icmp eq i32 %b, 0
327 store volatile i32 0, i32* %p
328 br i1 %c, label %true, label %false
330 store volatile i32 1, i32* %p
333 store volatile i32 2, i32* %p
334 br i1 %d, label %ft, label %ff
336 store volatile i32 3, i32* %p
339 store volatile i32 4, i32* %p
342 store volatile i32 5, i32* %p
346 ; Test that nested loops are handled.
348 ; CHECK-LABEL: test3:
351 ; CHECK-NEXT: .LBB{{[0-9]+}}_{{[0-9]+}}:
354 define void @test3(i32 %w, i32 %x) {
356 br i1 undef, label %outer.ph, label %exit
362 %tobool = icmp eq i32 %x, 0
363 br i1 %tobool, label %inner, label %unreachable
369 %c = icmp eq i32 %x, %w
370 br i1 %c, label %if.end, label %inner
380 ; Test switch lowering and block placement.
382 ; CHECK-LABEL: test4:
383 ; CHECK-NEXT: .functype test4 (i32) -> (){{$}}
384 ; CHECK-NEXT: block {{$}}
385 ; CHECK-NEXT: block {{$}}
386 ; CHECK-NEXT: br_table $0, 1, 1, 1, 1, 1, 0{{$}}
387 ; CHECK-NEXT: .LBB{{[0-9]+}}_1:
388 ; CHECK-NEXT: end_block{{$}}
389 ; CHECK-NEXT: i32.const $push[[C:[0-9]+]]=, 622{{$}}
390 ; CHECK-NEXT: i32.eq $drop=, $0, $pop[[C]]{{$}}
391 ; CHECK-NEXT: .LBB{{[0-9]+}}_2:
392 ; CHECK-NEXT: end_block{{$}}
393 ; CHECK-NEXT: return{{$}}
394 define void @test4(i32 %t) {
396 switch i32 %t, label %default [
416 ; Test a case where the BLOCK needs to be placed before the LOOP in the
419 ; CHECK-LABEL: test5:
420 ; CHECK: .LBB{{[0-9]+}}_1:
421 ; CHECK-NEXT: block {{$}}
422 ; CHECK-NEXT: loop {{$}}
423 ; CHECK: br_if 1, {{[^,]+}}{{$}}
424 ; CHECK: br_if 0, {{[^,]+}}{{$}}
425 ; CHECK-NEXT: end_loop{{$}}
427 ; CHECK-NEXT: .LBB{{[0-9]+}}_4:
429 define void @test5(i1 %p, i1 %q) {
434 store volatile i32 0, i32* null
435 br i1 %p, label %more, label %alt
438 store volatile i32 1, i32* null
439 br i1 %q, label %header, label %return
442 store volatile i32 2, i32* null
446 store volatile i32 3, i32* null
450 ; Test an interesting case of a loop with multiple exits, which
451 ; aren't to layout successors of the loop, and one of which is to a successors
452 ; which has another predecessor.
454 ; CHECK-LABEL: test6:
455 ; CHECK: .LBB{{[0-9]+}}_1:
456 ; CHECK-NEXT: block {{$}}
457 ; CHECK-NEXT: block {{$}}
458 ; CHECK-NEXT: loop {{$}}
460 ; CHECK: br_if 2, {{[^,]+}}{{$}}
462 ; CHECK: br_if 1, {{[^,]+}}{{$}}
464 ; CHECK: br_if 0, {{[^,]+}}{{$}}
465 ; CHECK-NEXT: end_loop{{$}}
468 ; CHECK-NEXT: .LBB{{[0-9]+}}_5:
469 ; CHECK-NEXT: end_block{{$}}
471 ; CHECK: .LBB{{[0-9]+}}_6:
472 ; CHECK-NEXT: end_block{{$}}
475 define void @test6(i1 %p, i1 %q) {
480 store volatile i32 0, i32* null
481 br i1 %p, label %more, label %second
484 store volatile i32 1, i32* null
485 br i1 %q, label %evenmore, label %first
488 store volatile i32 1, i32* null
489 br i1 %q, label %header, label %return
492 store volatile i32 2, i32* null
496 store volatile i32 3, i32* null
500 store volatile i32 4, i32* null
504 ; Test a case where there are multiple backedges and multiple loop exits
505 ; that end in unreachable.
507 ; CHECK-LABEL: test7:
508 ; CHECK: .LBB{{[0-9]+}}_1:
509 ; CHECK-NEXT: loop {{$}}
512 ; CHECK: br_if 0, {{[^,]+}}{{$}}
514 ; CHECK: br_if 1, {{[^,]+}}{{$}}
517 ; CHECK-NEXT: .LBB{{[0-9]+}}_4:
518 ; CHECK-NEXT: end_block{{$}}
520 ; CHECK: br_if 0, {{[^,]+}}{{$}}
521 ; CHECK-NEXT: end_loop{{$}}
524 define void @test7(i1 %tobool2, i1 %tobool9) {
526 store volatile i32 0, i32* null
530 store volatile i32 1, i32* null
531 br i1 %tobool2, label %l1, label %l0
534 store volatile i32 2, i32* null
535 br i1 %tobool9, label %loop, label %u0
538 store volatile i32 3, i32* null
539 br i1 %tobool9, label %loop, label %u1
542 store volatile i32 4, i32* null
546 store volatile i32 5, i32* null
550 ; Test an interesting case using nested loops and switches.
552 ; CHECK-LABEL: test8:
553 ; CHECK: .LBB{{[0-9]+}}_1:
554 ; CHECK-NEXT: loop i32{{$}}
555 ; CHECK-NEXT: i32.const $push{{[^,]+}}, 0{{$}}
556 ; CHECK-NEXT: br_if 0, {{[^,]+}}{{$}}
557 ; CHECK-NEXT: br 0{{$}}
558 ; CHECK-NEXT: .LBB{{[0-9]+}}_2:
559 ; CHECK-NEXT: end_loop{{$}}
560 define i32 @test8() {
565 br i1 undef, label %bb2, label %bb3
568 switch i8 undef, label %bb1 [
573 switch i8 undef, label %bb1 [
578 ; Test an interesting case using nested loops that share a bottom block.
580 ; CHECK-LABEL: test9:
581 ; CHECK: .LBB{{[0-9]+}}_1:
582 ; CHECK-NEXT: block {{$}}
583 ; CHECK-NEXT: loop {{$}}
585 ; CHECK: br_if 1, {{[^,]+}}{{$}}
586 ; CHECK-NEXT: .LBB{{[0-9]+}}_2:
587 ; CHECK-NEXT: loop {{$}}
591 ; CHECK: br_if 0, {{[^,]+}}{{$}}
593 ; CHECK: br_if 2, {{[^,]+}}{{$}}
594 ; CHECK-NEXT: br 1{{$}}
595 ; CHECK-NEXT: .LBB{{[0-9]+}}_4:
596 ; CHECK-NEXT: end_block{{$}}
598 ; CHECK: br_if 1, {{[^,]+}}{{$}}
599 ; CHECK-NEXT: br 0{{$}}
600 ; CHECK-NEXT: .LBB{{[0-9]+}}_5:
606 define void @test9() {
608 store volatile i32 0, i32* null
612 store volatile i32 1, i32* null
613 %call4 = call i1 @a()
614 br i1 %call4, label %header2, label %end
617 store volatile i32 2, i32* null
619 br i1 %call, label %if.then, label %if.else
622 store volatile i32 3, i32* null
623 %call3 = call i1 @a()
624 br i1 %call3, label %header2, label %header
627 store volatile i32 4, i32* null
628 %call2 = call i1 @a()
629 br i1 %call2, label %header2, label %header
632 store volatile i32 5, i32* null
636 ; Test an interesting case involving nested loops sharing a loop bottom,
637 ; and loop exits to a block with unreachable.
639 ; CHECK-LABEL: test10:
640 ; CHECK: .LBB{{[0-9]+}}_1:
641 ; CHECK-NEXT: loop {{$}}
642 ; CHECK: br_if 0, {{[^,]+}}{{$}}
643 ; CHECK: .LBB{{[0-9]+}}_3:
644 ; CHECK-NEXT: block {{$}}
645 ; CHECK-NEXT: loop {{$}}
646 ; CHECK: .LBB{{[0-9]+}}_4:
647 ; CHECK-NEXT: loop {{$}}
648 ; CHECK: br_if 0, {{[^,]+}}{{$}}
649 ; CHECK-NEXT: end_loop{{$}}
650 ; CHECK-NEXT: block {{$}}
652 ; CHECK: br_table $pop{{[^,]+}}, 0, 3, 1, 2, 3
653 ; CHECK-NEXT: .LBB{{[0-9]+}}_6:
654 ; CHECK-NEXT: end_block{{$}}
655 ; CHECK-NEXT: end_loop{{$}}
656 ; CHECK-NEXT: return{{$}}
657 ; CHECK-NEXT: .LBB{{[0-9]+}}_7:
658 ; CHECK-NEXT: end_block{{$}}
660 ; CHECK-NEXT: .LBB{{[0-9]+}}_8:
661 ; CHECK-NEXT: end_loop{{$}}
662 define void @test10() {
667 %tmp = phi i32 [ 2, %bb0 ], [ 3, %bb3 ]
668 %tmp3 = phi i32 [ undef, %bb0 ], [ %tmp11, %bb3 ]
669 %tmp4 = icmp eq i32 %tmp3, 0
670 br i1 %tmp4, label %bb4, label %bb2
676 %tmp11 = phi i32 [ 1, %bb5 ], [ 0, %bb2 ]
680 %tmp6 = phi i32 [ %tmp9, %bb5 ], [ 4, %bb1 ]
681 %tmp7 = phi i32 [ %tmp6, %bb5 ], [ %tmp, %bb1 ]
685 %tmp9 = phi i32 [ %tmp6, %bb5 ], [ %tmp7, %bb4 ]
686 switch i32 %tmp9, label %bb2 [
697 ; Test a CFG DAG with interesting merging.
699 ; CHECK-LABEL: test11:
701 ; CHECK-NEXT: block {{$}}
702 ; CHECK-NEXT: block {{$}}
703 ; CHECK-NEXT: block {{$}}
704 ; CHECK: br_if 0, {{[^,]+}}{{$}}
707 ; CHECK-NEXT: i32.const
708 ; CHECK-NEXT: br_if 0, {{[^,]+}}{{$}}
710 ; CHECK: br_if 2, {{[^,]+}}{{$}}
711 ; CHECK-NEXT: .LBB{{[0-9]+}}_3:
712 ; CHECK-NEXT: end_block{{$}}
715 ; CHECK-NEXT: .LBB{{[0-9]+}}_4:
716 ; CHECK-NEXT: end_block{{$}}
718 ; CHECK: br_if 1, {{[^,]+}}{{$}}
720 ; CHECK: br_if 2, {{[^,]+}}{{$}}
721 ; CHECK-NEXT: .LBB{{[0-9]+}}_6:
722 ; CHECK-NEXT: end_block{{$}}
725 ; CHECK-NEXT: .LBB{{[0-9]+}}_7:
726 ; CHECK-NEXT: end_block{{$}}
729 ; CHECK-NEXT: .LBB{{[0-9]+}}_8:
730 ; CHECK-NEXT: end_block{{$}}
733 define void @test11() {
735 store volatile i32 0, i32* null
736 br i1 undef, label %bb1, label %bb4
738 store volatile i32 1, i32* null
739 br i1 undef, label %bb3, label %bb2
741 store volatile i32 2, i32* null
742 br i1 undef, label %bb3, label %bb7
744 store volatile i32 3, i32* null
747 store volatile i32 4, i32* null
748 br i1 undef, label %bb8, label %bb5
750 store volatile i32 5, i32* null
751 br i1 undef, label %bb6, label %bb7
753 store volatile i32 6, i32* null
756 store volatile i32 7, i32* null
759 store volatile i32 8, i32* null
763 ; CHECK-LABEL: test12:
764 ; CHECK: .LBB{{[0-9]+}}_1:
765 ; CHECK-NEXT: block {{$}}
766 ; CHECK-NEXT: loop {{$}}
767 ; CHECK-NEXT: block {{$}}
768 ; CHECK-NEXT: block {{$}}
769 ; CHECK: br_table {{[^,]+}}, 1, 3, 3, 3, 1, 0{{$}}
770 ; CHECK-NEXT: .LBB{{[0-9]+}}_2:
771 ; CHECK-NEXT: end_block{{$}}
772 ; CHECK: br_if 0, {{[^,]+}}{{$}}
773 ; CHECK: br_if 2, {{[^,]+}}{{$}}
774 ; CHECK-NEXT: .LBB{{[0-9]+}}_4:
775 ; CHECK-NEXT: end_block{{$}}
777 ; CHECK-NEXT: .LBB{{[0-9]+}}_5:
778 ; CHECK-NEXT: end_loop{{$}}
779 ; CHECK-NEXT: end_block{{$}}
780 ; CHECK-NEXT: return{{$}}
781 define void @test12(i8* %arg) {
786 %tmp = phi i32 [ 0, %bb ], [ %tmp5, %bb4 ]
787 %tmp2 = getelementptr i8, i8* %arg, i32 %tmp
788 %tmp3 = load i8, i8* %tmp2
789 switch i8 %tmp3, label %bb7 [
797 %tmp5 = add i32 %tmp, 1
804 ; A block can be "branched to" from another even if it is also reachable via
805 ; fallthrough from the other. This would normally be optimized away, so use
806 ; optnone to disable optimizations to test this case.
808 ; CHECK-LABEL: test13:
810 ; CHECK-NEXT: block {{$}}
811 ; CHECK: br_if 0, $pop0{{$}}
813 ; CHECK: br_if 0, $pop3{{$}}
814 ; CHECK: .LBB{{[0-9]+}}_3:
815 ; CHECK-NEXT: end_block{{$}}
816 ; CHECK: br_if 1, $pop{{[0-9]+}}{{$}}
817 ; CHECK-NEXT: br 1{{$}}
818 ; CHECK-NEXT: .LBB{{[0-9]+}}_4:
819 ; CHECK-NEXT: end_block{{$}}
820 ; CHECK-NEXT: return{{$}}
821 ; CHECK-NEXT: .LBB{{[0-9]+}}_5:
822 ; CHECK-NEXT: end_block{{$}}
823 ; CHECK-NEXT: unreachable{{$}}
824 define void @test13() noinline optnone {
826 br i1 undef, label %bb5, label %bb2
830 br i1 undef, label %bb3, label %bb4
834 %tmp = phi i1 [ false, %bb2 ], [ false, %bb3 ]
835 br i1 %tmp, label %bb1, label %bb1
840 ; Test a case with a single-block loop that has another loop
841 ; as a successor. The end_loop for the first loop should go
842 ; before the loop for the second.
844 ; CHECK-LABEL: test14:
845 ; CHECK: .LBB{{[0-9]+}}_1:{{$}}
846 ; CHECK-NEXT: loop {{$}}
847 ; CHECK-NEXT: i32.const $push0=, 0{{$}}
848 ; CHECK-NEXT: br_if 0, $pop0{{$}}
849 ; CHECK-NEXT: end_loop{{$}}
850 ; CHECK-NEXT: .LBB{{[0-9]+}}_3:{{$}}
851 ; CHECK-NEXT: loop {{$}}
852 ; CHECK-NEXT: i32.const $push1=, 0{{$}}
853 ; CHECK-NEXT: br_if 0, $pop1{{$}}
854 ; CHECK-NEXT: end_loop{{$}}
855 ; CHECK-NEXT: return{{$}}
856 define void @test14() {
861 %tmp = bitcast i1 undef to i1
862 br i1 %tmp, label %bb3, label %bb1
868 br i1 undef, label %bb7, label %bb48
871 br i1 undef, label %bb12, label %bb12
874 br i1 undef, label %bb17, label %bb17
877 br i1 undef, label %bb22, label %bb22
880 br i1 undef, label %bb27, label %bb27
883 br i1 undef, label %bb30, label %bb30
886 br i1 undef, label %bb35, label %bb35
889 br i1 undef, label %bb38, label %bb38
892 br i1 undef, label %bb48, label %bb48
895 %tmp49 = bitcast i1 undef to i1
896 br i1 %tmp49, label %bb3, label %bb50
902 ; Test that a block boundary which ends one block, begins another block, and
903 ; also begins a loop, has the markers placed in the correct order.
905 ; CHECK-LABEL: test15:
908 ; CHECK: br_if 0, $pop{{.*}}{{$}}
909 ; CHECK: .LBB{{[0-9]+}}_2:
910 ; CHECK-NEXT: block {{$}}
911 ; CHECK-NEXT: block {{$}}
912 ; CHECK-NEXT: loop {{$}}
913 ; CHECK: br_if 1, $pop{{.*}}{{$}}
914 ; CHECK: br_if 0, ${{.*}}{{$}}
915 ; CHECK-NEXT: br 2{{$}}
916 ; CHECK-NEXT: .LBB{{[0-9]+}}_4:
917 ; CHECK-NEXT: end_loop{{$}}
918 ; CHECK: .LBB{{[0-9]+}}_5:
919 ; CHECK-NEXT: end_block{{$}}
920 ; CHECK: br_if 1, $pop{{.*}}{{$}}
922 ; CHECK: .LBB{{[0-9]+}}_7:
923 ; CHECK-NEXT: end_block{{$}}
924 ; CHECK: .LBB{{[0-9]+}}_8:
925 ; CHECK-NEXT: end_block{{$}}
926 ; CHECK-NEXT: return{{$}}
927 %0 = type { i8, i32 }
928 declare void @test15_callee0()
929 declare void @test15_callee1()
930 define void @test15() {
932 %tmp1 = icmp eq i8 1, 0
933 br i1 %tmp1, label %bb2, label %bb14
936 %tmp3 = phi %0** [ %tmp6, %bb5 ], [ null, %bb ]
937 %tmp4 = icmp eq i32 0, 11
938 br i1 %tmp4, label %bb5, label %bb8
941 %tmp = bitcast i8* null to %0**
942 %tmp6 = getelementptr %0*, %0** %tmp3, i32 1
943 %tmp7 = icmp eq %0** %tmp6, null
944 br i1 %tmp7, label %bb10, label %bb2
947 %tmp9 = icmp eq %0** null, undef
951 %tmp11 = phi %0** [ null, %bb8 ], [ %tmp, %bb5 ]
952 %tmp12 = icmp eq %0** null, %tmp11
953 br i1 %tmp12, label %bb15, label %bb13
956 call void @test15_callee0()
960 call void @test15_callee1()