[llvm] [MachinePipeliner] Make Recurrence MII More Accurate (PR #105475)

Michael Marjieh via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 2 22:59:56 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())) {
----------------
mmarjieh wrote:

I agree.
Thanks for reviewing!

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


More information about the llvm-commits mailing list