llvm/llvm/test/CodeGen/AArch64/implicit-def-with-impdef-greedy-assert.mir

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 3
# RUN: llc -mtriple=arm64-apple-ios -run-pass=greedy -o - %s | FileCheck %s

---
name:            widget
tracksRegLiveness: true
frameInfo:
  adjustsStack:    true
jumpTable:
  kind:            label-difference32
  entries:
    - id:              0
      blocks:          [ '%bb.9', '%bb.5', '%bb.2', '%bb.2', '%bb.2' ]
body:             |
  ; CHECK-LABEL: name: widget
  ; CHECK: bb.0:
  ; CHECK-NEXT:   successors: %bb.1(0x80000000)
  ; CHECK-NEXT:   liveins: $w0, $w1, $x2, $x3, $x4, $w5, $w6
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   [[DEF:%[0-9]+]]:gpr64common = IMPLICIT_DEF
  ; CHECK-NEXT:   [[DEF1:%[0-9]+]]:gpr64 = IMPLICIT_DEF
  ; CHECK-NEXT:   [[DEF2:%[0-9]+]]:gpr32common = IMPLICIT_DEF
  ; CHECK-NEXT:   [[DEF3:%[0-9]+]]:gpr32 = IMPLICIT_DEF
  ; CHECK-NEXT:   [[DEF4:%[0-9]+]]:gpr32 = IMPLICIT_DEF
  ; CHECK-NEXT:   [[DEF5:%[0-9]+]]:gpr64common = IMPLICIT_DEF
  ; CHECK-NEXT:   [[DEF6:%[0-9]+]]:gpr32 = IMPLICIT_DEF
  ; CHECK-NEXT:   undef [[DEF7:%[0-9]+]].sub_32:gpr64 = IMPLICIT_DEF
  ; CHECK-NEXT:   [[DEF8:%[0-9]+]]:gpr64common = IMPLICIT_DEF
  ; CHECK-NEXT:   [[DEF9:%[0-9]+]]:gpr32 = IMPLICIT_DEF
  ; CHECK-NEXT:   dead [[DEF10:%[0-9]+]]:gpr64 = IMPLICIT_DEF
  ; CHECK-NEXT:   undef [[DEF11:%[0-9]+]].sub_32:gpr64 = IMPLICIT_DEF implicit-def dead %11
  ; CHECK-NEXT:   STRXui [[DEF11]], %stack.0, 0 :: (store (s64) into %stack.0)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.1:
  ; CHECK-NEXT:   successors: %bb.2(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.2:
  ; CHECK-NEXT:   successors: %bb.3(0x0fbefbf0), %bb.4(0x70410410)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   Bcc 8, %bb.3, implicit killed undef $nzcv
  ; CHECK-NEXT:   B %bb.4
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.3:
  ; CHECK-NEXT:   successors: %bb.11(0x00000000), %bb.2(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   dead $wzr = SUBSWri [[DEF2]], 64, 0, implicit-def $nzcv
  ; CHECK-NEXT:   Bcc 0, %bb.11, implicit killed undef $nzcv
  ; CHECK-NEXT:   B %bb.2
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.4:
  ; CHECK-NEXT:   successors: %bb.9(0x01288b01), %bb.5(0x01288b01), %bb.2(0x11f46a91), %bb.6(0x23e8d524), %bb.7(0x47d1aa49)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   dead early-clobber %12:gpr64, dead early-clobber %13:gpr64sp = JumpTableDest32 [[DEF8]], [[DEF7]], %jump-table.0
  ; CHECK-NEXT:   BR undef %18:gpr64
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.5:
  ; CHECK-NEXT:   successors: %bb.8(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   B %bb.8
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.6:
  ; CHECK-NEXT:   successors: %bb.2(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   STRWui [[DEF9]], [[DEF5]], 0 :: (store (s32))
  ; CHECK-NEXT:   B %bb.2
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.7:
  ; CHECK-NEXT:   successors: %bb.2(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   STRWui $wzr, [[DEF]], 0 :: (store (s32))
  ; CHECK-NEXT:   ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   $w0 = COPY [[DEF4]]
  ; CHECK-NEXT:   $x1 = COPY [[DEF1]]
  ; CHECK-NEXT:   BL 0, csr_darwin_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:   ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   $w0 = COPY [[DEF6]]
  ; CHECK-NEXT:   ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   B %bb.2
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.8:
  ; CHECK-NEXT:   successors: %bb.8(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   B %bb.8
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.9:
  ; CHECK-NEXT:   successors: %bb.10(0x40000000), %bb.1(0x40000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   undef [[DEF12:%[0-9]+]].sub_32:gpr64 = IMPLICIT_DEF
  ; CHECK-NEXT:   STRXui [[DEF12]], %stack.0, 0 :: (store (s64) into %stack.0)
  ; CHECK-NEXT:   TBZW [[DEF3]], 0, %bb.1
  ; CHECK-NEXT:   B %bb.10
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.10:
  ; CHECK-NEXT:   successors: %bb.1(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   ADJCALLSTACKDOWN 32, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   ADJCALLSTACKUP 32, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   B %bb.1
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.11:
  ; CHECK-NEXT:   [[LDRXui:%[0-9]+]]:gpr64 = LDRXui %stack.0, 0 :: (load (s64) from %stack.0)
  ; CHECK-NEXT:   dead undef [[COPY:%[0-9]+]].sub_32:gpr64 = COPY [[LDRXui]].sub_32
  ; CHECK-NEXT:   ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp
  ; CHECK-NEXT:   ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp
  bb.0:
    liveins: $w0, $w1, $x2, $x3, $x4, $w5, $w6

    %0:gpr64common = IMPLICIT_DEF
    %1:gpr64 = IMPLICIT_DEF
    %2:gpr32common = IMPLICIT_DEF
    %3:gpr32 = IMPLICIT_DEF
    %4:gpr32 = IMPLICIT_DEF
    %5:gpr64common = IMPLICIT_DEF
    %6:gpr32 = IMPLICIT_DEF
    undef %7.sub_32:gpr64 = IMPLICIT_DEF
    %8:gpr64common = IMPLICIT_DEF
    %9:gpr32 = IMPLICIT_DEF
    %10:gpr64 = IMPLICIT_DEF
    undef %10.sub_32:gpr64 = IMPLICIT_DEF implicit-def %11:gpr64

  bb.1:

  bb.2:
    successors: %bb.3(0x0fbefbf0), %bb.4(0x70410410)

    Bcc 8, %bb.3, implicit killed undef $nzcv
    B %bb.4

  bb.3:
    successors: %bb.11(0x00000000), %bb.2(0x80000000)

    dead $wzr = SUBSWri %2, 64, 0, implicit-def $nzcv
    Bcc 0, %bb.11, implicit killed undef $nzcv
    B %bb.2

  bb.4:
    successors: %bb.9(0x01288b01), %bb.5(0x01288b01), %bb.2(0x11f46a91), %bb.6(0x23e8d524), %bb.7(0x47d1aa49)

    early-clobber %12:gpr64, dead early-clobber %13:gpr64sp = JumpTableDest32 %8, %7, %jump-table.0
    BR undef %10

  bb.5:
    B %bb.8

  bb.6:
    STRWui %9, %5, 0 :: (store (s32))
    B %bb.2

  bb.7:
    STRWui $wzr, %0, 0 :: (store (s32))
    ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
    $w0 = COPY %4
    $x1 = COPY %1
    BL 0, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $w0
    ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
    ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
    $w0 = COPY %6
    ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
    B %bb.2

  bb.8:
    B %bb.8

  bb.9:
    successors: %bb.10, %bb.1

    undef %10.sub_32:gpr64 = IMPLICIT_DEF
    TBZW %3, 0, %bb.1
    B %bb.10

  bb.10:
    ADJCALLSTACKDOWN 32, 0, implicit-def dead $sp, implicit $sp
    ADJCALLSTACKUP 32, 0, implicit-def dead $sp, implicit $sp
    B %bb.1

  bb.11:
    undef %14.sub_32:gpr64 = COPY %10.sub_32
    ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp
    ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp

...