[llvm] [MachinePipeliner] Make Recurrence MII More Accurate (PR #105475)
Michael Marjieh via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 2 04:10:51 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:
Hi @kasuga-fj,
I did what you requested locally.
I have a couple of failed lit tests.
Starting investigating this one:
`llvm/test/CodeGen/Hexagon/swp-resmii-1.ll`
Attaching both debug prints before this change and after:
[old_log.txt](https://github.com/user-attachments/files/16836615/old_log.txt)
[new_log.txt](https://github.com/user-attachments/files/16836616/new_log.txt)
The main difference is having a new backedge from one store to its preceding store.
This causes a new recurrence:
![image](https://github.com/user-attachments/assets/28befeb3-3842-4eef-ab7a-6653e994cd26)
Which leads to invalid node order.
![image](https://github.com/user-attachments/assets/021bbd8b-f65c-4d27-9278-b867a10ab75a)
I am not sure what to do with this. Can you see if there is something wrong in the new log?
On a related note, can we do this change in another patch and keep the adjacency matrix as is here?
https://github.com/llvm/llvm-project/pull/105475
More information about the llvm-commits
mailing list