[llvm] [AMDGPU] Fix RewriteMFMAFormSchedStage (PR #194887)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed May 13 06:23:19 PDT 2026


================
@@ -2674,37 +2681,72 @@ bool RewriteMFMAFormStage::rewrite(
             unsigned UpdateRegion = LMI->second;
             DAG.Regions[UpdateRegion].second = VGPRCopy;
             LastMIToRegion.erase(RD);
+            // If RD was also the first MI of the next region, update that
+            // region's start boundary to keep the two sides in sync.
+            DenseMap<MachineInstr *, unsigned>::iterator FMI =
+                FirstMIToRegion.find(RD);
+            if (FMI != FirstMIToRegion.end()) {
+              DAG.Regions[FMI->second].first = VGPRCopy;
+              FirstMIToRegion.erase(RD);
+            }
           }
         }
       }
     }
 
     DenseSet<MachineOperand *> &DstRegSet = ReplaceMap[DstReg];
+
+    // Collect same-block uses; defer cross-block uses to ReachingUseTracker.
+    SmallVector<MachineOperand *, 4> SameBlockUses;
----------------
arsenm wrote:

Should this be tracking users, not uses? Can this just track the SlotIndex?

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


More information about the llvm-commits mailing list