[llvm] AMDGPU: Handle rewriting non-tied MFMA to AGPR form (PR #153015)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 18 08:21:34 PDT 2025


================
@@ -154,117 +231,122 @@ bool AMDGPURewriteAGPRCopyMFMAImpl::run(MachineFunction &MF) const {
       if (!DefMI || !DefMI->isFullCopy())
         continue;
 
-      Register CopySrcReg = DefMI->getOperand(1).getReg();
-      if (!CopySrcReg.isVirtual())
+      Register MFMADstReg = DefMI->getOperand(1).getReg();
+      if (!MFMADstReg.isVirtual())
         continue;
 
-      LiveInterval &CopySrcLI = LIS.getInterval(CopySrcReg);
+      LiveInterval &CopySrcLI = LIS.getInterval(MFMADstReg);
       LiveQueryResult LRQ = CopySrcLI.Query(VNI->def.getRegSlot());
-      MachineInstr *CopySrcMI = LIS.getInstructionFromIndex(LRQ.valueIn()->def);
-      if (!CopySrcMI)
+      MachineInstr *MFMA = LIS.getInstructionFromIndex(LRQ.valueIn()->def);
+      if (!MFMA || !isRewriteCandidate(*MFMA))
----------------
arsenm wrote:

I don't see this case fold in this patch, but it does at the top of the stack

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


More information about the llvm-commits mailing list