[llvm] [AMDGPU] Add scheduling stage to rewrite MFMA from VGPR to AGPR (PR #170335)
Tony Linthicum via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 15 06:52:05 PST 2026
================
@@ -1216,6 +1228,108 @@ bool GCNSchedStage::initGCNSchedStage() {
return true;
}
+void RewriteMFMAFormStage::findReachingDefs(
+ MachineOperand &UseMO, LiveIntervals *LIS,
+ SmallVectorImpl<SlotIndex> &DefIdxs) {
+ MachineInstr *UseMI = UseMO.getParent();
+ LiveInterval &UseLI = LIS->getInterval(UseMO.getReg());
+ VNInfo *VNI = UseLI.getVNInfoAt(LIS->getInstructionIndex(*UseMI));
+
+ // If the def is not a PHI, then it must be the only reaching def.
+ if (!VNI->isPHIDef()) {
+ DefIdxs.push_back(VNI->def);
+ return;
+ }
+
+ SmallPtrSet<MachineBasicBlock *, 8> Visited;
+ SmallVector<MachineBasicBlock *, 8> Worklist;
+ Visited.insert(UseMI->getParent());
+
+ // Mark the predecessor blocks for traversal
+ for (auto *PredMBB : UseMI->getParent()->predecessors()) {
----------------
tlinthic wrote:
Done.
https://github.com/llvm/llvm-project/pull/170335
More information about the llvm-commits
mailing list