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 datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
9 target triple = "wasm32-unknown-unknown"
11 declare void @something()
13 ; Test that loops are made contiguous, even in the presence of split backedges.
21 ; CHECK-NEXT: .LBB{{[0-9]+}}_3:
22 ; CHECK-NEXT: end_block
23 ; CHECK-NEXT: i32.const
27 ; CHECK-NEXT: .LBB{{[0-9]+}}_4:
28 ; CHECK-NEXT: end_loop
29 define void @test0(i32 %n) {
34 %i = phi i32 [ 0, %entry ], [ %i.next, %back ]
35 %i.next = add i32 %i, 1
37 %c = icmp slt i32 %i.next, %n
38 br i1 %c, label %back, label %exit
44 call void @something()
48 ; Same as test0, but the branch condition is reversed.
56 ; CHECK-NEXT: .LBB{{[0-9]+}}_3:
57 ; CHECK-NEXT: end_block
58 ; CHECK-NEXT: i32.const
62 ; CHECK-NEXT: .LBB{{[0-9]+}}_4:
63 ; CHECK-NEXT: end_loop
64 define void @test1(i32 %n) {
69 %i = phi i32 [ 0, %entry ], [ %i.next, %back ]
70 %i.next = add i32 %i, 1
72 %c = icmp sge i32 %i.next, %n
73 br i1 %c, label %exit, label %back
79 call void @something()
83 ; Test that a simple loop is handled as expected.
88 ; CHECK: br_if 0, {{[^,]+}}{{$}}
89 ; CHECK: .LBB{{[0-9]+}}_{{[0-9]+}}:
91 ; CHECK: br_if 0, $pop{{[0-9]+}}{{$}}
92 ; CHECK: .LBB{{[0-9]+}}_{{[0-9]+}}:
96 define void @test2(double* nocapture %p, i32 %n) {
98 %cmp.4 = icmp sgt i32 %n, 0
99 br i1 %cmp.4, label %for.body.preheader, label %for.end
105 %i.05 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
106 %arrayidx = getelementptr inbounds double, double* %p, i32 %i.05
107 %0 = load double, double* %arrayidx, align 8
108 %mul = fmul double %0, 3.200000e+00
109 store double %mul, double* %arrayidx, align 8
110 %inc = add nuw nsw i32 %i.05, 1
111 %exitcond = icmp eq i32 %inc, %n
112 br i1 %exitcond, label %for.end.loopexit, label %for.body
121 ; CHECK-LABEL: doublediamond:
123 ; CHECK-NEXT: block {{$}}
124 ; CHECK: br_if 0, ${{[^,]+}}{{$}}
126 ; CHECK: .LBB{{[0-9]+}}_2:
127 ; CHECK-NEXT: end_block{{$}}
129 ; CHECK: br_if 0, ${{[^,]+}}{{$}}
131 ; CHECK: .LBB{{[0-9]+}}_4:
132 ; CHECK-NEXT: end_block{{$}}
133 ; CHECK: .LBB{{[0-9]+}}_5:
134 ; CHECK-NEXT: end_block{{$}}
135 ; CHECK: i32.const $push{{[0-9]+}}=, 0{{$}}
136 ; CHECK-NEXT: return $pop{{[0-9]+}}{{$}}
137 define i32 @doublediamond(i32 %a, i32 %b, i32* %p) {
139 %c = icmp eq i32 %a, 0
140 %d = icmp eq i32 %b, 0
141 store volatile i32 0, i32* %p
142 br i1 %c, label %true, label %false
144 store volatile i32 1, i32* %p
147 store volatile i32 2, i32* %p
148 br i1 %d, label %ft, label %ff
150 store volatile i32 3, i32* %p
153 store volatile i32 4, i32* %p
156 store volatile i32 5, i32* %p
160 ; CHECK-LABEL: triangle:
162 ; CHECK: br_if 0, $1{{$}}
163 ; CHECK: .LBB{{[0-9]+}}_2:
165 define i32 @triangle(i32* %p, i32 %a) {
167 %c = icmp eq i32 %a, 0
168 store volatile i32 0, i32* %p
169 br i1 %c, label %true, label %exit
171 store volatile i32 1, i32* %p
174 store volatile i32 2, i32* %p
178 ; CHECK-LABEL: diamond:
181 ; CHECK: br_if 0, $1{{$}}
183 ; CHECK: .LBB{{[0-9]+}}_2:
184 ; CHECK: .LBB{{[0-9]+}}_3:
185 ; CHECK: i32.const $push{{[0-9]+}}=, 0{{$}}
186 ; CHECK-NEXT: return $pop{{[0-9]+}}{{$}}
187 define i32 @diamond(i32* %p, i32 %a) {
189 %c = icmp eq i32 %a, 0
190 store volatile i32 0, i32* %p
191 br i1 %c, label %true, label %false
193 store volatile i32 1, i32* %p
196 store volatile i32 2, i32* %p
199 store volatile i32 3, i32* %p
203 ; CHECK-LABEL: single_block:
205 ; CHECK: return $pop{{[0-9]+}}{{$}}
206 define i32 @single_block(i32* %p) {
208 store volatile i32 0, i32* %p
212 ; CHECK-LABEL: minimal_loop:
214 ; CHECK: .LBB{{[0-9]+}}_1:
216 ; CHECK: i32.store 0($0), $pop{{[0-9]+}}{{$}}
218 ; CHECK: .LBB{{[0-9]+}}_2:
219 define i32 @minimal_loop(i32* %p) {
221 store volatile i32 0, i32* %p
224 store volatile i32 1, i32* %p
228 ; CHECK-LABEL: simple_loop:
230 ; CHECK: .LBB{{[0-9]+}}_1:
232 ; CHECK: br_if 0, $pop{{[0-9]+}}{{$}}
233 ; CHECK-NEXT: end_loop{{$}}
234 ; CHECK: i32.const $push{{[0-9]+}}=, 0{{$}}
235 ; CHECK-NEXT: return $pop{{[0-9]+}}{{$}}
236 define i32 @simple_loop(i32* %p, i32 %a) {
238 %c = icmp eq i32 %a, 0
239 store volatile i32 0, i32* %p
242 store volatile i32 1, i32* %p
243 br i1 %c, label %loop, label %exit
245 store volatile i32 2, i32* %p
249 ; CHECK-LABEL: doubletriangle:
251 ; CHECK: br_if 0, $0{{$}}
253 ; CHECK: br_if 0, $1{{$}}
254 ; CHECK: .LBB{{[0-9]+}}_3:
255 ; CHECK: .LBB{{[0-9]+}}_4:
257 define i32 @doubletriangle(i32 %a, i32 %b, i32* %p) {
259 %c = icmp eq i32 %a, 0
260 %d = icmp eq i32 %b, 0
261 store volatile i32 0, i32* %p
262 br i1 %c, label %true, label %exit
264 store volatile i32 2, i32* %p
265 br i1 %d, label %tt, label %tf
267 store volatile i32 3, i32* %p
270 store volatile i32 4, i32* %p
273 store volatile i32 5, i32* %p
277 ; CHECK-LABEL: ifelse_earlyexits:
280 ; CHECK: br_if 0, $0{{$}}
282 ; CHECK: .LBB{{[0-9]+}}_2:
283 ; CHECK: br_if 0, $1{{$}}
284 ; CHECK: .LBB{{[0-9]+}}_4:
285 ; CHECK: i32.const $push{{[0-9]+}}=, 0{{$}}
286 ; CHECK-NEXT: return $pop{{[0-9]+}}{{$}}
287 define i32 @ifelse_earlyexits(i32 %a, i32 %b, i32* %p) {
289 %c = icmp eq i32 %a, 0
290 %d = icmp eq i32 %b, 0
291 store volatile i32 0, i32* %p
292 br i1 %c, label %true, label %false
294 store volatile i32 1, i32* %p
297 store volatile i32 2, i32* %p
298 br i1 %d, label %ft, label %exit
300 store volatile i32 3, i32* %p
303 store volatile i32 4, i32* %p
307 ; CHECK-LABEL: doublediamond_in_a_loop:
308 ; CHECK: .LBB{{[0-9]+}}_1:
309 ; CHECK: loop i32{{$}}
311 ; CHECK: br_if 0, $0{{$}}
313 ; CHECK: .LBB{{[0-9]+}}_3:
314 ; CHECK: end_block{{$}}
316 ; CHECK: br_if 0, $1{{$}}
318 ; CHECK: .LBB{{[0-9]+}}_5:
320 ; CHECK: .LBB{{[0-9]+}}_6:
321 ; CHECK-NEXT: end_loop{{$}}
322 define i32 @doublediamond_in_a_loop(i32 %a, i32 %b, i32* %p) {
326 %c = icmp eq i32 %a, 0
327 %d = icmp eq i32 %b, 0
328 store volatile i32 0, i32* %p
329 br i1 %c, label %true, label %false
331 store volatile i32 1, i32* %p
334 store volatile i32 2, i32* %p
335 br i1 %d, label %ft, label %ff
337 store volatile i32 3, i32* %p
340 store volatile i32 4, i32* %p
343 store volatile i32 5, i32* %p
347 ; Test that nested loops are handled.
349 ; CHECK-LABEL: test3:
352 ; CHECK-NEXT: .LBB{{[0-9]+}}_{{[0-9]+}}:
355 define void @test3(i32 %w, i32 %x) {
357 br i1 undef, label %outer.ph, label %exit
363 %tobool = icmp eq i32 %x, 0
364 br i1 %tobool, label %inner, label %unreachable
370 %c = icmp eq i32 %x, %w
371 br i1 %c, label %if.end, label %inner
381 ; Test switch lowering and block placement.
383 ; CHECK-LABEL: test4:
384 ; CHECK-NEXT: .functype test4 (i32) -> (){{$}}
386 ; CHECK-NEXT: block {{$}}
387 ; CHECK: br_if 0, $pop{{[0-9]+}}{{$}}
389 ; CHECK-NEXT: .LBB{{[0-9]+}}_2:
390 ; CHECK-NEXT: end_block{{$}}
391 ; CHECK-NEXT: br_table $0, 0, 0, 0, 0, 0, 0{{$}}
392 ; CHECK-NEXT: .LBB{{[0-9]+}}_3:
393 ; CHECK-NEXT: end_block{{$}}
394 ; CHECK-NEXT: return{{$}}
395 define void @test4(i32 %t) {
397 switch i32 %t, label %default [
417 ; Test a case where the BLOCK needs to be placed before the LOOP in the
420 ; CHECK-LABEL: test5:
421 ; CHECK: .LBB{{[0-9]+}}_1:
422 ; CHECK-NEXT: block {{$}}
423 ; CHECK-NEXT: loop {{$}}
424 ; CHECK: br_if 1, {{[^,]+}}{{$}}
425 ; CHECK: br_if 0, {{[^,]+}}{{$}}
426 ; CHECK-NEXT: end_loop{{$}}
428 ; CHECK-NEXT: .LBB{{[0-9]+}}_4:
430 define void @test5(i1 %p, i1 %q) {
435 store volatile i32 0, i32* null
436 br i1 %p, label %more, label %alt
439 store volatile i32 1, i32* null
440 br i1 %q, label %header, label %return
443 store volatile i32 2, i32* null
447 store volatile i32 3, i32* null
451 ; Test an interesting case of a loop with multiple exits, which
452 ; aren't to layout successors of the loop, and one of which is to a successors
453 ; which has another predecessor.
455 ; CHECK-LABEL: test6:
456 ; CHECK: .LBB{{[0-9]+}}_1:
457 ; CHECK-NEXT: block {{$}}
458 ; CHECK-NEXT: block {{$}}
459 ; CHECK-NEXT: loop {{$}}
461 ; CHECK: br_if 2, {{[^,]+}}{{$}}
463 ; CHECK: br_if 1, {{[^,]+}}{{$}}
465 ; CHECK: br_if 0, {{[^,]+}}{{$}}
466 ; CHECK-NEXT: end_loop{{$}}
469 ; CHECK-NEXT: .LBB{{[0-9]+}}_5:
470 ; CHECK-NEXT: end_block{{$}}
472 ; CHECK: .LBB{{[0-9]+}}_6:
473 ; CHECK-NEXT: end_block{{$}}
476 define void @test6(i1 %p, i1 %q) {
481 store volatile i32 0, i32* null
482 br i1 %p, label %more, label %second
485 store volatile i32 1, i32* null
486 br i1 %q, label %evenmore, label %first
489 store volatile i32 1, i32* null
490 br i1 %q, label %header, label %return
493 store volatile i32 2, i32* null
497 store volatile i32 3, i32* null
501 store volatile i32 4, i32* null
505 ; Test a case where there are multiple backedges and multiple loop exits
506 ; that end in unreachable.
508 ; CHECK-LABEL: test7:
509 ; CHECK: .LBB{{[0-9]+}}_1:
510 ; CHECK-NEXT: loop {{$}}
513 ; CHECK: br_if 0, {{[^,]+}}{{$}}
515 ; CHECK: br_if 1, {{[^,]+}}{{$}}
518 ; CHECK-NEXT: .LBB{{[0-9]+}}_4:
519 ; CHECK-NEXT: end_block{{$}}
521 ; CHECK: br_if 0, {{[^,]+}}{{$}}
522 ; CHECK-NEXT: end_loop{{$}}
525 define void @test7(i1 %tobool2, i1 %tobool9) {
527 store volatile i32 0, i32* null
531 store volatile i32 1, i32* null
532 br i1 %tobool2, label %l1, label %l0
535 store volatile i32 2, i32* null
536 br i1 %tobool9, label %loop, label %u0
539 store volatile i32 3, i32* null
540 br i1 %tobool9, label %loop, label %u1
543 store volatile i32 4, i32* null
547 store volatile i32 5, i32* null
551 ; Test an interesting case using nested loops and switches.
553 ; CHECK-LABEL: test8:
554 ; CHECK: .LBB{{[0-9]+}}_1:
555 ; CHECK-NEXT: loop i32{{$}}
556 ; CHECK-NEXT: i32.const $push{{[^,]+}}, 0{{$}}
557 ; CHECK-NEXT: br_if 0, {{[^,]+}}{{$}}
558 ; CHECK-NEXT: br 0{{$}}
559 ; CHECK-NEXT: .LBB{{[0-9]+}}_2:
560 ; CHECK-NEXT: end_loop{{$}}
561 define i32 @test8() {
566 br i1 undef, label %bb2, label %bb3
569 switch i8 undef, label %bb1 [
574 switch i8 undef, label %bb1 [
579 ; Test an interesting case using nested loops that share a bottom block.
581 ; CHECK-LABEL: test9:
582 ; CHECK: .LBB{{[0-9]+}}_1:
583 ; CHECK-NEXT: block {{$}}
584 ; CHECK-NEXT: loop {{$}}
586 ; CHECK: br_if 1, {{[^,]+}}{{$}}
587 ; CHECK-NEXT: .LBB{{[0-9]+}}_2:
588 ; CHECK-NEXT: loop {{$}}
592 ; CHECK: br_if 0, {{[^,]+}}{{$}}
594 ; CHECK: br_if 2, {{[^,]+}}{{$}}
595 ; CHECK-NEXT: br 1{{$}}
596 ; CHECK-NEXT: .LBB{{[0-9]+}}_4:
597 ; CHECK-NEXT: end_block{{$}}
599 ; CHECK: br_if 1, {{[^,]+}}{{$}}
600 ; CHECK-NEXT: br 0{{$}}
601 ; CHECK-NEXT: .LBB{{[0-9]+}}_5:
607 define void @test9() {
609 store volatile i32 0, i32* null
613 store volatile i32 1, i32* null
614 %call4 = call i1 @a()
615 br i1 %call4, label %header2, label %end
618 store volatile i32 2, i32* null
620 br i1 %call, label %if.then, label %if.else
623 store volatile i32 3, i32* null
624 %call3 = call i1 @a()
625 br i1 %call3, label %header2, label %header
628 store volatile i32 4, i32* null
629 %call2 = call i1 @a()
630 br i1 %call2, label %header2, label %header
633 store volatile i32 5, i32* null
637 ; Test an interesting case involving nested loops sharing a loop bottom,
638 ; and loop exits to a block with unreachable.
640 ; CHECK-LABEL: test10:
641 ; CHECK: .LBB{{[0-9]+}}_1:
642 ; CHECK-NEXT: loop {{$}}
643 ; CHECK: br_if 0, {{[^,]+}}{{$}}
644 ; CHECK: .LBB{{[0-9]+}}_3:
645 ; CHECK-NEXT: block {{$}}
646 ; CHECK-NEXT: loop {{$}}
647 ; CHECK: .LBB{{[0-9]+}}_4:
648 ; CHECK-NEXT: loop {{$}}
649 ; CHECK: br_if 0, {{[^,]+}}{{$}}
650 ; CHECK-NEXT: end_loop{{$}}
651 ; CHECK-NEXT: block {{$}}
652 ; CHECK: br_if 0, {{[^,]+}}{{$}}
654 ; CHECK-NEXT: .LBB{{[0-9]+}}_7:
655 ; CHECK-NEXT: end_block{{$}}
657 ; CHECK-NEXT: br_table $0, 0, 3, 1, 2, 0
658 ; CHECK-NEXT: .LBB{{[0-9]+}}_8:
659 ; CHECK-NEXT: end_block{{$}}
660 ; CHECK-NEXT: end_loop{{$}}
661 ; CHECK-NEXT: return{{$}}
662 ; CHECK-NEXT: .LBB{{[0-9]+}}_9:
663 ; CHECK-NEXT: end_block{{$}}
665 ; CHECK-NEXT: .LBB{{[0-9]+}}_10:
666 ; CHECK-NEXT: end_loop{{$}}
667 define void @test10() {
672 %tmp = phi i32 [ 2, %bb0 ], [ 3, %bb3 ]
673 %tmp3 = phi i32 [ undef, %bb0 ], [ %tmp11, %bb3 ]
674 %tmp4 = icmp eq i32 %tmp3, 0
675 br i1 %tmp4, label %bb4, label %bb2
681 %tmp11 = phi i32 [ 1, %bb5 ], [ 0, %bb2 ]
685 %tmp6 = phi i32 [ %tmp9, %bb5 ], [ 4, %bb1 ]
686 %tmp7 = phi i32 [ %tmp6, %bb5 ], [ %tmp, %bb1 ]
690 %tmp9 = phi i32 [ %tmp6, %bb5 ], [ %tmp7, %bb4 ]
691 switch i32 %tmp9, label %bb2 [
702 ; Test a CFG DAG with interesting merging.
704 ; CHECK-LABEL: test11:
706 ; CHECK-NEXT: block {{$}}
707 ; CHECK-NEXT: block {{$}}
708 ; CHECK-NEXT: block {{$}}
709 ; CHECK: br_if 0, {{[^,]+}}{{$}}
712 ; CHECK-NEXT: i32.const
713 ; CHECK-NEXT: br_if 0, {{[^,]+}}{{$}}
715 ; CHECK: br_if 2, {{[^,]+}}{{$}}
716 ; CHECK-NEXT: .LBB{{[0-9]+}}_3:
717 ; CHECK-NEXT: end_block{{$}}
720 ; CHECK-NEXT: .LBB{{[0-9]+}}_4:
721 ; CHECK-NEXT: end_block{{$}}
723 ; CHECK: br_if 1, {{[^,]+}}{{$}}
725 ; CHECK: br_if 2, {{[^,]+}}{{$}}
726 ; CHECK-NEXT: .LBB{{[0-9]+}}_6:
727 ; CHECK-NEXT: end_block{{$}}
730 ; CHECK-NEXT: .LBB{{[0-9]+}}_7:
731 ; CHECK-NEXT: end_block{{$}}
734 ; CHECK-NEXT: .LBB{{[0-9]+}}_8:
735 ; CHECK-NEXT: end_block{{$}}
738 define void @test11() {
740 store volatile i32 0, i32* null
741 br i1 undef, label %bb1, label %bb4
743 store volatile i32 1, i32* null
744 br i1 undef, label %bb3, label %bb2
746 store volatile i32 2, i32* null
747 br i1 undef, label %bb3, label %bb7
749 store volatile i32 3, i32* null
752 store volatile i32 4, i32* null
753 br i1 undef, label %bb8, label %bb5
755 store volatile i32 5, i32* null
756 br i1 undef, label %bb6, label %bb7
758 store volatile i32 6, i32* null
761 store volatile i32 7, i32* null
764 store volatile i32 8, i32* null
768 ; CHECK-LABEL: test12:
769 ; CHECK: .LBB{{[0-9]+}}_1:
770 ; CHECK-NEXT: loop {{$}}
771 ; CHECK-NEXT: block {{$}}
772 ; CHECK-NEXT: block {{$}}
773 ; CHECK-NEXT: block {{$}}
774 ; CHECK: br_if 0, {{[^,]+}}{{$}}
775 ; CHECK: br_if 2, {{[^,]+}}{{$}}
776 ; CHECK: br_if 1, {{[^,]+}}{{$}}
777 ; CHECK-NEXT: br 2{{$}}
778 ; CHECK-NEXT: .LBB{{[0-9]+}}_4:
779 ; CHECK-NEXT: end_block{{$}}
780 ; CHECK-NEXT: br_table $2, 1, 0, 0, 0, 1, 1{{$}}
781 ; CHECK-NEXT: .LBB{{[0-9]+}}_5:
782 ; CHECK-NEXT: end_block{{$}}
783 ; CHECK-NEXT: return{{$}}
784 ; CHECK-NEXT: .LBB{{[0-9]+}}_6:
785 ; CHECK-NEXT: end_block{{$}}
787 ; CHECK-NEXT: .LBB{{[0-9]+}}_7:
788 ; CHECK-NEXT: end_loop{{$}}
789 define void @test12(i8* %arg) {
794 %tmp = phi i32 [ 0, %bb ], [ %tmp5, %bb4 ]
795 %tmp2 = getelementptr i8, i8* %arg, i32 %tmp
796 %tmp3 = load i8, i8* %tmp2
797 switch i8 %tmp3, label %bb7 [
805 %tmp5 = add i32 %tmp, 1
812 ; A block can be "branched to" from another even if it is also reachable via
813 ; fallthrough from the other. This would normally be optimized away, so use
814 ; optnone to disable optimizations to test this case.
816 ; CHECK-LABEL: test13:
818 ; CHECK-NEXT: block {{$}}
819 ; CHECK: br_if 0, $pop0{{$}}
821 ; CHECK: br_if 0, $pop3{{$}}
822 ; CHECK: .LBB{{[0-9]+}}_3:
823 ; CHECK-NEXT: end_block{{$}}
824 ; CHECK: br_if 1, $pop{{[0-9]+}}{{$}}
825 ; CHECK-NEXT: br 1{{$}}
826 ; CHECK-NEXT: .LBB{{[0-9]+}}_4:
827 ; CHECK-NEXT: end_block{{$}}
828 ; CHECK-NEXT: return{{$}}
829 ; CHECK-NEXT: .LBB{{[0-9]+}}_5:
830 ; CHECK-NEXT: end_block{{$}}
831 ; CHECK-NEXT: unreachable{{$}}
832 define void @test13() noinline optnone {
834 br i1 undef, label %bb5, label %bb2
838 br i1 undef, label %bb3, label %bb4
842 %tmp = phi i1 [ false, %bb2 ], [ false, %bb3 ]
843 br i1 %tmp, label %bb1, label %bb1
848 ; Test a case with a single-block loop that has another loop
849 ; as a successor. The end_loop for the first loop should go
850 ; before the loop for the second.
852 ; CHECK-LABEL: test14:
853 ; CHECK: .LBB{{[0-9]+}}_1:{{$}}
854 ; CHECK-NEXT: loop {{$}}
855 ; CHECK-NEXT: i32.const $push0=, 0{{$}}
856 ; CHECK-NEXT: br_if 0, $pop0{{$}}
857 ; CHECK-NEXT: end_loop{{$}}
858 ; CHECK-NEXT: .LBB{{[0-9]+}}_3:{{$}}
859 ; CHECK-NEXT: loop {{$}}
860 ; CHECK-NEXT: i32.const $push1=, 0{{$}}
861 ; CHECK-NEXT: br_if 0, $pop1{{$}}
862 ; CHECK-NEXT: end_loop{{$}}
863 ; CHECK-NEXT: return{{$}}
864 define void @test14() {
869 %tmp = bitcast i1 undef to i1
870 br i1 %tmp, label %bb3, label %bb1
876 br i1 undef, label %bb7, label %bb48
879 br i1 undef, label %bb12, label %bb12
882 br i1 undef, label %bb17, label %bb17
885 br i1 undef, label %bb22, label %bb22
888 br i1 undef, label %bb27, label %bb27
891 br i1 undef, label %bb30, label %bb30
894 br i1 undef, label %bb35, label %bb35
897 br i1 undef, label %bb38, label %bb38
900 br i1 undef, label %bb48, label %bb48
903 %tmp49 = bitcast i1 undef to i1
904 br i1 %tmp49, label %bb3, label %bb50
910 ; Test that a block boundary which ends one block, begins another block, and
911 ; also begins a loop, has the markers placed in the correct order.
913 ; CHECK-LABEL: test15:
916 ; CHECK: br_if 0, $pop{{.*}}{{$}}
917 ; CHECK: .LBB{{[0-9]+}}_2:
918 ; CHECK-NEXT: block {{$}}
919 ; CHECK-NEXT: block {{$}}
920 ; CHECK-NEXT: loop {{$}}
921 ; CHECK: br_if 1, $pop{{.*}}{{$}}
922 ; CHECK: br_if 0, ${{.*}}{{$}}
923 ; CHECK-NEXT: br 2{{$}}
924 ; CHECK-NEXT: .LBB{{[0-9]+}}_4:
925 ; CHECK-NEXT: end_loop{{$}}
926 ; CHECK: .LBB{{[0-9]+}}_5:
927 ; CHECK-NEXT: end_block{{$}}
928 ; CHECK: br_if 1, $pop{{.*}}{{$}}
930 ; CHECK: .LBB{{[0-9]+}}_7:
931 ; CHECK-NEXT: end_block{{$}}
932 ; CHECK: .LBB{{[0-9]+}}_8:
933 ; CHECK-NEXT: end_block{{$}}
934 ; CHECK-NEXT: return{{$}}
935 %0 = type { i8, i32 }
936 declare void @test15_callee0()
937 declare void @test15_callee1()
938 define void @test15() {
940 %tmp1 = icmp eq i8 1, 0
941 br i1 %tmp1, label %bb2, label %bb14
944 %tmp3 = phi %0** [ %tmp6, %bb5 ], [ null, %bb ]
945 %tmp4 = icmp eq i32 0, 11
946 br i1 %tmp4, label %bb5, label %bb8
949 %tmp = bitcast i8* null to %0**
950 %tmp6 = getelementptr %0*, %0** %tmp3, i32 1
951 %tmp7 = icmp eq %0** %tmp6, null
952 br i1 %tmp7, label %bb10, label %bb2
955 %tmp9 = icmp eq %0** null, undef
959 %tmp11 = phi %0** [ null, %bb8 ], [ %tmp, %bb5 ]
960 %tmp12 = icmp eq %0** null, %tmp11
961 br i1 %tmp12, label %bb15, label %bb13
964 call void @test15_callee0()
968 call void @test15_callee1()