llvm/llvm/test/CodeGen/AArch64/clear-dead-implicit-def-impdef.mir

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4
# RUN: llc -mtriple=arm64-apple-macosx -mcpu=apple-m1 -verify-regalloc -run-pass=greedy -o - %s | FileCheck %s
---
name:            func
tracksRegLiveness: true
frameInfo:
  adjustsStack:    true
body:             |
  bb.0:
    liveins: $x0, $x1, $x2, $x3, $x4, $x5, $x6

    ; CHECK-LABEL: name: func
    ; CHECK: liveins: $x0, $x1, $x2, $x3, $x4, $x5, $x6
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[DEF:%[0-9]+]]:gpr64sp = IMPLICIT_DEF
    ; CHECK-NEXT: dead [[DEF1:%[0-9]+]]:gpr32 = IMPLICIT_DEF
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64common = COPY $x0
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY $x1
    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr64 = COPY $x2
    ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gpr64 = COPY $x3
    ; CHECK-NEXT: [[COPY4:%[0-9]+]]:gpr64 = COPY $x4
    ; CHECK-NEXT: [[COPY5:%[0-9]+]]:gpr64 = COPY $x5
    ; CHECK-NEXT: [[COPY6:%[0-9]+]]:gpr64 = COPY $x6
    ; CHECK-NEXT: undef [[MOVi32imm:%[0-9]+]].sub_32:gpr64 = MOVi32imm 4, implicit-def [[MOVi32imm]]
    ; CHECK-NEXT: ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: BL 0, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp
    ; CHECK-NEXT: ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: ADJCALLSTACKDOWN 24, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: ADJCALLSTACKUP 24, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: ADJCALLSTACKUP 16, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: [[DEF2:%[0-9]+]]:gpr64 = IMPLICIT_DEF
    ; CHECK-NEXT: ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: undef [[DEF3:%[0-9]+]].sub_32:gpr64 = IMPLICIT_DEF implicit-def [[DEF3]]
    ; CHECK-NEXT: STRXui [[DEF3]], [[DEF]], 1 :: (store (s64) into stack + 8)
    ; CHECK-NEXT: BL 0, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp
    ; CHECK-NEXT: ADJCALLSTACKUP 16, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: STRXui [[MOVi32imm]], [[DEF]], 0 :: (store (s64) into stack)
    ; CHECK-NEXT: ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: STRWui undef [[MOVi32imm]].sub_32, [[COPY]], 0 :: (store (s32))
    ; CHECK-NEXT: ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: STRXui [[DEF2]], undef [[DEF]], 0 :: (store (s64) into stack)
    ; CHECK-NEXT: $x0 = COPY [[COPY6]]
    ; CHECK-NEXT: ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: $x0 = COPY [[COPY5]]
    ; CHECK-NEXT: ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: $x0 = COPY [[COPY4]]
    ; CHECK-NEXT: ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: $x0 = COPY [[COPY3]]
    ; CHECK-NEXT: ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: $x0 = COPY [[COPY2]]
    ; CHECK-NEXT: ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: $x0 = COPY [[COPY1]]
    ; CHECK-NEXT: ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: ADJCALLSTACKDOWN 24, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: undef [[DEF4:%[0-9]+]].sub_32:gpr64 = IMPLICIT_DEF implicit-def [[DEF4]]
    ; CHECK-NEXT: STRXui [[DEF4]], undef [[DEF]], 1 :: (store (s64) into stack + 8)
    ; CHECK-NEXT: ADJCALLSTACKUP 24, 0, implicit-def dead $sp, implicit $sp
    ; CHECK-NEXT: RET_ReallyLR
    %0:gpr64sp = IMPLICIT_DEF
    undef %13.sub_32:gpr64 = IMPLICIT_DEF implicit-def %13
    dead %2:gpr32 = IMPLICIT_DEF
    %3:gpr64common = COPY $x0
    %4:gpr64 = COPY $x1
    %5:gpr64 = COPY $x2
    %6:gpr64 = COPY $x3
    %7:gpr64 = COPY $x4
    %8:gpr64 = COPY $x5
    %9:gpr64 = COPY $x6
    undef %11.sub_32:gpr64 = MOVi32imm 4, implicit-def %11
    ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp
    BL 0, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp
    ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp
    ADJCALLSTACKDOWN 24, 0, implicit-def dead $sp, implicit $sp
    ADJCALLSTACKUP 24, 0, implicit-def dead $sp, implicit $sp
    ADJCALLSTACKDOWN 16, 0, implicit-def dead $sp, implicit $sp
    ADJCALLSTACKUP 16, 0, implicit-def dead $sp, implicit $sp
    ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp
    %12:gpr64 = IMPLICIT_DEF
    ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp
    ADJCALLSTACKDOWN 16, 0, implicit-def dead $sp, implicit $sp
    STRXui %13, %0, 1 :: (store (s64) into stack + 8)
    BL 0, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp
    ADJCALLSTACKUP 16, 0, implicit-def dead $sp, implicit $sp
    ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp
    STRXui %11, %0, 0 :: (store (s64) into stack)
    ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp
    STRWui undef %11.sub_32, %3, 0 :: (store (s32))
    ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp
    STRXui %12, undef %0, 0 :: (store (s64) into stack)
    $x0 = COPY %9
    ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp
    ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp
    $x0 = COPY %8
    ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp
    ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp
    $x0 = COPY %7
    ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp
    ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp
    $x0 = COPY %6
    ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp
    ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp
    $x0 = COPY %5
    ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp
    ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp
    $x0 = COPY %4
    ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp
    ADJCALLSTACKDOWN 24, 0, implicit-def dead $sp, implicit $sp
    STRXui %13, undef %0, 1 :: (store (s64) into stack + 8)
    ADJCALLSTACKUP 24, 0, implicit-def dead $sp, implicit $sp
    RET_ReallyLR

...