MBB::remove should not modify the iterator passed in
[oota-llvm.git] / lib / Target / SparcV9 / InstrSched / InstrScheduling.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)