From b4186e0ccd8dd8630078147e022142a8b65c9383 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 31 Mar 2004 21:59:59 +0000 Subject: [PATCH] MBB::remove should not modify the iterator passed in git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12572 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/InstrSched/InstrScheduling.cpp | 3 ++- lib/Target/SparcV9/InstrSched/InstrScheduling.cpp | 3 ++- lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/CodeGen/InstrSched/InstrScheduling.cpp b/lib/CodeGen/InstrSched/InstrScheduling.cpp index 5395a8197cf..63062691915 100644 --- a/lib/CodeGen/InstrSched/InstrScheduling.cpp +++ b/lib/CodeGen/InstrSched/InstrScheduling.cpp @@ -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) diff --git a/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp b/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp index 5395a8197cf..63062691915 100644 --- a/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp +++ b/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp @@ -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) diff --git a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp index 51a6f8b89e5..28fc75a8f6c 100644 --- a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp +++ b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp @@ -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 -- 2.34.1