# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py # RUN: llc -mtriple=thumbv8.1m.main-none-eabi -mattr=+mve -run-pass=arm-block-placement %s -o - | FileCheck %s --- | define void @backwards_branch(i32 %N, i32* nocapture %a, i32* nocapture readonly %b) local_unnamed_addr #0 { entry: unreachable } define void @backwards_branch_entry_block(i32 %N, i32* nocapture %a, i32* nocapture readonly %b) local_unnamed_addr #0 { entry: unreachable } define void @backwards_branch_target_already_backwards(i32 %N, i32* nocapture %a, i32* nocapture readonly %b) local_unnamed_addr #0 { entry: unreachable } define void @backwards_branch_sibling(i32 %N, i32 %M, i32* nocapture %a, i32* nocapture %b, i32* nocapture %c) local_unnamed_addr #0 { entry: unreachable } define void @backwards_branch_forwards_le(i32 %N, i32 %M, i32* nocapture %a, i32* nocapture %b, i32* nocapture %c) local_unnamed_addr #0 { entry: unreachable } define void @no_preheader(i32 %N, i32 %M, i32* nocapture %a, i32* nocapture %b, i32* nocapture %c) local_unnamed_addr #0 { entry: unreachable } declare dso_local i32 @g(...) local_unnamed_addr #1 declare dso_local i32 @h(...) local_unnamed_addr #1 ... --- name: backwards_branch body: | ; CHECK-LABEL: name: backwards_branch ; CHECK: bb.0: ; CHECK: successors: %bb.2(0x80000000) ; CHECK: tCMPi8 renamable $r0, 1, 14 /* CC::al */, $noreg, implicit-def $cpsr ; CHECK: t2IT 11, 8, implicit-def $itstate ; CHECK: frame-destroy tPOP_RET 11 /* CC::lt */, killed $cpsr, def $r7, def $pc, implicit killed $itstate ; CHECK: bb.2: ; CHECK: successors: %bb.3(0x80000000) ; CHECK: t2WhileLoopStart killed renamable $r0, %bb.1, implicit-def dead $cpsr ; CHECK: tB %bb.3, 14 /* CC::al */, $noreg ; CHECK: bb.1: ; CHECK: frame-destroy tPOP_RET 14 /* CC::al */, $noreg, def $r7, def $pc ; CHECK: bb.3: ; CHECK: successors: %bb.3(0x7c000000), %bb.1(0x04000000) ; CHECK: renamable $r0 = tLDRi renamable $r2, 0, 14 /* CC::al */, $noreg ; CHECK: tSTRi killed renamable $r0, renamable $r1, 0, 14 /* CC::al */, $noreg ; CHECK: renamable $lr = t2LoopEndDec killed renamable $lr, %bb.3, implicit-def dead $cpsr ; CHECK: t2B %bb.1, 14 /* CC::al */, $noreg bb.0: successors: %bb.2(0x80000000) liveins: $r0, $r1, $r2, $lr tCMPi8 renamable $r0, 1, 14 /* CC::al */, $noreg, implicit-def $cpsr t2IT 11, 8, implicit-def $itstate frame-destroy tPOP_RET 11 /* CC::lt */, killed $cpsr, def $r7, def $pc, implicit killed $itstate bb.1: frame-destroy tPOP_RET 14 /* CC::al */, $noreg, def $r7, def $pc bb.2: successors: %bb.3(0x80000000) liveins: $r0, $r1, $r2 t2WhileLoopStart killed renamable $r0, %bb.1, implicit-def dead $cpsr bb.3: successors: %bb.3(0x7c000000), %bb.1(0x04000000) liveins: $lr, $r1, $r2 renamable $r0 = tLDRi renamable $r2, 0, 14 /* CC::al */, $noreg tSTRi killed renamable $r0, renamable $r1, 0, 14 /* CC::al */, $noreg renamable $lr = t2LoopEndDec killed renamable $lr, %bb.3, implicit-def dead $cpsr t2B %bb.1, 14 /* CC::al */, $noreg ... --- name: backwards_branch_entry_block body: | ; CHECK-LABEL: name: backwards_branch_entry_block ; CHECK: bb.0: ; CHECK: successors: %bb.2(0x80000000) ; CHECK: tCMPi8 renamable $r0, 1, 14 /* CC::al */, $noreg, implicit-def $cpsr ; CHECK: t2IT 11, 8, implicit-def $itstate ; CHECK: frame-destroy tPOP_RET 11 /* CC::lt */, killed $cpsr, def $r7, def $pc, implicit killed $itstate ; CHECK: bb.1: ; CHECK: frame-destroy tPOP_RET 14 /* CC::al */, $noreg, def $r7, def $pc ; CHECK: bb.2: ; CHECK: successors: %bb.3(0x80000000) ; CHECK: t2WhileLoopStart killed renamable $r0, %bb.0, implicit-def dead $cpsr ; CHECK: bb.3: ; CHECK: successors: %bb.3(0x7c000000), %bb.1(0x04000000) ; CHECK: renamable $r0 = tLDRi renamable $r2, 0, 14 /* CC::al */, $noreg ; CHECK: tSTRi killed renamable $r0, renamable $r1, 0, 14 /* CC::al */, $noreg ; CHECK: renamable $lr = t2LoopEndDec killed renamable $lr, %bb.3, implicit-def dead $cpsr ; CHECK: t2B %bb.1, 14 /* CC::al */, $noreg bb.0: successors: %bb.2(0x80000000) liveins: $r0, $r1, $r2, $lr tCMPi8 renamable $r0, 1, 14 /* CC::al */, $noreg, implicit-def $cpsr t2IT 11, 8, implicit-def $itstate frame-destroy tPOP_RET 11 /* CC::lt */, killed $cpsr, def $r7, def $pc, implicit killed $itstate bb.1: frame-destroy tPOP_RET 14 /* CC::al */, $noreg, def $r7, def $pc bb.2: successors: %bb.3(0x80000000) liveins: $r0, $r1, $r2 t2WhileLoopStart killed renamable $r0, %bb.0, implicit-def dead $cpsr bb.3: successors: %bb.3(0x7c000000), %bb.1(0x04000000) liveins: $lr, $r1, $r2 renamable $r0 = tLDRi renamable $r2, 0, 14 /* CC::al */, $noreg tSTRi killed renamable $r0, renamable $r1, 0, 14 /* CC::al */, $noreg renamable $lr = t2LoopEndDec killed renamable $lr, %bb.3, implicit-def dead $cpsr t2B %bb.1, 14 /* CC::al */, $noreg ... --- name: backwards_branch_target_already_backwards body: | ; CHECK-LABEL: name: backwards_branch_target_already_backwards ; CHECK: bb.0: ; CHECK: successors: %bb.2(0x50000000), %bb.1(0x30000000) ; CHECK: tCMPi8 $r0, 1, 14 /* CC::al */, $noreg, implicit-def $cpsr ; CHECK: t2Bcc %bb.1, 11 /* CC::lt */, killed $cpsr ; CHECK: t2B %bb.2, 14 /* CC::al */, $noreg ; CHECK: bb.2: ; CHECK: successors: %bb.3(0x80000000) ; CHECK: $lr = tMOVr $r0, 14 /* CC::al */, $noreg ; CHECK: renamable $r0 = t2ADDrs killed renamable $r2, killed $r0, 18, 14 /* CC::al */, $noreg, $noreg ; CHECK: t2WhileLoopStart killed renamable $lr, %bb.1, implicit-def dead $cpsr ; CHECK: tB %bb.3, 14 /* CC::al */, $noreg ; CHECK: bb.1: ; CHECK: successors: %bb.4(0x80000000) ; CHECK: tCMPi8 renamable $r1, 1, 14 /* CC::al */, $noreg, implicit-def $cpsr ; CHECK: t2IT 11, 8, implicit-def $itstate ; CHECK: frame-destroy tPOP_RET 11 /* CC::lt */, killed $cpsr, def $r7, def $pc, implicit killed $itstate ; CHECK: t2WhileLoopStart killed renamable $r1, %bb.0, implicit-def dead $cpsr ; CHECK: t2B %bb.4, 14 /* CC::al */, $noreg ; CHECK: bb.3: ; CHECK: successors: %bb.3(0x7c000000), %bb.1(0x04000000) ; CHECK: renamable $lr = t2LoopEndDec killed renamable $lr, %bb.3, implicit-def dead $cpsr ; CHECK: t2B %bb.1, 14 /* CC::al */, $noreg ; CHECK: bb.4: ; CHECK: successors: %bb.5(0x80000000) ; CHECK: renamable $r0 = t2ADDrs killed renamable $r3, renamable $r1, 18, 14 /* CC::al */, $noreg, $noreg ; CHECK: t2WhileLoopStart killed renamable $r1, %bb.6, implicit-def dead $cpsr ; CHECK: bb.5: ; CHECK: successors: %bb.5(0x7c000000), %bb.6(0x04000000) ; CHECK: renamable $lr = t2LoopEndDec killed renamable $lr, %bb.5, implicit-def dead $cpsr ; CHECK: t2B %bb.6, 14 /* CC::al */, $noreg ; CHECK: bb.6: ; CHECK: frame-destroy tPOP_RET 14 /* CC::al */, $noreg, def $r7, def $pc bb.0: successors: %bb.1(0x50000000), %bb.3(0x30000000) liveins: $r0, $r1, $r2, $r3, $lr tCMPi8 $r0, 1, 14 /* CC::al */, $noreg, implicit-def $cpsr t2Bcc %bb.3, 11 /* CC::lt */, killed $cpsr t2B %bb.1, 14 /* CC::al */, $noreg bb.3: successors: %bb.4(0x80000000) liveins: $r1, $r3 tCMPi8 renamable $r1, 1, 14 /* CC::al */, $noreg, implicit-def $cpsr t2IT 11, 8, implicit-def $itstate frame-destroy tPOP_RET 11 /* CC::lt */, killed $cpsr, def $r7, def $pc, implicit killed $itstate t2WhileLoopStart killed renamable $r1, %bb.0, implicit-def dead $cpsr t2B %bb.4, 14 /* CC::al */, $noreg bb.1: successors: %bb.2(0x80000000) liveins: $r0, $r1, $r2, $r3 $lr = tMOVr $r0, 14 /* CC::al */, $noreg renamable $r0 = t2ADDrs killed renamable $r2, killed $r0, 18, 14 /* CC::al */, $noreg, $noreg t2WhileLoopStart killed renamable $lr, %bb.3, implicit-def dead $cpsr bb.2: successors: %bb.2(0x7c000000), %bb.3(0x04000000) liveins: $lr, $r0, $r1, $r3 renamable $lr = t2LoopEndDec killed renamable $lr, %bb.2, implicit-def dead $cpsr t2B %bb.3, 14 /* CC::al */, $noreg bb.4: successors: %bb.5(0x80000000) liveins: $r1, $r3 renamable $r0 = t2ADDrs killed renamable $r3, renamable $r1, 18, 14 /* CC::al */, $noreg, $noreg t2WhileLoopStart killed renamable $r1, %bb.6, implicit-def dead $cpsr bb.5: successors: %bb.5(0x7c000000), %bb.6(0x04000000) liveins: $lr, $r0 renamable $lr = t2LoopEndDec killed renamable $lr, %bb.5, implicit-def dead $cpsr t2B %bb.6, 14 /* CC::al */, $noreg bb.6: frame-destroy tPOP_RET 14 /* CC::al */, $noreg, def $r7, def $pc ... --- name: backwards_branch_sibling body: | ; CHECK-LABEL: name: backwards_branch_sibling ; CHECK: bb.0: ; CHECK: successors: %bb.2(0x50000000), %bb.1(0x30000000) ; CHECK: tCMPi8 $r0, 1, 14 /* CC::al */, $noreg, implicit-def $cpsr ; CHECK: t2Bcc %bb.1, 11 /* CC::lt */, killed $cpsr ; CHECK: t2B %bb.2, 14 /* CC::al */, $noreg ; CHECK: bb.1: ; CHECK: successors: %bb.4(0x80000000) ; CHECK: tCMPi8 renamable $r1, 1, 14 /* CC::al */, $noreg, implicit-def $cpsr ; CHECK: t2IT 11, 8, implicit-def $itstate ; CHECK: frame-destroy tPOP_RET 11 /* CC::lt */, killed $cpsr, def $r7, def $pc, implicit killed $itstate ; CHECK: t2WhileLoopStart killed renamable $r1, %bb.2, implicit-def dead $cpsr ; CHECK: t2B %bb.4, 14 /* CC::al */, $noreg ; CHECK: bb.2: ; CHECK: successors: %bb.3(0x80000000) ; CHECK: $lr = tMOVr $r0, 14 /* CC::al */, $noreg ; CHECK: renamable $r0 = t2ADDrs killed renamable $r2, killed $r0, 18, 14 /* CC::al */, $noreg, $noreg ; CHECK: t2WhileLoopStart killed renamable $lr, %bb.1, implicit-def dead $cpsr ; CHECK: bb.3: ; CHECK: successors: %bb.3(0x7c000000), %bb.1(0x04000000) ; CHECK: renamable $lr = t2LoopEndDec killed renamable $lr, %bb.3, implicit-def dead $cpsr ; CHECK: t2B %bb.1, 14 /* CC::al */, $noreg ; CHECK: bb.4: ; CHECK: successors: %bb.5(0x80000000) ; CHECK: renamable $r0 = t2ADDrs killed renamable $r3, renamable $r1, 18, 14 /* CC::al */, $noreg, $noreg ; CHECK: t2WhileLoopStart killed renamable $r1, %bb.6, implicit-def dead $cpsr ; CHECK: bb.5: ; CHECK: successors: %bb.5(0x7c000000), %bb.6(0x04000000) ; CHECK: renamable $lr = t2LoopEndDec killed renamable $lr, %bb.5, implicit-def dead $cpsr ; CHECK: t2B %bb.6, 14 /* CC::al */, $noreg ; CHECK: bb.6: ; CHECK: frame-destroy tPOP_RET 14 /* CC::al */, $noreg, def $r7, def $pc bb.0: successors: %bb.1(0x50000000), %bb.3(0x30000000) liveins: $r0, $r1, $r2, $r3, $lr tCMPi8 $r0, 1, 14 /* CC::al */, $noreg, implicit-def $cpsr t2Bcc %bb.3, 11 /* CC::lt */, killed $cpsr t2B %bb.1, 14 /* CC::al */, $noreg bb.3: successors: %bb.4(0x80000000) liveins: $r1, $r3 tCMPi8 renamable $r1, 1, 14 /* CC::al */, $noreg, implicit-def $cpsr t2IT 11, 8, implicit-def $itstate frame-destroy tPOP_RET 11 /* CC::lt */, killed $cpsr, def $r7, def $pc, implicit killed $itstate t2WhileLoopStart killed renamable $r1, %bb.1, implicit-def dead $cpsr t2B %bb.4, 14 /* CC::al */, $noreg bb.1: successors: %bb.2(0x80000000) liveins: $r0, $r1, $r2, $r3 $lr = tMOVr $r0, 14 /* CC::al */, $noreg renamable $r0 = t2ADDrs killed renamable $r2, killed $r0, 18, 14 /* CC::al */, $noreg, $noreg t2WhileLoopStart killed renamable $lr, %bb.3, implicit-def dead $cpsr bb.2: successors: %bb.2(0x7c000000), %bb.3(0x04000000) liveins: $lr, $r0, $r1, $r3 renamable $lr = t2LoopEndDec killed renamable $lr, %bb.2, implicit-def dead $cpsr t2B %bb.3, 14 /* CC::al */, $noreg bb.4: successors: %bb.5(0x80000000) liveins: $r1, $r3 renamable $r0 = t2ADDrs killed renamable $r3, renamable $r1, 18, 14 /* CC::al */, $noreg, $noreg t2WhileLoopStart killed renamable $r1, %bb.6, implicit-def dead $cpsr bb.5: successors: %bb.5(0x7c000000), %bb.6(0x04000000) liveins: $lr, $r0 renamable $lr = t2LoopEndDec killed renamable $lr, %bb.5, implicit-def dead $cpsr t2B %bb.6, 14 /* CC::al */, $noreg bb.6: frame-destroy tPOP_RET 14 /* CC::al */, $noreg, def $r7, def $pc ... --- name: backwards_branch_forwards_le body: | ; CHECK-LABEL: name: backwards_branch_forwards_le ; CHECK: bb.0: ; CHECK: successors: %bb.2(0x80000000) ; CHECK: tCMPi8 renamable $r0, 1, 14 /* CC::al */, $noreg, implicit-def $cpsr ; CHECK: t2IT 11, 8, implicit-def $itstate ; CHECK: frame-destroy tPOP_RET 11 /* CC::lt */, killed $cpsr, def $r7, def $pc, implicit killed $itstate ; CHECK: bb.1: ; CHECK: successors: %bb.1(0x80000000) ; CHECK: renamable $lr = t2LoopEndDec killed renamable $lr, %bb.1, implicit-def dead $cpsr ; CHECK: frame-destroy tPOP_RET 14 /* CC::al */, $noreg, def $r7, def $pc ; CHECK: bb.2: ; CHECK: successors: %bb.3(0x80000000) ; CHECK: t2WhileLoopStart killed renamable $r0, %bb.1, implicit-def dead $cpsr ; CHECK: bb.3: ; CHECK: successors: %bb.3(0x7c000000), %bb.1(0x04000000) ; CHECK: renamable $r0 = tLDRi renamable $r2, 0, 14 /* CC::al */, $noreg ; CHECK: tSTRi killed renamable $r0, renamable $r1, 0, 14 /* CC::al */, $noreg ; CHECK: renamable $lr = t2LoopEndDec killed renamable $lr, %bb.3, implicit-def dead $cpsr ; CHECK: t2B %bb.1, 14 /* CC::al */, $noreg bb.0: successors: %bb.2(0x80000000) liveins: $r0, $r1, $r2, $lr tCMPi8 renamable $r0, 1, 14 /* CC::al */, $noreg, implicit-def $cpsr t2IT 11, 8, implicit-def $itstate frame-destroy tPOP_RET 11 /* CC::lt */, killed $cpsr, def $r7, def $pc, implicit killed $itstate bb.1: renamable $lr = t2LoopEndDec killed renamable $lr, %bb.1, implicit-def dead $cpsr frame-destroy tPOP_RET 14 /* CC::al */, $noreg, def $r7, def $pc bb.2: successors: %bb.3(0x80000000) liveins: $r0, $r1, $r2 t2WhileLoopStart killed renamable $r0, %bb.1, implicit-def dead $cpsr bb.3: successors: %bb.3(0x7c000000), %bb.1(0x04000000) liveins: $lr, $r1, $r2 renamable $r0 = tLDRi renamable $r2, 0, 14 /* CC::al */, $noreg tSTRi killed renamable $r0, renamable $r1, 0, 14 /* CC::al */, $noreg renamable $lr = t2LoopEndDec killed renamable $lr, %bb.3, implicit-def dead $cpsr t2B %bb.1, 14 /* CC::al */, $noreg ... --- name: no_preheader body: | ; CHECK-LABEL: name: no_preheader ; CHECK: bb.0: ; CHECK: successors: %bb.2(0x30000000), %bb.1(0x50000000) ; CHECK: frame-setup tPUSH 14 /* CC::al */, $noreg, killed $r4, killed $r5, $r7, killed $lr, implicit-def $sp, implicit $sp ; CHECK: frame-setup CFI_INSTRUCTION def_cfa_offset 16 ; CHECK: frame-setup CFI_INSTRUCTION offset $lr, -4 ; CHECK: frame-setup CFI_INSTRUCTION offset $r7, -8 ; CHECK: frame-setup CFI_INSTRUCTION offset $r5, -12 ; CHECK: frame-setup CFI_INSTRUCTION offset $r4, -16 ; CHECK: $r7 = frame-setup tADDrSPi $sp, 2, 14 /* CC::al */, $noreg ; CHECK: frame-setup CFI_INSTRUCTION def_cfa $r7, 8 ; CHECK: $r4 = tMOVr killed $r0, 14 /* CC::al */, $noreg ; CHECK: tBL 14 /* CC::al */, $noreg, @g, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $r0 ; CHECK: tCMPi8 killed renamable $r0, 0, 14 /* CC::al */, $noreg, implicit-def $cpsr ; CHECK: t2Bcc %bb.2, 0 /* CC::eq */, killed $cpsr ; CHECK: bb.1: ; CHECK: successors: %bb.4(0x80000000) ; CHECK: renamable $r0, dead $cpsr = tMOVi8 4, 14 /* CC::al */, $noreg ; CHECK: renamable $r5 = t2LDRSHi12 killed renamable $r0, 0, 14 /* CC::al */, $noreg ; CHECK: t2B %bb.4, 14 /* CC::al */, $noreg ; CHECK: bb.2: ; CHECK: successors: %bb.4(0x80000000) ; CHECK: renamable $r5, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg ; CHECK: t2B %bb.4, 14 /* CC::al */, $noreg ; CHECK: bb.3: ; CHECK: successors: %bb.4(0x80000000) ; CHECK: $r0 = tMOVr $r5, 14 /* CC::al */, $noreg ; CHECK: tBL 14 /* CC::al */, $noreg, @h, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $r0, implicit-def $sp, implicit-def dead $r0 ; CHECK: bb.4: ; CHECK: successors: %bb.5(0x04000000), %bb.3(0x7c000000) ; CHECK: renamable $r0 = tLDRi renamable $r4, 0, 14 /* CC::al */, $noreg ; CHECK: tCMPi8 killed renamable $r0, 0, 14 /* CC::al */, $noreg, implicit-def $cpsr ; CHECK: t2Bcc %bb.3, 1 /* CC::ne */, killed $cpsr ; CHECK: bb.5: ; CHECK: frame-destroy tPOP_RET 14 /* CC::al */, $noreg, def $r4, def $r5, def $r7, def $pc bb.0: successors: %bb.1(0x30000000), %bb.2(0x50000000) liveins: $r0, $r4, $r5, $lr frame-setup tPUSH 14 /* CC::al */, $noreg, killed $r4, killed $r5, $r7, killed $lr, implicit-def $sp, implicit $sp frame-setup CFI_INSTRUCTION def_cfa_offset 16 frame-setup CFI_INSTRUCTION offset $lr, -4 frame-setup CFI_INSTRUCTION offset $r7, -8 frame-setup CFI_INSTRUCTION offset $r5, -12 frame-setup CFI_INSTRUCTION offset $r4, -16 $r7 = frame-setup tADDrSPi $sp, 2, 14 /* CC::al */, $noreg frame-setup CFI_INSTRUCTION def_cfa $r7, 8 $r4 = tMOVr killed $r0, 14 /* CC::al */, $noreg tBL 14 /* CC::al */, $noreg, @g, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $r0 tCMPi8 killed renamable $r0, 0, 14 /* CC::al */, $noreg, implicit-def $cpsr t2Bcc %bb.1, 0 /* CC::eq */, killed $cpsr bb.2: successors: %bb.3(0x80000000) liveins: $r4 renamable $r0, dead $cpsr = tMOVi8 4, 14 /* CC::al */, $noreg renamable $r5 = t2LDRSHi12 killed renamable $r0, 0, 14 /* CC::al */, $noreg t2B %bb.3, 14 /* CC::al */, $noreg bb.1: successors: %bb.3(0x80000000) liveins: $r4 renamable $r5, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg t2B %bb.3, 14 /* CC::al */, $noreg bb.4: successors: %bb.3(0x80000000) liveins: $r4, $r5 $r0 = tMOVr $r5, 14 /* CC::al */, $noreg tBL 14 /* CC::al */, $noreg, @h, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $r0, implicit-def $sp, implicit-def dead $r0 bb.3: successors: %bb.5(0x04000000), %bb.4(0x7c000000) liveins: $r4, $r5 renamable $r0 = tLDRi renamable $r4, 0, 14 /* CC::al */, $noreg tCMPi8 killed renamable $r0, 0, 14 /* CC::al */, $noreg, implicit-def $cpsr t2Bcc %bb.4, 1 /* CC::ne */, killed $cpsr bb.5: frame-destroy tPOP_RET 14 /* CC::al */, $noreg, def $r4, def $r5, def $r7, def $pc ...