[llvm] [MachinePipeliner] Make Recurrence MII More Accurate (PR #105475)
Ryotaro Kasuga via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 26 23:26:19 PDT 2024
================
@@ -1680,13 +1680,19 @@ void SwingSchedulerDAG::Circuits::createAdjacencyStructure(
Added.set(N);
}
}
- // A chain edge between a store and a load is treated as a back-edge in the
- // adjacency matrix.
+ // Order edges of the following:
+ // 1. Load -> Store
+ // 2. Store -> Load
+ // are treated as a back-edge in the adjacency matrix.
+ // Store after store was handled above.
for (auto &PI : SUnits[i].Preds) {
- if (!SUnits[i].getInstr()->mayStore() ||
+ if (PI.getKind() != SDep::Order ||
!DAG->isLoopCarriedDep(&SUnits[i], PI, false))
continue;
- if (PI.getKind() == SDep::Order && PI.getSUnit()->getInstr()->mayLoad()) {
+ if ((SUnits[i].getInstr()->mayLoad() &&
+ PI.getSUnit()->getInstr()->mayStore()) ||
+ (SUnits[i].getInstr()->mayStore() &&
+ PI.getSUnit()->getInstr()->mayLoad())) {
----------------
kasuga-fj wrote:
Oh sorry, I made a mistake in the previous comment https://github.com/llvm/llvm-project/pull/105475#discussion_r1728130892. I meant to say store-to-store, not store-to-load. My intention was to remove conditions based on the type of instruction. In this case, I think no conditional branching is needed here.
I'm not sure what your comment "Store after store was handled above" means. If you mean output-dependencies, they are not relevant: Output-dependence is a write-after-write dependence for physical registers.
Also, could you please fix the following comment?
https://github.com/llvm/llvm-project/blob/17726a8bdbb952b30957aa462b9b18d0c724464c/llvm/include/llvm/CodeGen/MachinePipeliner.h#L376
https://github.com/llvm/llvm-project/pull/105475
More information about the llvm-commits
mailing list