[PATCH] D131884: Fix subrange liveness checking at rematerialization
Stanislav Mekhanoshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 16 10:50:20 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGccfabfbb1f91: Fix subrange liveness checking at rematerialization (authored by npmiller, committed by rampitec).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131884/new/
https://reviews.llvm.org/D131884
Files:
llvm/lib/CodeGen/LiveRangeEdit.cpp
llvm/test/CodeGen/AMDGPU/remat-dead-subreg.mir
Index: llvm/test/CodeGen/AMDGPU/remat-dead-subreg.mir
===================================================================
--- llvm/test/CodeGen/AMDGPU/remat-dead-subreg.mir
+++ llvm/test/CodeGen/AMDGPU/remat-dead-subreg.mir
@@ -79,3 +79,28 @@
%6:vreg_64 = V_MOV_B64_PSEUDO %2, implicit $exec
S_NOP 0, implicit %1.sub0, implicit %1.sub3
...
+---
+name: dead_subreg_whole_reg
+tracksRegLiveness: true
+body: |
+ bb.0.entry:
+ ; GCN-LABEL: name: dead_subreg_whole_reg
+ ; GCN: $m0 = IMPLICIT_DEF
+ ; GCN-NEXT: renamable $sgpr0_sgpr1 = S_MOV_B64 1, implicit $m0
+ ; GCN-NEXT: renamable $sgpr2_sgpr3 = S_MOV_B64 renamable $sgpr0_sgpr1
+ ; 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)
+ ; GCN-NEXT: renamable $sgpr4_sgpr5 = S_MOV_B64 2, implicit $m0
+ ; GCN-NEXT: renamable $sgpr2_sgpr3 = S_MOV_B64 3, implicit $m0
+ ; GCN-NEXT: dead %4:vgpr_32 = V_MOV_B32_e32 $sgpr0, implicit $exec, implicit killed $sgpr4_sgpr5, implicit killed $sgpr2_sgpr3
+ ; 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)
+ ; GCN-NEXT: dead %5:vreg_64 = V_MOV_B64_PSEUDO killed $sgpr2_sgpr3, implicit $exec
+ ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
+ $m0 = IMPLICIT_DEF
+ %0:sreg_64_xexec = S_MOV_B64 1, implicit $m0
+ %1:sreg_64 = S_MOV_B64 %0:sreg_64_xexec
+ %2:sreg_64 = S_MOV_B64 2, implicit $m0
+ %3:sreg_64 = S_MOV_B64 3, implicit $m0
+ %4:vgpr_32 = V_MOV_B32_e32 %0.sub0:sreg_64_xexec, implicit $exec, implicit %2, implicit %3
+ %5:vreg_64 = V_MOV_B64_PSEUDO %1, implicit $exec
+ S_NOP 0, implicit %0.sub0
+...
Index: llvm/lib/CodeGen/LiveRangeEdit.cpp
===================================================================
--- llvm/lib/CodeGen/LiveRangeEdit.cpp
+++ llvm/lib/CodeGen/LiveRangeEdit.cpp
@@ -134,9 +134,11 @@
return false;
// Check that subrange is live at UseIdx.
- if (MO.getSubReg()) {
+ if (li.hasSubRanges()) {
const TargetRegisterInfo *TRI = MRI.getTargetRegisterInfo();
- LaneBitmask LM = TRI->getSubRegIndexLaneMask(MO.getSubReg());
+ unsigned SubReg = MO.getSubReg();
+ LaneBitmask LM = SubReg ? TRI->getSubRegIndexLaneMask(SubReg)
+ : MRI.getMaxLaneMaskForVReg(MO.getReg());
for (LiveInterval::SubRange &SR : li.subranges()) {
if ((SR.LaneMask & LM).none())
continue;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131884.453068.patch
Type: text/x-patch
Size: 2581 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220816/1de23ce0/attachment-0001.bin>
More information about the llvm-commits
mailing list