[llvm] [MachinePipeliner] Introduce a new class for loop-carried deps (PR #137663)
Ryotaro Kasuga via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 5 00:11:52 PDT 2025
================
@@ -941,28 +1014,116 @@ static bool hasLoopCarriedMemDep(const SUnitWithMemInfo &Src,
return false;
}
+void LoopCarriedOrderDepsTracker::LoadStoreChunk::append(SUnit *SU) {
+ const MachineInstr *MI = SU->getInstr();
+ if (!MI->mayLoadOrStore())
+ return;
+ (MI->mayStore() ? Stores : Loads).emplace_back(SU);
+}
+
+LoopCarriedOrderDepsTracker::LoopCarriedOrderDepsTracker(
+ SwingSchedulerDAG *SSD, BatchAAResults *BAA, const TargetInstrInfo *TII,
+ const TargetRegisterInfo *TRI)
+ : DAG(SSD), BAA(BAA), SUnits(DAG->SUnits), N(SUnits.size()),
+ LoopCarried(N, BitVector(N)), TII(TII), TRI(TRI) {}
+
+void LoopCarriedOrderDepsTracker::computeDependencies() {
+ // Traverse all instructions and extract only what we are targetting.
+ for (auto &SU : SUnits) {
+ auto Tagged = checkInstrType(&SU);
+
+ // This instruction has no loop-carried order-dependencies.
+ if (!Tagged)
+ continue;
+ TaggedSUnits.push_back(*Tagged);
+ }
+
+ computeDependenciesAux();
+
+ LLVM_DEBUG({
+ for (unsigned I = 0; I != N; I++)
+ assert(!LoopCarried[I].test(I) && "Unexpected self-loop");
+ });
----------------
kasuga-fj wrote:
Correct, deleted (this can be here, but it’s not very meaningful).
https://github.com/llvm/llvm-project/pull/137663
More information about the llvm-commits
mailing list