Avoid referring to edge D after the Succs or Preds arrays have

been modified, to avoid trouble in the (unlikely) scenario that
D is a reference to an element in one of those arrays.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62173 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2009-01-13 19:08:45 +00:00
parent 2ecf88d175
commit a1f50e2c2c

View File

@ -75,8 +75,8 @@ void SUnit::addPred(const SDep &D) {
++NumPredsLeft; ++NumPredsLeft;
if (!isScheduled) if (!isScheduled)
++N->NumSuccsLeft; ++N->NumSuccsLeft;
N->Succs.push_back(P);
Preds.push_back(D); Preds.push_back(D);
N->Succs.push_back(P);
if (P.getLatency() != 0) { if (P.getLatency() != 0) {
this->setDepthDirty(); this->setDepthDirty();
N->setHeightDirty(); N->setHeightDirty();
@ -105,8 +105,8 @@ void SUnit::removePred(const SDep &D) {
} }
assert(FoundSucc && "Mismatching preds / succs lists!"); assert(FoundSucc && "Mismatching preds / succs lists!");
Preds.erase(I); Preds.erase(I);
// Update the bookkeeping; // Update the bookkeeping.
if (D.getKind() == SDep::Data) { if (P.getKind() == SDep::Data) {
--NumPreds; --NumPreds;
--N->NumSuccs; --N->NumSuccs;
} }