Skip to content

Commit 0d333a5

Browse files
committed
[MISched] Use right boundary when trying latency heuristics
We may do bottom-up or bidirectional scheduling but previously we assume we are doing top-down scheduling, which may cause some issues.
1 parent 1dcb3db commit 0d333a5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

llvm/lib/CodeGen/MachineScheduler.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3969,9 +3969,14 @@ bool PostGenericScheduler::tryCandidate(SchedCandidate &Cand,
39693969
TryCand, Cand, ResourceDemand))
39703970
return TryCand.Reason != NoCand;
39713971

3972-
// Avoid serializing long latency dependence chains.
3973-
if (Cand.Policy.ReduceLatency && tryLatency(TryCand, Cand, Top)) {
3974-
return TryCand.Reason != NoCand;
3972+
// We only compare a subset of features when comparing nodes between
3973+
// Top and Bottom boundary.
3974+
if (Cand.AtTop == TryCand.AtTop) {
3975+
// Avoid serializing long latency dependence chains.
3976+
if (Cand.Policy.ReduceLatency &&
3977+
tryLatency(TryCand, Cand, Cand.AtTop ? Top : Bot)) {
3978+
return TryCand.Reason != NoCand;
3979+
}
39753980
}
39763981

39773982
// Fall through to original instruction order.

0 commit comments

Comments
 (0)