[llvm] [AMDGPU] Do not forward reserved aperture registers into wider copies (PR #220517)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 8 11:55:10 PDT 2026
================
@@ -875,9 +888,19 @@ void MachineCopyPropagation::forwardUses(MachineInstr &MI) {
}
}
- // Don't forward COPYs of reserved regs unless they are constant.
- if (MRI->isReserved(CopySrc) && !MRI->isConstantPhysReg(CopySrc))
- continue;
+ if (MRI->isReserved(CopySrc)) {
+ // Don't forward COPYs of reserved regs unless they are constant.
+ if (!MRI->isConstantPhysReg(CopySrc))
+ continue;
+
+ // A reserved source may lack subregs the copy is later split into.
+ if (isCopyInstr(MI, *TII, UseCopyInstr) &&
+ !hasMatchingSubRegs(MOUse.getReg().asMCReg(), ForwardedReg, *TRI)) {
+ LLVM_DEBUG(dbgs() << "MCP: Copy source is missing subregisters of "
+ << printReg(MOUse.getReg(), TRI) << '\n');
+ continue;
+ }
----------------
arsenm wrote:
This isn't a property of constant or reserved registers. this is an orthogonal problem and should be checked unconditionally (though actually it seems like this should be covered under isForwardableRegClassCopy)
https://github.com/llvm/llvm-project/pull/220517
More information about the llvm-commits
mailing list