[llvm] 3618c99 - [MISched] Use right boundary when trying latency heuristics (#116592)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 26 22:46:09 PST 2024


Author: Pengcheng Wang
Date: 2024-11-27T14:46:05+08:00
New Revision: 3618c9930f70b13b4e678ac04cb9f813056d560c

URL: https://github.com/llvm/llvm-project/commit/3618c9930f70b13b4e678ac04cb9f813056d560c
DIFF: https://github.com/llvm/llvm-project/commit/3618c9930f70b13b4e678ac04cb9f813056d560c.diff

LOG: [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.

Added: 
    

Modified: 
    llvm/lib/CodeGen/MachineScheduler.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp
index d65db91ac1ebd5..23e5e4a4da6d9a 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.


        


More information about the llvm-commits mailing list