Fix iterator-invalidation issue

Inserting a new key into a DenseMap potentially invalidates iterators into that
map. Trying to fix an issue from r289755 triggering this assertion:

  Assertion `isHandleInSync() && "invalid iterator access!"' failed.

llvm-svn: 289757
This commit is contained in:
Hal Finkel 2016-12-15 03:30:40 +00:00
parent 3ca4a6bcf1
commit 321053a7ca
1 changed files with 3 additions and 1 deletions

View File

@ -3529,7 +3529,9 @@ void ScalarEvolution::addAffectedFromOperands(const SCEV *S) {
if (AMI == AffectedMap.end())
continue;
AffectedMap[S].insert(AMI->second.begin(), AMI->second.end());
auto &ISet = AffectedMap[S];
AMI = AffectedMap.find(Op);
ISet.insert(AMI->second.begin(), AMI->second.end());
}
}