[llvm-commits] [llvm] r62173 - /llvm/trunk/lib/CodeGen/ScheduleDAG.cpp

Dan Gohman gohman at apple.com
Tue Jan 13 11:08:45 PST 2009


Author: djg
Date: Tue Jan 13 13:08:45 2009
New Revision: 62173

URL: http://llvm.org/viewvc/llvm-project?rev=62173&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/CodeGen/ScheduleDAG.cpp

Modified: llvm/trunk/lib/CodeGen/ScheduleDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ScheduleDAG.cpp?rev=62173&r1=62172&r2=62173&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/ScheduleDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/ScheduleDAG.cpp Tue Jan 13 13:08:45 2009
@@ -75,8 +75,8 @@
     ++NumPredsLeft;
   if (!isScheduled)
     ++N->NumSuccsLeft;
-  N->Succs.push_back(P);
   Preds.push_back(D);
+  N->Succs.push_back(P);
   if (P.getLatency() != 0) {
     this->setDepthDirty();
     N->setHeightDirty();
@@ -105,8 +105,8 @@
         }
       assert(FoundSucc && "Mismatching preds / succs lists!");
       Preds.erase(I);
-      // Update the bookkeeping;
-      if (D.getKind() == SDep::Data) {
+      // Update the bookkeeping.
+      if (P.getKind() == SDep::Data) {
         --NumPreds;
         --N->NumSuccs;
       }





More information about the llvm-commits mailing list