Iterate backwards over debug locations when splitting them so they can be safely erased.

This should unbreak dragonegg-i386-linux and build-self-4-mingw32.

llvm-svn: 131007
This commit is contained in:
Jakob Stoklund Olesen 2011-05-06 19:31:19 +00:00
parent 59ddb73d47
commit 57c8f58aeb
1 changed files with 4 additions and 1 deletions

View File

@ -795,7 +795,10 @@ UserValue::splitLocation(unsigned OldLocNo, ArrayRef<LiveInterval*> NewRegs) {
bool
UserValue::splitRegister(unsigned OldReg, ArrayRef<LiveInterval*> NewRegs) {
bool DidChange = false;
for (unsigned LocNo = 0, E = locations.size(); LocNo != E; ++LocNo) {
// Split locations referring to OldReg. Iterate backwards so splitLocation can
// safely erase unuused locations.
for (unsigned i = locations.size(); i ; --i) {
unsigned LocNo = i-1;
const MachineOperand *Loc = &locations[LocNo];
if (!Loc->isReg() || Loc->getReg() != OldReg)
continue;