diff options
author | bcahoon <59846893+bcahoon@users.noreply.github.com> | 2023-12-11 21:10:34 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-11 21:10:34 -0600 |
commit | a19c7c403fa056a37585407586a2d84d03f41d8a (patch) | |
tree | 0ed5eedc267876049ed5bf810b9eef935607d404 /llvm/lib/CodeGen/MachinePipeliner.cpp | |
parent | 3850131197b7508e2e2f25f966f75105a0be3929 (diff) | |
download | llvm-a19c7c403fa056a37585407586a2d84d03f41d8a.zip llvm-a19c7c403fa056a37585407586a2d84d03f41d8a.tar.gz llvm-a19c7c403fa056a37585407586a2d84d03f41d8a.tar.bz2 |
[MachinePipeliner] Fix store-store dependences (#72575)
The pipeliner needs to mark store-store order dependences as
loop carried dependences. Otherwise, the stores may be scheduled
further apart than the MII. The order dependences implies that
the first instance of the dependent store is scheduled before the
second instance of the source store instruction.
Diffstat (limited to 'llvm/lib/CodeGen/MachinePipeliner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachinePipeliner.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp index 81b7fdc..8cd7f4e 100644 --- a/llvm/lib/CodeGen/MachinePipeliner.cpp +++ b/llvm/lib/CodeGen/MachinePipeliner.cpp @@ -2225,7 +2225,7 @@ MachineInstr *SwingSchedulerDAG::findDefInLoop(Register Reg) { } /// Return true for an order or output dependence that is loop carried -/// potentially. A dependence is loop carried if the destination defines a valu +/// potentially. A dependence is loop carried if the destination defines a value /// that may be used or defined by the source in a subsequent iteration. bool SwingSchedulerDAG::isLoopCarriedDep(SUnit *Source, const SDep &Dep, bool isSucc) { @@ -2251,10 +2251,12 @@ bool SwingSchedulerDAG::isLoopCarriedDep(SUnit *Source, const SDep &Dep, SI->hasOrderedMemoryRef() || DI->hasOrderedMemoryRef()) return true; - // Only chain dependences between a load and store can be loop carried. - if (!DI->mayStore() || !SI->mayLoad()) + if (!DI->mayLoadOrStore() || !SI->mayLoadOrStore()) return false; + // The conservative assumption is that a dependence between memory operations + // may be loop carried. The following code checks when it can be proved that + // there is no loop carried dependence. unsigned DeltaS, DeltaD; if (!computeDelta(*SI, DeltaS) || !computeDelta(*DI, DeltaD)) return true; |