AArch64: avoid deleting the current iterator in a loop.

std::map invalidates the iterator to any element that gets deleted, which means
we can't increment it correctly afterwards. This was causing Darwin test
failures.

llvm-svn: 215233
This commit is contained in:
Tim Northover 2014-08-08 17:31:52 +00:00
parent 495bc3f5f6
commit e42fac5191
1 changed files with 4 additions and 3 deletions

View File

@ -671,13 +671,14 @@ maybeKillChain(MachineOperand &MO, unsigned Idx,
} else if (MO.isRegMask()) {
for (auto I = ActiveChains.begin(), E = ActiveChains.end();
I != E; ++I) {
I != E;) {
if (MO.clobbersPhysReg(I->first)) {
DEBUG(dbgs() << "Kill (regmask) seen for chain "
<< TRI->getName(I->first) << "\n");
I->second->setKill(MI, Idx, /*Immutable=*/true);
ActiveChains.erase(I);
}
ActiveChains.erase(I++);
} else
++I;
}
}