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

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 3 11:49:23 PST 2016


Author: jlebar
Date: Sat Dec  3 13:49:23 2016
New Revision: 288595

URL: http://llvm.org/viewvc/llvm-project?rev=288595&view=rev
Log:
[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

Modified:
    llvm/trunk/include/llvm/IR/PassManager.h

Modified: llvm/trunk/include/llvm/IR/PassManager.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/PassManager.h?rev=288595&r1=288594&r2=288595&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/PassManager.h (original)
+++ llvm/trunk/include/llvm/IR/PassManager.h Sat Dec  3 13:49:23 2016
@@ -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";
+        if (DebugLogging)
+          dbgs() << "Invalidating analysis: " << this->lookUpPass(ID).name()
+                 << "\n";
 
-      I = ResultsList.erase(I);
-      AnalysisResults.erase({ID, &IR});
+        I = ResultsList.erase(I);
+        AnalysisResults.erase({ID, &IR});
+      }
     }
+
     if (ResultsList.empty())
       AnalysisResultLists.erase(&IR);
-
-    return;
   }
 
 private:




More information about the llvm-commits mailing list