[llvm] r210846 - Fix the scheduler's MaxObservedStall computation.

Andrew Trick atrick at apple.com
Thu Jun 12 15:36:28 PDT 2014


Author: atrick
Date: Thu Jun 12 17:36:28 2014
New Revision: 210846

URL: http://llvm.org/viewvc/llvm-project?rev=210846&view=rev
Log:
Fix the scheduler's MaxObservedStall computation.

WenHan Gu pointed out this bug that results in an assert
not being effective in some cases.

Modified:
    llvm/trunk/lib/CodeGen/MachineScheduler.cpp

Modified: llvm/trunk/lib/CodeGen/MachineScheduler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineScheduler.cpp?rev=210846&r1=210845&r2=210846&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineScheduler.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineScheduler.cpp Thu Jun 12 17:36:28 2014
@@ -691,7 +691,7 @@ void ScheduleDAGMI::schedule() {
       }
     }
     // Notify the scheduling strategy before updating the DAG.
-    // This sets the scheduled nodes ReadyCycle to CurrCycle. When updateQueues
+    // This sets the scheduled node's ReadyCycle to CurrCycle. When updateQueues
     // runs, it can then use the accurate ReadyCycle time to determine whether
     // newly released nodes can move to the readyQ.
     SchedImpl->schedNode(SU, IsTopNode);
@@ -1747,7 +1747,11 @@ void SchedBoundary::releaseNode(SUnit *S
   assert(SU->getInstr() && "Scheduled SUnit must have instr");
 
 #ifndef NDEBUG
-  MaxObservedStall = std::max(ReadyCycle - CurrCycle, MaxObservedStall);
+  // ReadyCycle was been bumped up to the CurrCycle when this node was
+  // scheduled, but CurrCycle may have been eagerly advanced immediately after
+  // scheduling, so may now be greater than ReadyCycle.
+  if (ReadyCycle > CurrCycle)
+    MaxObservedStall = std::max(ReadyCycle - CurrCycle, MaxObservedStall);
 #endif
 
   if (ReadyCycle < MinReadyCycle)





More information about the llvm-commits mailing list