[PATCH] D106176: [Scheduler] Treat weak edges uniformly at entry

Joe Nash via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 16 12:17:15 PDT 2021


Joe_Nash created this revision.
Joe_Nash added reviewers: sunfish, critson, fhahn.
Herald added subscribers: javed.absar, hiraditya.
Joe_Nash requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

There is a bug where the assert CurCycle >= SU->getDepth() in
SchedulePostRATDList::ScheduleNodeTopDown will fire when an instruction has only
weak predecessors and would otherwise be available at the entry of a scheduling
dag. For all nodes which are not immediately available, we respect the depth
(which respects weak edges) and do not move nodes from pending to available
until the proper depth is met. This patch makes that consistent for entry
available nodes as well.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106176

Files:
  llvm/lib/CodeGen/PostRASchedulerList.cpp


Index: llvm/lib/CodeGen/PostRASchedulerList.cpp
===================================================================
--- llvm/lib/CodeGen/PostRASchedulerList.cpp
+++ llvm/lib/CodeGen/PostRASchedulerList.cpp
@@ -534,8 +534,13 @@
   for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
     // It is available if it has no predecessors.
     if (!SUnits[i].NumPredsLeft && !SUnits[i].isAvailable) {
-      AvailableQueue.push(&SUnits[i]);
-      SUnits[i].isAvailable = true;
+      if (SUnits[i].getDepth() > 0) {
+        assert(SUnits[i].WeakPredsLeft > 0 && "Expected a weak predecessor");
+        PendingQueue.push_back(&SUnits[i]);
+      } else {
+        AvailableQueue.push(&SUnits[i]);
+        SUnits[i].isAvailable = true;
+      }
     }
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106176.359411.patch
Type: text/x-patch
Size: 758 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210716/c288b70d/attachment.bin>


More information about the llvm-commits mailing list