MBB::remove should not modify the iterator passed in
authorChris Lattner <sabre@nondot.org>
Wed, 31 Mar 2004 21:59:59 +0000 (21:59 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 31 Mar 2004 21:59:59 +0000 (21:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12572 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/InstrSched/InstrScheduling.cpp
lib/Target/SparcV9/InstrSched/InstrScheduling.cpp
lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp

index 5395a8197cffd011ab8e5726e224830c9bbc4778..63062691915362e015994fd134af0a86cd05de09 100644 (file)
@@ -648,7 +648,8 @@ RecordSchedule(MachineBasicBlock &MBB, const SchedulingManager& S)
   
   // Remove all except the dummy PHI instructions from MBB, and
   // pre-allocate create space for the ones we will put back in.
-  while (I != MBB.end()) MBB.remove(I);
+  while (I != MBB.end())
+    MBB.remove(I++);
   
   InstrSchedule::const_iterator NIend = S.isched.end();
   for (InstrSchedule::const_iterator NI = S.isched.begin(); NI != NIend; ++NI)
index 5395a8197cffd011ab8e5726e224830c9bbc4778..63062691915362e015994fd134af0a86cd05de09 100644 (file)
@@ -648,7 +648,8 @@ RecordSchedule(MachineBasicBlock &MBB, const SchedulingManager& S)
   
   // Remove all except the dummy PHI instructions from MBB, and
   // pre-allocate create space for the ones we will put back in.
-  while (I != MBB.end()) MBB.remove(I);
+  while (I != MBB.end())
+    MBB.remove(I++);
   
   InstrSchedule::const_iterator NIend = S.isched.end();
   for (InstrSchedule::const_iterator NI = S.isched.begin(); NI != NIend; ++NI)
index 51a6f8b89e5e30ba43f915465a08a7142b945633..28fc75a8f6cf88bc845bff021834d1073f7bb55f 100644 (file)
@@ -542,7 +542,7 @@ void PhyRegAlloc::updateMachineCode()
               }
 
               // move instruction before branch
-              MBB.insert(MII, MBB.remove(DelaySlotMI));
+              MBB.insert(MII, MBB.remove(DelaySlotMI++));
 
               // On cond1 we are done (we already moved the
               // instruction out of the delay slot). On cond2 we need