diff options
-rw-r--r-- | lib/IR/PassManager.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/IR/PassManager.cpp b/lib/IR/PassManager.cpp index f706a0d..966af7d 100644 --- a/lib/IR/PassManager.cpp +++ b/lib/IR/PassManager.cpp @@ -47,11 +47,12 @@ void AnalysisManager::invalidateAll(Function *F) { FunctionAnalysisResultListT &ResultsList = FunctionAnalysisResultLists[F]; for (FunctionAnalysisResultListT::iterator I = ResultsList.begin(), E = ResultsList.end(); - I != E; ++I) + I != E;) if (I->second->invalidate(F)) { - FunctionAnalysisResultListT::iterator Old = I--; - InvalidatedPassIDs.push_back(Old->first); - ResultsList.erase(Old); + InvalidatedPassIDs.push_back(I->first); + I = ResultsList.erase(I); + } else { + ++I; } while (!InvalidatedPassIDs.empty()) FunctionAnalysisResults.erase( @@ -80,11 +81,12 @@ void AnalysisManager::invalidateAll(Module *M) { FunctionAnalysisResultListT &ResultsList = FI->second; for (FunctionAnalysisResultListT::iterator I = ResultsList.begin(), E = ResultsList.end(); - I != E; ++I) + I != E;) if (I->second->invalidate(F)) { - FunctionAnalysisResultListT::iterator Old = I--; - InvalidatedPassIDs.push_back(Old->first); - ResultsList.erase(Old); + InvalidatedPassIDs.push_back(I->first); + I = ResultsList.erase(I); + } else { + ++I; } while (!InvalidatedPassIDs.empty()) FunctionAnalysisResults.erase( |