aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineScheduler.cpp
diff options
context:
space:
mode:
authorPengcheng Wang <wangpengcheng.pp@bytedance.com>2024-12-10 14:44:02 +0800
committerGitHub <noreply@github.com>2024-12-10 14:44:02 +0800
commit920495c959d44881b8bb602036c8ea003a04dc3f (patch)
treed60cecb870221dff80054c2545ccfce3235c5351 /llvm/lib/CodeGen/MachineScheduler.cpp
parentce1587346b3b181b693283233c88f5fc9e9b9c1a (diff)
downloadllvm-920495c959d44881b8bb602036c8ea003a04dc3f.zip
llvm-920495c959d44881b8bb602036c8ea003a04dc3f.tar.gz
llvm-920495c959d44881b8bb602036c8ea003a04dc3f.tar.bz2
[MISched] Compare right next cluster node (#116584)
We support bottom-up and bidirectonal postra scheduling now, but we only compare successive next cluster node as if we are doing topdown scheduling. This makes load/store clustering and macro fusions wrong. This patch makes sure that we can get the right cluster node by the scheduling direction.
Diffstat (limited to 'llvm/lib/CodeGen/MachineScheduler.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineScheduler.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp
index 7da9b3a..1722bdd 100644
--- a/llvm/lib/CodeGen/MachineScheduler.cpp
+++ b/llvm/lib/CodeGen/MachineScheduler.cpp
@@ -3958,9 +3958,12 @@ bool PostGenericScheduler::tryCandidate(SchedCandidate &Cand,
return TryCand.Reason != NoCand;
// Keep clustered nodes together.
- if (tryGreater(TryCand.SU == DAG->getNextClusterSucc(),
- Cand.SU == DAG->getNextClusterSucc(),
- TryCand, Cand, Cluster))
+ const SUnit *CandNextClusterSU =
+ Cand.AtTop ? DAG->getNextClusterSucc() : DAG->getNextClusterPred();
+ const SUnit *TryCandNextClusterSU =
+ TryCand.AtTop ? DAG->getNextClusterSucc() : DAG->getNextClusterPred();
+ if (tryGreater(TryCand.SU == TryCandNextClusterSU,
+ Cand.SU == CandNextClusterSU, TryCand, Cand, Cluster))
return TryCand.Reason != NoCand;
// Avoid critical resource consumption and balance the schedule.