mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-23 00:20:25 +00:00
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
This commit is contained in:
@@ -278,6 +278,7 @@ void ScheduleDAGRRList::CapturePred(SDep *PredEdge) {
|
||||
AvailableQueue->remove(PredSU);
|
||||
}
|
||||
|
||||
assert(PredSU->NumSuccsLeft < UINT_MAX && "NumSuccsLeft will overflow!");
|
||||
++PredSU->NumSuccsLeft;
|
||||
}
|
||||
|
||||
@@ -824,17 +825,17 @@ void ScheduleDAGRRList::ListScheduleBottomUp() {
|
||||
/// the AvailableQueue if the count reaches zero. Also update its cycle bound.
|
||||
void ScheduleDAGRRList::ReleaseSucc(SUnit *SU, const 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;
|
||||
|
||||
// If all the node's predecessors are scheduled, this node is ready
|
||||
// to be scheduled. Ignore the special ExitSU node.
|
||||
if (SuccSU->NumPredsLeft == 0 && SuccSU != &ExitSU) {
|
||||
|
||||
Reference in New Issue
Block a user