[llvm] [AMDGPU][True16][CodeGen] update wwm reg sorting check condition (PR #135053)
Christudasan Devadasan via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 15 03:44:11 PDT 2025
================
@@ -1650,7 +1650,7 @@ void SIFrameLowering::determineCalleeSaves(MachineFunction &MF,
// are of 32-bit size. SIPreAllocateWWMRegs pass can add tuples into WWM
// reserved registers.
const TargetRegisterClass *RC = TRI->getPhysRegBaseClass(Reg);
- if (TRI->getRegSizeInBits(*RC) > 32)
+ if (TRI->getRegSizeInBits(*RC) != 32)
----------------
cdevadas wrote:
`SIPreallocateWWMRegs` pass handpicks VGPRs from the lower end. They might allocate VGPR tuples as well. However, the wwm-regalloc pass gets registers from the tail-end (we reserve them from the higher end to ensure the per-lane VGPR tuple allocation gets sufficient free contiguous registers from the initial scratch range.). This code inserted during PEI is trying to shift them down to the lowest range. Remember, the shifting is only required for those allocated during wwm-regalloc pass. Since we have the unified set `WWMReservedRegs` that holds all sort of wwm-regs, this loop here is trying to identify only 32-bit registers that are allocated during wwm-regalloc pass (the VGPRs used for SGPR spilling, at the moment). We may also pick the 32-bit regs custom allocated during the SIPreallcoate pass. But that's ok. This filter avoids any VGPR tuple allocated for wwm-operands during the custom allocate pass. The shift-down logic currently Inserted here considers only 32-bit regclasses.
The 16-bit registers weren't enabled earlier. So, it makes sense to change the condition to exactly match 32-bit classes.
https://github.com/llvm/llvm-project/pull/135053
More information about the llvm-commits
mailing list