[llvm] [MachinePipeliner] Add an abstract layer to manipulate Data Dependenc… (PR #109918)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 31 08:00:47 PDT 2024
================
@@ -3184,18 +3171,21 @@ SmallSet<SUnit *, 8> SMSchedule::computeUnpipelineableNodes(
if (SU.isInstr() && PLI->shouldIgnoreForPipelining(SU.getInstr()))
Worklist.push_back(&SU);
+ const SwingSchedulerDDG *DDG = SSD->getDDG();
while (!Worklist.empty()) {
auto SU = Worklist.pop_back_val();
if (DoNotPipeline.count(SU))
continue;
LLVM_DEBUG(dbgs() << "Do not pipeline SU(" << SU->NodeNum << ")\n");
DoNotPipeline.insert(SU);
- for (auto &Dep : SU->Preds)
- Worklist.push_back(Dep.getSUnit());
- if (SU->getInstr()->isPHI())
- for (auto &Dep : SU->Succs)
- if (Dep.getKind() == SDep::Anti)
- Worklist.push_back(Dep.getSUnit());
+ for (const auto &IE : DDG->getInEdges(SU))
+ Worklist.push_back(IE.getSrc());
+
+ // To preserve previous behavior and prevent regression
+ // FIXME: Remove if this doesn't have significant impact on
+ for (const auto &OE : DDG->getOutEdges(SU))
+ if (OE.getDistance() == 1)
+ Worklist.push_back(OE.getDst());
----------------
dpenry wrote:
Because the original code is adding the loop-carried antidependences for just the PHI nodes and I think those edges are actually in the new DDG, the dependent nodes should already be in the worklist. If this is true, then the second for statement should be removable.
As for the code in normalizeNonPipelinedInstructions, I think the FIXME section maybe wasn't needed to start with because the original SU.Preds didn't contain the loop-carried antidependences, so adding them in wasn't needed.
https://github.com/llvm/llvm-project/pull/109918
More information about the llvm-commits
mailing list