aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineScheduler.cpp
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2014-06-27 04:57:05 +0000
committerAndrew Trick <atrick@apple.com>2014-06-27 04:57:05 +0000
commit5632722cab2184da3610bfec5d9ca00b8d46a815 (patch)
treee0e08ff02f824190a3e4b4e6b6501c7c889e90c5 /llvm/lib/CodeGen/MachineScheduler.cpp
parentf6ae844eea7fafcdce8cb313fb8fed6ad5be193b (diff)
downloadllvm-5632722cab2184da3610bfec5d9ca00b8d46a815.zip
llvm-5632722cab2184da3610bfec5d9ca00b8d46a815.tar.gz
llvm-5632722cab2184da3610bfec5d9ca00b8d46a815.tar.bz2
MachineScheduler: add some book-keeping to fix an assert.
Fixe for Bug 20057 - Assertion failied in llvm::SUnit* llvm::SchedBoundary::pickOnlyChoice(): Assertion `i <= (HazardRec->getMaxLookAhead() + MaxObservedStall) && "permanent hazard"' Thanks to Chad for the test case. llvm-svn: 211865
Diffstat (limited to 'llvm/lib/CodeGen/MachineScheduler.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineScheduler.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp
index 0baf2a6..b37f689 100644
--- a/llvm/lib/CodeGen/MachineScheduler.cpp
+++ b/llvm/lib/CodeGen/MachineScheduler.cpp
@@ -1687,8 +1687,14 @@ bool SchedBoundary::checkHazard(SUnit *SU) {
for (TargetSchedModel::ProcResIter
PI = SchedModel->getWriteProcResBegin(SC),
PE = SchedModel->getWriteProcResEnd(SC); PI != PE; ++PI) {
- if (getNextResourceCycle(PI->ProcResourceIdx, PI->Cycles) > CurrCycle)
+ unsigned NRCycle = getNextResourceCycle(PI->ProcResourceIdx, PI->Cycles);
+ if (NRCycle > CurrCycle) {
+ MaxObservedStall = std::max(NRCycle - CurrCycle, MaxObservedStall);
+ DEBUG(dbgs() << " SU(" << SU->NodeNum << ") "
+ << SchedModel->getResourceName(PI->ProcResourceIdx)
+ << "=" << NRCycle << "c\n");
return true;
+ }
}
}
return false;