107 lines · plain
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py2# RUN: llc -mtriple=amdgcn -start-before=greedy -stop-after=virtregrewriter -stress-regalloc=3 -verify-machineinstrs -o - %s | FileCheck -check-prefix=GCN %s3 4# Check that subreg use is live at the point of materialization, not just the main range.5# Do not rematerialize if used subreg is dead at a new index.6 7---8name: dead_subreg9tracksRegLiveness: true10body: |11 bb.0.entry:12 ; GCN-LABEL: name: dead_subreg13 ; GCN: $m0 = IMPLICIT_DEF14 ; GCN-NEXT: renamable $sgpr0_sgpr1 = S_MOV_B64 1, implicit $m015 ; GCN-NEXT: renamable $sgpr1 = S_MUL_I32 renamable $sgpr1, 316 ; GCN-NEXT: SI_SPILL_S32_SAVE killed renamable $sgpr1, %stack.0, implicit $exec, implicit $sp_reg :: (store (s32) into %stack.0, addrspace 5)17 ; GCN-NEXT: renamable $sgpr2 = S_MOV_B32 2, implicit $m018 ; GCN-NEXT: renamable $sgpr1 = S_MOV_B32 3, implicit $m019 ; GCN-NEXT: dead [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 $sgpr0, implicit $exec, implicit killed $sgpr2, implicit killed $sgpr120 ; GCN-NEXT: renamable $sgpr1 = SI_SPILL_S32_RESTORE %stack.0, implicit $exec, implicit $sp_reg :: (load (s32) from %stack.0, addrspace 5)21 ; GCN-NEXT: dead [[V_MOV_B32_e32_1:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 killed $sgpr1, implicit $exec22 ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr023 $m0 = IMPLICIT_DEF24 %0:sreg_64_xexec = S_MOV_B64 1, implicit $m025 %1:sreg_32 = S_MUL_I32 %0.sub1:sreg_64_xexec, 326 %2:sreg_32 = S_MOV_B32 2, implicit $m027 %3:sreg_32 = S_MOV_B32 3, implicit $m028 %4:vgpr_32 = V_MOV_B32_e32 %0.sub0:sreg_64_xexec, implicit $exec, implicit %2, implicit %329 %5:vgpr_32 = V_MOV_B32_e32 %1:sreg_32, implicit $exec30 S_NOP 0, implicit %0.sub031...32---33name: live_subreg34tracksRegLiveness: true35body: |36 bb.0.entry:37 ; GCN-LABEL: name: live_subreg38 ; GCN: $m0 = IMPLICIT_DEF39 ; GCN-NEXT: renamable $sgpr4_sgpr5 = S_MOV_B64 1, implicit $m040 ; GCN-NEXT: renamable $sgpr2 = S_MOV_B32 2, implicit $m041 ; GCN-NEXT: SI_SPILL_S32_SAVE killed renamable $sgpr2, %stack.0, implicit $exec, implicit $sp_reg :: (store (s32) into %stack.0, addrspace 5)42 ; GCN-NEXT: renamable $sgpr2 = S_MOV_B32 3, implicit $m043 ; GCN-NEXT: renamable $sgpr0 = SI_SPILL_S32_RESTORE %stack.0, implicit $exec, implicit $sp_reg :: (load (s32) from %stack.0, addrspace 5)44 ; GCN-NEXT: dead [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 $sgpr4, implicit $exec, implicit killed $sgpr0, implicit killed $sgpr245 ; GCN-NEXT: renamable $sgpr0 = S_MUL_I32 renamable $sgpr5, 346 ; GCN-NEXT: dead [[V_MOV_B32_e32_1:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 killed $sgpr0, implicit $exec47 ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr548 $m0 = IMPLICIT_DEF49 %0:sreg_64_xexec = S_MOV_B64 1, implicit $m050 %1:sreg_32 = S_MUL_I32 %0.sub1:sreg_64_xexec, 351 %2:sreg_32 = S_MOV_B32 2, implicit $m052 %3:sreg_32 = S_MOV_B32 3, implicit $m053 %4:vgpr_32 = V_MOV_B32_e32 %0.sub0:sreg_64_xexec, implicit $exec, implicit %2, implicit %354 %5:vgpr_32 = V_MOV_B32_e32 %1:sreg_32, implicit $exec55 S_NOP 0, implicit %0.sub156...57---58name: partially_live_wide_subreg59tracksRegLiveness: true60body: |61 bb.0.entry:62 ; GCN-LABEL: name: partially_live_wide_subreg63 ; GCN: renamable $sgpr0_sgpr1 = IMPLICIT_DEF64 ; GCN-NEXT: renamable $sgpr8_sgpr9_sgpr10_sgpr11 = S_LOAD_DWORDX4_IMM killed renamable $sgpr0_sgpr1, 1, 065 ; GCN-NEXT: renamable $sgpr4_sgpr5 = S_MOV_B64 renamable $sgpr10_sgpr1166 ; GCN-NEXT: SI_SPILL_S64_SAVE killed renamable $sgpr4_sgpr5, %stack.0, implicit $exec, implicit $sp_reg :: (store (s64) into %stack.0, align 4, addrspace 5)67 ; GCN-NEXT: renamable $sgpr4_sgpr5 = S_MOV_B64 3, implicit $m068 ; GCN-NEXT: renamable $sgpr0_sgpr1 = S_MOV_B64 2, implicit $m069 ; GCN-NEXT: dead [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 $sgpr8, implicit $exec, implicit killed $sgpr0_sgpr1, implicit killed $sgpr4_sgpr570 ; GCN-NEXT: renamable $sgpr4_sgpr5 = SI_SPILL_S64_RESTORE %stack.0, implicit $exec, implicit $sp_reg :: (load (s64) from %stack.0, align 4, addrspace 5)71 ; GCN-NEXT: dead [[V_MOV_B:%[0-9]+]]:vreg_64 = V_MOV_B64_PSEUDO killed $sgpr4_sgpr5, implicit $exec72 ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr8, implicit renamable $sgpr1173 %0:sreg_64 = IMPLICIT_DEF74 %1:sgpr_128 = S_LOAD_DWORDX4_IMM %0, 1, 075 %2:sreg_64 = S_MOV_B64 %1.sub2_sub376 %3:sreg_64 = S_MOV_B64 2, implicit $m077 %4:sreg_64 = S_MOV_B64 3, implicit $m078 %5:vgpr_32 = V_MOV_B32_e32 %1.sub0, implicit $exec, implicit %3, implicit %479 %6:vreg_64 = V_MOV_B64_PSEUDO %2, implicit $exec80 S_NOP 0, implicit %1.sub0, implicit %1.sub381...82---83name: dead_subreg_whole_reg84tracksRegLiveness: true85body: |86 bb.0.entry:87 ; GCN-LABEL: name: dead_subreg_whole_reg88 ; GCN: $m0 = IMPLICIT_DEF89 ; GCN-NEXT: renamable $sgpr0_sgpr1 = S_MOV_B64 1, implicit $m090 ; GCN-NEXT: renamable $sgpr2_sgpr3 = S_MOV_B64 renamable $sgpr0_sgpr191 ; GCN-NEXT: SI_SPILL_S64_SAVE killed renamable $sgpr2_sgpr3, %stack.0, implicit $exec, implicit $sp_reg :: (store (s64) into %stack.0, align 4, addrspace 5)92 ; GCN-NEXT: renamable $sgpr4_sgpr5 = S_MOV_B64 2, implicit $m093 ; GCN-NEXT: renamable $sgpr2_sgpr3 = S_MOV_B64 3, implicit $m094 ; GCN-NEXT: dead [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 $sgpr0, implicit $exec, implicit killed $sgpr4_sgpr5, implicit killed $sgpr2_sgpr395 ; GCN-NEXT: renamable $sgpr2_sgpr3 = SI_SPILL_S64_RESTORE %stack.0, implicit $exec, implicit $sp_reg :: (load (s64) from %stack.0, align 4, addrspace 5)96 ; GCN-NEXT: dead [[V_MOV_B:%[0-9]+]]:vreg_64 = V_MOV_B64_PSEUDO killed $sgpr2_sgpr3, implicit $exec97 ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr098 $m0 = IMPLICIT_DEF99 %0:sreg_64_xexec = S_MOV_B64 1, implicit $m0100 %1:sreg_64 = S_MOV_B64 %0:sreg_64_xexec101 %2:sreg_64 = S_MOV_B64 2, implicit $m0102 %3:sreg_64 = S_MOV_B64 3, implicit $m0103 %4:vgpr_32 = V_MOV_B32_e32 %0.sub0:sreg_64_xexec, implicit $exec, implicit %2, implicit %3104 %5:vreg_64 = V_MOV_B64_PSEUDO %1, implicit $exec105 S_NOP 0, implicit %0.sub0106...107