[llvm] [AMDGPU] Preserve WWM ownership of allocated AGPRs (PR #223278)
Yaxun Liu via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 29 04:06:03 PDT 2026
================
@@ -92,17 +92,20 @@ bool SILowerWWMCopies::isSCCLiveAtMI(const MachineInstr &MI) {
return LR.liveAt(Idx);
}
-// If \p Reg is assigned with a physical VGPR, add the latter into wwm-spills
-// for preserving its entire lanes at function prolog/epilog.
-void SILowerWWMCopies::addToWWMSpills(MachineFunction &MF, Register Reg) {
- if (Reg.isPhysical())
- return;
-
- // FIXME: VRM may be null here.
- MCRegister PhysReg = VRM->getPhys(Reg);
- assert(PhysReg && "should have allocated a physical register");
+// Record the physical register assigned to a WWM copy destination. It remains
+// owned by the WWM allocation after the temporary allocation mask is cleared.
+void SILowerWWMCopies::reserveWWMRegister(MachineFunction &MF, Register Reg) {
+ Register PhysReg = Reg;
+ if (Reg.isVirtual()) {
+ assert(VRM && "expected VirtRegMap after WWM register allocation");
----------------
yxsamliu wrote:
At `-O0`, fast allocation changes the operands to physical registers before this pass. That path does not use `VirtRegMap`; only the virtual-register path needs it.
https://github.com/llvm/llvm-project/pull/223278
More information about the llvm-commits
mailing list