[llvm] [AMDGPU] Fix illegal AGPR reclassification in RewriteMFMAFormStage (PR #200972)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 12 06:37:04 PDT 2026


================
@@ -2263,6 +2265,25 @@ static bool isReachingDefAGPRForm(MachineInstr *RD,
   return false;
 }
 
+bool RewriteMFMAFormStage::hasUseRequiringVGPR(
+    ArrayRef<SlotIndex> Src2ReachingDefs,
+    const SmallPtrSetImpl<MachineInstr *> &RewriteSet) {
+  for (SlotIndex RDIdx : Src2ReachingDefs) {
+    const MachineInstr *RD = DAG.LIS->getInstructionFromIndex(RDIdx);
+    SmallVector<MachineOperand *, 8> ReachingUses;
+    findReachingUses(RD, DAG.LIS, ReachingUses);
----------------
xgxanq wrote:

> So this is gonna run per candidate and for each use look for reaching defs. Can the info be at least reused between heuristic init and the rewrite?

Actually, it’s not strictly necessary. Since this is a bug fix, let’s get it merged as soon as possible — this whole section will be refactored anyway later.

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


More information about the llvm-commits mailing list