[llvm] [AMDGPU] Do not forward reserved aperture registers into wider copies (PR #220517)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 13 09:39:17 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) &&
----------------
arsenm wrote:

This should not be under the isReserved check 

https://github.com/llvm/llvm-project/pull/220517


More information about the llvm-commits mailing list