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

Justin Lebar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 3 11:59:37 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL288595: [PM] Don't walk the AM's ResultsList if nothing was invalidated. (authored by jlebar).

Changed prior to commit:
  https://reviews.llvm.org/D27371?vs=80146&id=80186#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27371

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


Index: llvm/trunk/include/llvm/IR/PassManager.h
===================================================================
--- llvm/trunk/include/llvm/IR/PassManager.h
+++ llvm/trunk/include/llvm/IR/PassManager.h
@@ -619,24 +619,25 @@
     }
 
     // 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 (DebugLogging)
-        dbgs() << "Invalidating analysis: " << this->lookupPass(ID).name()
-               << "\n";
+    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});
+        I = ResultsList.erase(I);
+        AnalysisResults.erase({ID, &IR});
+      }
     }
+
     if (ResultsList.empty())
       AnalysisResultLists.erase(&IR);
-
-    return;
   }
 
 private:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27371.80186.patch
Type: text/x-patch
Size: 1288 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161203/df51945c/attachment.bin>


More information about the llvm-commits mailing list