summaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2014-06-12 22:36:28 +0000
committerAndrew Trick <atrick@apple.com>2014-06-12 22:36:28 +0000
commit796f114767007e0bf39d4ad8550701808af307bb (patch)
tree64faf962d1cbd4753340ee67e91b5ed0d08b5e94 /lib/CodeGen
parent4ecff11794c6d57cbb240fa5ee730dd1cd0e1b65 (diff)
downloadllvm-796f114767007e0bf39d4ad8550701808af307bb.tar.gz
llvm-796f114767007e0bf39d4ad8550701808af307bb.tar.bz2
llvm-796f114767007e0bf39d4ad8550701808af307bb.tar.xz
Fix the scheduler's MaxObservedStall computation.
WenHan Gu pointed out this bug that results in an assert not being effective in some cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210846 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/MachineScheduler.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/CodeGen/MachineScheduler.cpp b/lib/CodeGen/MachineScheduler.cpp
index cbe937a06f..0baf2a6c1c 100644
--- a/lib/CodeGen/MachineScheduler.cpp
+++ b/lib/CodeGen/MachineScheduler.cpp
@@ -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 *SU, unsigned ReadyCycle) {
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)