[llvm] [AMDGPU] Remove implicit definition of register group when restoring the last sub-register after a spill (PR #133986)
Ryan Buchner via llvm-commits
llvm-commits at lists.llvm.org
Mon May 5 09:32:00 PDT 2025
================
@@ -1928,7 +1928,9 @@ void SIRegisterInfo::buildSpillLoadStore(
MIB->setAsmPrinterFlag(MachineInstr::ReloadReuse);
}
- if (NeedSuperRegImpOperand && (IsFirstSubReg || IsLastSubReg))
+ bool IsSrcDstDef = SrcDstRegState & RegState::Define;
+ if (NeedSuperRegImpOperand &&
+ (IsFirstSubReg || (IsLastSubReg && !IsSrcDstDef)))
----------------
bababuck wrote:
I believe the IsLastSubReg is needed for other flags, namely `RegState::Kill`. Removing it, the following change is seen in the test I wrote:
```
- ; GFX942-NEXT: SCRATCH_STORE_DWORDX2_SADDR killed $vgpr12_vgpr13, $sgpr32, 48, 0, implicit $exec, implicit $flat_scr, implicit killed $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9_vgpr10_vgpr11_vgpr12_vgpr13_vgpr14_vgpr15 :: (store (s64) into %stack.0 + 48, align 4, addrspace 5)
+ ; GFX942-NEXT: SCRATCH_STORE_DWORDX2_SADDR killed $vgpr12_vgpr13, $sgpr32, 48, 0, implicit $exec, implicit $flat_scr :: (store (s64) into %stack.0 + 48, align 4, addrspace 5)
```
This seems to be the analog of `implicit def` on the first sub-register.
https://github.com/llvm/llvm-project/pull/133986
More information about the llvm-commits
mailing list