Skip to content

Commit 3618c99

Browse files
authored
[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.
1 parent 53c0a25 commit 3618c99

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

llvm/lib/CodeGen/MachineScheduler.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3969,9 +3969,13 @@ 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;
39753979
}
39763980

39773981
// Fall through to original instruction order.

0 commit comments

Comments
 (0)