diff options
author | Pengcheng Wang <wangpengcheng.pp@bytedance.com> | 2024-11-27 14:46:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-27 14:46:05 +0800 |
commit | 3618c9930f70b13b4e678ac04cb9f813056d560c (patch) | |
tree | 62f3b25ac1725298ed5926c98286b4cbbb9b01b5 /llvm/lib/CodeGen/MachineScheduler.cpp | |
parent | 53c0a25db7a0469f6d47e130d5a0e8f7a88b9585 (diff) | |
download | llvm-3618c9930f70b13b4e678ac04cb9f813056d560c.zip llvm-3618c9930f70b13b4e678ac04cb9f813056d560c.tar.gz llvm-3618c9930f70b13b4e678ac04cb9f813056d560c.tar.bz2 |
[MISched] Use right boundary when trying latency heuristics (#116592)
We may do bottom-up or bidirectional scheduling but previously we
assume we are doing top-down scheduling, which may cause some issues.
Diffstat (limited to 'llvm/lib/CodeGen/MachineScheduler.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineScheduler.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp index d65db91..23e5e4a 100644 --- a/llvm/lib/CodeGen/MachineScheduler.cpp +++ b/llvm/lib/CodeGen/MachineScheduler.cpp @@ -3969,9 +3969,13 @@ bool PostGenericScheduler::tryCandidate(SchedCandidate &Cand, TryCand, Cand, ResourceDemand)) return TryCand.Reason != NoCand; - // Avoid serializing long latency dependence chains. - if (Cand.Policy.ReduceLatency && tryLatency(TryCand, Cand, Top)) { - return TryCand.Reason != NoCand; + // We only compare a subset of features when comparing nodes between + // Top and Bottom boundary. + if (Cand.AtTop == TryCand.AtTop) { + // Avoid serializing long latency dependence chains. + if (Cand.Policy.ReduceLatency && + tryLatency(TryCand, Cand, Cand.AtTop ? Top : Bot)) + return TryCand.Reason != NoCand; } // Fall through to original instruction order. |