[llvm] AMDGPU: Handle multiple AGPR MFMA rewrites (PR #147975)

Lucas Ramirez via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 11 07:01:52 PDT 2025


================
@@ -208,8 +218,19 @@ bool AMDGPURewriteAGPRCopyMFMAImpl::run(MachineFunction &MF) const {
 
       CopySrcMI->setDesc(TII.get(AGPROp));
 
-      // TODO: Is replacing too aggressive, fixup these instructions only?
-      MRI.replaceRegWith(CopySrcReg, VReg);
+      // Perform replacement of the register, rewriting the rewritable uses.
+      for (MachineInstr &UseMI :
----------------
lucas-rami wrote:

I think it's a bit confusing too. The comment above also only mentions uses as being rewritten whereas defs will also have their register substituted.

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


More information about the llvm-commits mailing list