llvm/llvm/test/CodeGen/AArch64/shrinkwrap-split-restore-point.mir

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 2
# RUN: llc -mtriple=aarch64 -run-pass=shrink-wrap -o - %s | FileCheck %s

--- |
  define void @shrink_test1(i32 %a) {
  entry:
    %cmp5 = icmp sgt i32 %a, 0
    br i1 %cmp5, label %BB0, label %exit

  BB0:                                              ; preds = %entry
    %call = call i32 @fun()
    %c = icmp eq i32 %call, 0
    br i1 %c, label %BB1, label %exit

  BB1:                                              ; preds = %BB0
    %call2 = call i32 @fun()
    br label %exit

  exit:                                             ; preds = %BB1, %BB0, %entry
    ret void
  }

  define void @shrink_test2(i32 %a, ptr %P1, ptr %P2) {
  BB00:
    %cmp5 = icmp sgt i32 %a, 0
    br i1 %cmp5, label %BB01, label %exit

  BB01:                                             ; preds = %BB00
    store i32 %a, ptr %P1, align 4
    %c1 = icmp sgt i32 %a, 1
    br i1 %c1, label %BB02, label %BB03

  BB02:                                             ; preds = %BB01
    store i32 %a, ptr %P2, align 4
    br label %BB03

  BB03:                                             ; preds = %BB02, %BB01
    %call03 = call i32 @fun()
    %c03 = icmp eq i32 %call03, 0
    br i1 %c03, label %BB04, label %BB05

  BB04:                                             ; preds = %BB03
    %call04 = call i32 @fun()
    br label %BB05

  BB05:                                             ; preds = %BB04, %BB03
    %call05 = call i32 @fun()
    %c05 = icmp eq i32 %call05, 0
    br i1 %c05, label %BB06, label %BB07

  BB06:                                             ; preds = %BB05
    %call06 = call i32 @fun()
    br label %exit

  BB07:                                             ; preds = %BB05
    %call07 = call i32 @fun2()
    br label %exit

  exit:                                             ; preds = %BB07, %BB06, %BB00
    ret void
  }

  define void @noshrink_test1(i32 %a, i32 %v, i32 %v2) {
  entry:
    %cmp5 = icmp sgt i32 %a, 0
    br i1 %cmp5, label %BB0, label %exit

  BB0:                                              ; preds = %entry
    %c = icmp eq i32 %a, 10
    %c1 = icmp eq i32 %v, 10
    %or.cond = select i1 %c, i1 %c1, i1 false
    br i1 %or.cond, label %BB3, label %BB2

  BB2:                                              ; preds = %BB0
    %c2 = icmp eq i32 %v2, 10
    br i1 %c2, label %BB4, label %exit

  BB3:                                              ; preds = %BB0
    %call3 = call i32 @fun()
    br label %exit

  BB4:                                              ; preds = %BB2
    %call4 = call i32 @fun2()
    br label %exit

  exit:                                             ; preds = %BB4, %BB3, %BB2, %entry
    ret void
  }

  define void @noshrink_test2(i32 %a) {
  BB00:
    %cmp5 = icmp sgt i32 %a, 0
    br i1 %cmp5, label %BB01, label %InfLoop.preheader

  InfLoop.preheader:                                ; preds = %BB00
    br label %InfLoop

  BB01:                                             ; preds = %BB00
    %call = call i32 @fun()
    %c = icmp eq i32 %call, 0
    br i1 %c, label %BB02, label %exit

  BB02:                                             ; preds = %BB01
    %call2 = call i32 @fun()
    br label %exit

  InfLoop:                                          ; preds = %InfLoop.preheader, %InfLoop
    %call3 = call i32 @fun()
    br label %InfLoop

  exit:                                             ; preds = %BB02, %BB01
    ret void
  }

  define void @noshrink_test3(i32 %a) {
  BB00:
    %cmp5 = icmp sgt i32 %a, 0
    %call02 = call i32 @fun()
    br i1 %cmp5, label %BB02, label %BB01

  BB01:                                             ; preds = %BB00
    %0 = icmp eq i32 %call02, 0
    br i1 %0, label %BB01.1, label %exit

  BB01.1:                                           ; preds = %BB01
    call void @abort() #0
    unreachable

  BB02:                                             ; preds = %BB00
    %1 = icmp eq i32 %call02, 0
    br i1 %1, label %BB03, label %BB04

  BB03:                                             ; preds = %BB02
    %call03 = call i32 @fun()
    %c03 = icmp eq i32 %call03, 0
    br i1 %c03, label %BB04, label %exit

  BB04:                                             ; preds = %BB03, %BB02
    %call04 = call i32 @fun()
    br label %exit

  exit:                                             ; preds = %BB04, %BB03, %BB01
    ret void
  }

  define void @noshrink_bb_as_inlineasmbr_target(i1 %cond) {
  entry:
    br i1 %cond, label %0, label %exit

  0:                                                ; preds = %entry
    callbr void asm sideeffect "", "!i,~{flags}"()
      to label %1 [label %exit]

  1:                                                ; preds = %0
    call void @dosomething()
    br label %exit

  exit:                                             ; preds = %1, %0, %entry
    ret void
  }

  declare i32 @fun()
  declare i32 @fun2()
  declare void @abort()
  declare void @dosomething()
