MBB::remove should not modify the iterator passed in
llvm-svn: 12572
diff --git a/llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp b/llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp
index 5395a81..6306269 100644
--- a/llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp
+++ b/llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp
@@ -648,7 +648,8 @@
// 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)