summaryrefslogtreecommitdiff
path: root/lib/CodeGen/PostRASchedulerList.cpp
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2009-09-30 20:15:38 +0000
committerReid Kleckner <reid@kleckner.net>2009-09-30 20:15:38 +0000
commitc277ab08a24d2dbe9b4ff1a9154ea6115ed6a4e3 (patch)
tree961f33a75eced084518a387d00095b6a98782d25 /lib/CodeGen/PostRASchedulerList.cpp
parent69cc57c3259249cd9e64735ba79da2ce0e64a4b5 (diff)
downloadllvm-c277ab08a24d2dbe9b4ff1a9154ea6115ed6a4e3.tar.gz
llvm-c277ab08a24d2dbe9b4ff1a9154ea6115ed6a4e3.tar.bz2
llvm-c277ab08a24d2dbe9b4ff1a9154ea6115ed6a4e3.tar.xz
Fix integer overflow in instruction scheduling. This can happen if we have
basic blocks that are so long that their size overflows a short. Also assert that overflow does not happen in the future, as requested by Evan. This fixes PR4401. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83159 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/PostRASchedulerList.cpp')
-rw-r--r--lib/CodeGen/PostRASchedulerList.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/CodeGen/PostRASchedulerList.cpp b/lib/CodeGen/PostRASchedulerList.cpp
index 42954eac4f..5fa598d95b 100644
--- a/lib/CodeGen/PostRASchedulerList.cpp
+++ b/lib/CodeGen/PostRASchedulerList.cpp
@@ -972,17 +972,17 @@ void SchedulePostRATDList::FixupKills(MachineBasicBlock *MBB) {
/// the PendingQueue if the count reaches zero. Also update its cycle bound.
void SchedulePostRATDList::ReleaseSucc(SUnit *SU, SDep *SuccEdge) {
SUnit *SuccSU = SuccEdge->getSUnit();
- --SuccSU->NumPredsLeft;
-
+
#ifndef NDEBUG
- if (SuccSU->NumPredsLeft < 0) {
+ if (SuccSU->NumPredsLeft == 0) {
errs() << "*** Scheduling failed! ***\n";
SuccSU->dump(this);
errs() << " has been released too many times!\n";
llvm_unreachable(0);
}
#endif
-
+ --SuccSU->NumPredsLeft;
+
// Compute how many cycles it will be before this actually becomes
// available. This is the max of the start time of all predecessors plus
// their latencies.