...
---
name:            shrink_test1
alignment:       4
tracksRegLiveness: true
tracksDebugUserValues: true
liveins:
  - { reg: '$w0' }
frameInfo:
  maxAlignment:    1
  adjustsStack:    true
  hasCalls:        true
  maxCallFrameSize: 0
machineFunctionInfo: {}
body:             |
  ; CHECK-LABEL: name: shrink_test1
  ; CHECK: bb.0.entry:
  ; CHECK-NEXT:   successors: %bb.1(0x50000000), %bb.3(0x30000000)
  ; CHECK-NEXT:   liveins: $w0
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   dead $wzr = SUBSWri killed renamable $w0, 1, 0, implicit-def $nzcv
  ; CHECK-NEXT:   Bcc 11, %bb.3, implicit killed $nzcv
  ; CHECK-NEXT:   B %bb.1
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.1.BB0:
  ; CHECK-NEXT:   successors: %bb.2(0x30000000), %bb.4(0x50000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $w0
  ; CHECK-NEXT:   ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   CBNZW killed renamable $w0, %bb.4
  ; CHECK-NEXT:   B %bb.2
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.2.BB1:
  ; CHECK-NEXT:   successors: %bb.4(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $w0
  ; CHECK-NEXT:   ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   B %bb.4
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.3.exit:
  ; CHECK-NEXT:   RET_ReallyLR
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.4:
  ; CHECK-NEXT:   successors: %bb.3(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   B %bb.3
  bb.0.entry:
    successors: %bb.1(0x50000000), %bb.3(0x30000000)
    liveins: $w0

    dead $wzr = SUBSWri killed renamable $w0, 1, 0, implicit-def $nzcv
    Bcc 11, %bb.3, implicit killed $nzcv
    B %bb.1

  bb.1.BB0:
    successors: %bb.2(0x30000000), %bb.3(0x50000000)

    ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
    BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $w0
    ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
    CBNZW killed renamable $w0, %bb.3
    B %bb.2

  bb.2.BB1:
    ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
    BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $w0
    ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp

  bb.3.exit:
    RET_ReallyLR

...
---
name:            shrink_test2
alignment:       4
tracksRegLiveness: true
tracksDebugUserValues: true
liveins:
  - { reg: '$w0' }
  - { reg: '$x1' }
  - { reg: '$x2' }
frameInfo:
  maxAlignment:    1
  adjustsStack:    true
  hasCalls:        true
  maxCallFrameSize: 0
machineFunctionInfo: {}
body:             |
  ; CHECK-LABEL: name: shrink_test2
  ; CHECK: bb.0.BB00:
  ; CHECK-NEXT:   successors: %bb.1(0x50000000), %bb.8(0x30000000)
  ; CHECK-NEXT:   liveins: $w0, $x1, $x2
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   dead $wzr = SUBSWri renamable $w0, 1, 0, implicit-def $nzcv
  ; CHECK-NEXT:   Bcc 11, %bb.8, implicit killed $nzcv
  ; CHECK-NEXT:   B %bb.1
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.1.BB01:
  ; CHECK-NEXT:   successors: %bb.2(0x40000000), %bb.3(0x40000000)
  ; CHECK-NEXT:   liveins: $w0, $x1, $x2
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   dead $wzr = SUBSWri renamable $w0, 2, 0, implicit-def $nzcv
  ; CHECK-NEXT:   STRWui renamable $w0, killed renamable $x1, 0 :: (store (s32) into %ir.P1)
  ; CHECK-NEXT:   Bcc 11, %bb.3, implicit killed $nzcv
  ; CHECK-NEXT:   B %bb.2
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.2.BB02:
  ; CHECK-NEXT:   successors: %bb.3(0x80000000)
  ; CHECK-NEXT:   liveins: $w0, $x2
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   STRWui killed renamable $w0, killed renamable $x2, 0 :: (store (s32) into %ir.P2)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.3.BB03:
  ; CHECK-NEXT:   successors: %bb.4(0x30000000), %bb.5(0x50000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $w0
  ; CHECK-NEXT:   ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   CBNZW killed renamable $w0, %bb.5
  ; CHECK-NEXT:   B %bb.4
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.4.BB04:
  ; CHECK-NEXT:   successors: %bb.5(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $w0
  ; CHECK-NEXT:   ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.5.BB05:
  ; CHECK-NEXT:   successors: %bb.6(0x30000000), %bb.7(0x50000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $w0
  ; CHECK-NEXT:   ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   CBNZW killed renamable $w0, %bb.7
  ; CHECK-NEXT:   B %bb.6
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.6.BB06:
  ; CHECK-NEXT:   successors: %bb.9(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $w0
  ; CHECK-NEXT:   ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   B %bb.9
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.7.BB07:
  ; CHECK-NEXT:   successors: %bb.9(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   BL @fun2, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $w0
  ; CHECK-NEXT:   ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   B %bb.9
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.8.exit:
  ; CHECK-NEXT:   RET_ReallyLR
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.9:
  ; CHECK-NEXT:   successors: %bb.8(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   B %bb.8
  bb.0.BB00:
    successors: %bb.1(0x50000000), %bb.8(0x30000000)
    liveins: $w0, $x1, $x2

    dead $wzr = SUBSWri renamable $w0, 1, 0, implicit-def $nzcv
    Bcc 11, %bb.8, implicit killed $nzcv
    B %bb.1

  bb.1.BB01:
    successors: %bb.2, %bb.3
    liveins: $w0, $x1, $x2

    dead $wzr = SUBSWri renamable $w0, 2, 0, implicit-def $nzcv
    STRWui renamable $w0, killed renamable $x1, 0 :: (store (s32) into %ir.P1)
    Bcc 11, %bb.3, implicit killed $nzcv
    B %bb.2

  bb.2.BB02:
    liveins: $w0, $x2

    STRWui killed renamable $w0, killed renamable $x2, 0 :: (store (s32) into %ir.P2)

  bb.3.BB03:
    successors: %bb.4(0x30000000), %bb.5(0x50000000)

    ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
    BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $w0
    ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
    CBNZW killed renamable $w0, %bb.5
    B %bb.4

  bb.4.BB04:
    ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
    BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $w0
    ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp

  bb.5.BB05:
    successors: %bb.6(0x30000000), %bb.7(0x50000000)

    ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
    BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $w0
    ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
    CBNZW killed renamable $w0, %bb.7
    B %bb.6

  bb.6.BB06:
    ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
    BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $w0
    ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
    B %bb.8

  bb.7.BB07:
    ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
    BL @fun2, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $w0
    ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp

  bb.8.exit:
    RET_ReallyLR

...
---
name:            noshrink_test1
alignment:       4
tracksRegLiveness: true
tracksDebugUserValues: true
liveins:
  - { reg: '$w0' }
  - { reg: '$w1' }
  - { reg: '$w2' }
frameInfo:
  maxAlignment:    1
  adjustsStack:    true
  hasCalls:        true
  maxCallFrameSize: 0
machineFunctionInfo: {}
body:             |
  ; CHECK-LABEL: name: noshrink_test1
  ; CHECK: bb.0.entry:
  ; CHECK-NEXT:   successors: %bb.1(0x50000000), %bb.6(0x30000000)
  ; CHECK-NEXT:   liveins: $w0, $w1, $w2
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   dead $wzr = SUBSWri renamable $w0, 1, 0, implicit-def $nzcv
  ; CHECK-NEXT:   Bcc 11, %bb.6, implicit killed $nzcv
  ; CHECK-NEXT:   B %bb.1
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.1.BB0:
  ; CHECK-NEXT:   successors: %bb.2(0x60000000), %bb.3(0x20000000)
  ; CHECK-NEXT:   liveins: $w0, $w1, $w2
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   dead $wzr = SUBSWri killed renamable $w0, 10, 0, implicit-def $nzcv
  ; CHECK-NEXT:   Bcc 1, %bb.3, implicit killed $nzcv
  ; CHECK-NEXT:   B %bb.2
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.2.BB0:
  ; CHECK-NEXT:   successors: %bb.4(0x55555555), %bb.3(0x2aaaaaab)
  ; CHECK-NEXT:   liveins: $w1, $w2
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   dead $wzr = SUBSWri killed renamable $w1, 10, 0, implicit-def $nzcv
  ; CHECK-NEXT:   Bcc 0, %bb.4, implicit killed $nzcv
  ; CHECK-NEXT:   B %bb.3
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.3.BB2:
  ; CHECK-NEXT:   successors: %bb.5(0x40000000), %bb.6(0x40000000)
  ; CHECK-NEXT:   liveins: $w2
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   dead $wzr = SUBSWri killed renamable $w2, 10, 0, implicit-def $nzcv
  ; CHECK-NEXT:   Bcc 0, %bb.5, implicit killed $nzcv
  ; CHECK-NEXT:   B %bb.6
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.4.BB3:
  ; CHECK-NEXT:   successors: %bb.6(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $w0
  ; CHECK-NEXT:   ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   B %bb.6
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.5.BB4:
  ; CHECK-NEXT:   successors: %bb.6(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   BL @fun2, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $w0
  ; CHECK-NEXT:   ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.6.exit:
  ; CHECK-NEXT:   RET_ReallyLR
  bb.0.entry:
    successors: %bb.1(0x50000000), %bb.6(0x30000000)
    liveins: $w0, $w1, $w2

    dead $wzr = SUBSWri renamable $w0, 1, 0, implicit-def $nzcv
    Bcc 11, %bb.6, implicit killed $nzcv
    B %bb.1

  bb.1.BB0:
    successors: %bb.2(0x60000000), %bb.3(0x20000000)
    liveins: $w0, $w1, $w2

    dead $wzr = SUBSWri killed renamable $w0, 10, 0, implicit-def $nzcv
    Bcc 1, %bb.3, implicit killed $nzcv
    B %bb.2

  bb.2.BB0:
    successors: %bb.4(0x55555555), %bb.3(0x2aaaaaab)
    liveins: $w1, $w2

    dead $wzr = SUBSWri killed renamable $w1, 10, 0, implicit-def $nzcv
    Bcc 0, %bb.4, implicit killed $nzcv
    B %bb.3

  bb.3.BB2:
    liveins: $w2

    dead $wzr = SUBSWri killed renamable $w2, 10, 0, implicit-def $nzcv
    Bcc 0, %bb.5, implicit killed $nzcv
    B %bb.6

  bb.4.BB3:
    ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
    BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $w0
    ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
    B %bb.6

  bb.5.BB4:
    ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
    BL @fun2, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $w0
    ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp

  bb.6.exit:
    RET_ReallyLR

...
---
name:            noshrink_test2
alignment:       4
tracksRegLiveness: true
tracksDebugUserValues: true
liveins:
  - { reg: '$w0' }
frameInfo:
  maxAlignment:    1
  adjustsStack:    true
  hasCalls:        true
  maxCallFrameSize: 0
machineFunctionInfo: {}
body:             |
  ; CHECK-LABEL: name: noshrink_test2
  ; CHECK: bb.0.BB00:
  ; CHECK-NEXT:   successors: %bb.2(0x50000000), %bb.1(0x30000000)
  ; CHECK-NEXT:   liveins: $w0
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   dead $wzr = SUBSWri killed renamable $w0, 0, 0, implicit-def $nzcv
  ; CHECK-NEXT:   Bcc 12, %bb.2, implicit killed $nzcv
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.1:
  ; CHECK-NEXT:   successors: %bb.4(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   B %bb.4
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.2.BB01:
  ; CHECK-NEXT:   successors: %bb.3(0x30000000), %bb.5(0x50000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $w0
  ; CHECK-NEXT:   ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   CBNZW killed renamable $w0, %bb.5
  ; CHECK-NEXT:   B %bb.3
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.3.BB02:
  ; CHECK-NEXT:   successors: %bb.5(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $w0
  ; CHECK-NEXT:   ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   B %bb.5
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.4.InfLoop:
  ; CHECK-NEXT:   successors: %bb.4(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $w0
  ; CHECK-NEXT:   ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   B %bb.4
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.5.exit:
  ; CHECK-NEXT:   RET_ReallyLR
  bb.0.BB00:
    successors: %bb.2(0x50000000), %bb.1(0x30000000)
    liveins: $w0

    dead $wzr = SUBSWri killed renamable $w0, 0, 0, implicit-def $nzcv
    Bcc 12, %bb.2, implicit killed $nzcv

  bb.1:
    B %bb.4

  bb.2.BB01:
    successors: %bb.3(0x30000000), %bb.5(0x50000000)

    ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
    BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $w0
    ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
    CBNZW killed renamable $w0, %bb.5
    B %bb.3

  bb.3.BB02:
    ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
    BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $w0
    ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
    B %bb.5

  bb.4.InfLoop:
    ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
    BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $w0
    ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
    B %bb.4

  bb.5.exit:
    RET_ReallyLR

...
---
name:            noshrink_test3
alignment:       4
tracksRegLiveness: true
tracksDebugUserValues: true
liveins:
  - { reg: '$w0' }
frameInfo:
  maxAlignment:    1
  adjustsStack:    true
  hasCalls:        true
  maxCallFrameSize: 0
machineFunctionInfo: {}
body:             |
  ; CHECK-LABEL: name: noshrink_test3
  ; CHECK: bb.0.BB00:
  ; CHECK-NEXT:   successors: %bb.3(0x50000000), %bb.1(0x30000000)
  ; CHECK-NEXT:   liveins: $w0
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   renamable $w19 = COPY $w0
  ; CHECK-NEXT:   ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $w0
  ; CHECK-NEXT:   ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   dead $wzr = SUBSWri killed renamable $w19, 0, 0, implicit-def $nzcv
  ; CHECK-NEXT:   Bcc 12, %bb.3, implicit killed $nzcv
  ; CHECK-NEXT:   B %bb.1
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.1.BB01:
  ; CHECK-NEXT:   successors: %bb.2(0x00000800), %bb.6(0x7ffff800)
  ; CHECK-NEXT:   liveins: $w0
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   CBNZW killed renamable $w0, %bb.6
  ; CHECK-NEXT:   B %bb.2
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.2.BB01.1:
  ; CHECK-NEXT:   successors: %bb.3(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   BL @abort, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp
  ; CHECK-NEXT:   ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.3.BB02:
  ; CHECK-NEXT:   successors: %bb.4(0x30000000), %bb.5(0x50000000)
  ; CHECK-NEXT:   liveins: $w0
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   CBNZW killed renamable $w0, %bb.5
  ; CHECK-NEXT:   B %bb.4
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.4.BB03:
  ; CHECK-NEXT:   successors: %bb.5(0x30000000), %bb.6(0x50000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $w0
  ; CHECK-NEXT:   ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   CBNZW killed renamable $w0, %bb.6
  ; CHECK-NEXT:   B %bb.5
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.5.BB04:
  ; CHECK-NEXT:   successors: %bb.6(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $w0
  ; CHECK-NEXT:   ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.6.exit:
  ; CHECK-NEXT:   RET_ReallyLR
  bb.0.BB00:
    successors: %bb.3(0x50000000), %bb.1(0x30000000)
    liveins: $w0

    renamable $w19 = COPY $w0
    ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
    BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $w0
    ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
    dead $wzr = SUBSWri killed renamable $w19, 0, 0, implicit-def $nzcv
    Bcc 12, %bb.3, implicit killed $nzcv
    B %bb.1

  bb.1.BB01:
    successors: %bb.2(0x00000800), %bb.6(0x7ffff800)
    liveins: $w0

    CBNZW killed renamable $w0, %bb.6
    B %bb.2

  bb.2.BB01.1:

    ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
    BL @abort, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp
    ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp

  bb.3.BB02:
    successors: %bb.4(0x30000000), %bb.5(0x50000000)
    liveins: $w0

    CBNZW killed renamable $w0, %bb.5
    B %bb.4

  bb.4.BB03:
    successors: %bb.5(0x30000000), %bb.6(0x50000000)

    ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
    BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $w0
    ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
    CBNZW killed renamable $w0, %bb.6
    B %bb.5

  bb.5.BB04:
    ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
    BL @fun, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $w0
    ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp

  bb.6.exit:
    RET_ReallyLR

...
---
name:            noshrink_bb_as_inlineasmbr_target
registers:       []
liveins:
  - { reg: '$w0', virtual-reg: '' }
frameInfo:
  savePoint:       ''
  restorePoint:    ''
body:             |
  ; CHECK-LABEL: name: noshrink_bb_as_inlineasmbr_target
  ; CHECK: bb.0.entry:
  ; CHECK-NEXT:   successors: %bb.1(0x40000000), %bb.3(0x40000000)
  ; CHECK-NEXT:   liveins: $w0
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   TBZW killed renamable $w0, 0, %bb.3
  ; CHECK-NEXT:   B %bb.1
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.1 (%ir-block.0):
  ; CHECK-NEXT:   successors: %bb.2(0x80000000), %bb.3(0x00000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   INLINEASM_BR &"", 1 /* sideeffect attdialect */, 13 /* imm */, %bb.3
  ; CHECK-NEXT:   B %bb.2
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.2 (%ir-block.1):
  ; CHECK-NEXT:   successors: %bb.3(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   BL @dosomething, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp
  ; CHECK-NEXT:   ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.3.exit (machine-block-address-taken, inlineasm-br-indirect-target):
  ; CHECK-NEXT:   RET_ReallyLR
  bb.0.entry:
    successors: %bb.1(0x40000000), %bb.3(0x40000000)
    liveins: $w0

    TBZW killed renamable $w0, 0, %bb.3
    B %bb.1

  bb.1 (%ir-block.0):
    successors: %bb.2(0x80000000), %bb.3(0x00000000)

    INLINEASM_BR &"", 1 /* sideeffect attdialect */, 13 /* imm */, %bb.3
    B %bb.2

  bb.2 (%ir-block.1):
    successors: %bb.3(0x80000000)

    ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
    BL @dosomething, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp
    ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp

  bb.3.exit (machine-block-address-taken, inlineasm-br-indirect-target):
    RET_ReallyLR

...