[PM] Don't walk the AM's ResultsList if nothing was invalidated.

Summary:
Previously in AnalysisManager::invalidate(), we would walk the full
ResultsList even if we knew that nothing was invalidated.

Reviewers: chandlerc

Subscribers: silvas, llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D27371

llvm-svn: 288595
This commit is contained in:
Justin Lebar 2016-12-03 19:49:23 +00:00
parent 9b085dd723
commit 64631f5d3b
1 changed files with 15 additions and 14 deletions

View File

@ -619,24 +619,25 @@ public:
}
// Now erase the results that were marked above as invalidated.
for (auto I = ResultsList.begin(), E = ResultsList.end(); I != E;) {
AnalysisKey *ID = I->first;
if (!IsResultInvalidated.lookup(ID)) {
++I;
continue;
if (!IsResultInvalidated.empty()) {
for (auto I = ResultsList.begin(), E = ResultsList.end(); I != E;) {
AnalysisKey *ID = I->first;
if (!IsResultInvalidated.lookup(ID)) {
++I;
continue;
}
if (DebugLogging)
dbgs() << "Invalidating analysis: " << this->lookUpPass(ID).name()
<< "\n";
I = ResultsList.erase(I);
AnalysisResults.erase({ID, &IR});
}
if (DebugLogging)
dbgs() << "Invalidating analysis: " << this->lookupPass(ID).name()
<< "\n";
I = ResultsList.erase(I);
AnalysisResults.erase({ID, &IR});
}
if (ResultsList.empty())
AnalysisResultLists.erase(&IR);
return;
}
private: