From 3618c9930f70b13b4e678ac04cb9f813056d560c Mon Sep 17 00:00:00 2001 From: Pengcheng Wang Date: Wed, 27 Nov 2024 14:46:05 +0800 Subject: [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. --- llvm/lib/CodeGen/MachineScheduler.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'llvm/lib/CodeGen/MachineScheduler.cpp') 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. -- cgit v1.1