Skip to content

Commit 3a4da00

Browse files
committed
[MISched] Compare right next cluster node
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.
1 parent 1dcb3db commit 3a4da00

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

llvm/lib/CodeGen/MachineScheduler.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3955,9 +3955,12 @@ bool PostGenericScheduler::tryCandidate(SchedCandidate &Cand,
39553955
return TryCand.Reason != NoCand;
39563956

39573957
// Keep clustered nodes together.
3958-
if (tryGreater(TryCand.SU == DAG->getNextClusterSucc(),
3959-
Cand.SU == DAG->getNextClusterSucc(),
3960-
TryCand, Cand, Cluster))
3958+
const SUnit *CandNextClusterSU =
3959+
Cand.AtTop ? DAG->getNextClusterSucc() : DAG->getNextClusterPred();
3960+
const SUnit *TryCandNextClusterSU =
3961+
TryCand.AtTop ? DAG->getNextClusterSucc() : DAG->getNextClusterPred();
3962+
if (tryGreater(TryCand.SU == TryCandNextClusterSU,
3963+
Cand.SU == CandNextClusterSU, TryCand, Cand, Cluster))
39613964
return TryCand.Reason != NoCand;
39623965

39633966
// Avoid critical resource consumption and balance the schedule.

0 commit comments

Comments
 (0)