[PATCH] D86442: Skip analysis re-computation when no changes are reported

serge via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 00:31:54 PDT 2020


serge-sans-paille updated this revision to Diff 287555.
serge-sans-paille added a comment.

Take review into account.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86442/new/

https://reviews.llvm.org/D86442

Files:
  llvm/lib/Analysis/CallGraphSCCPass.cpp
  llvm/lib/Analysis/LoopPass.cpp
  llvm/lib/Analysis/RegionPass.cpp


Index: llvm/lib/Analysis/RegionPass.cpp
===================================================================
--- llvm/lib/Analysis/RegionPass.cpp
+++ llvm/lib/Analysis/RegionPass.cpp
@@ -89,16 +89,18 @@
       }
 
       initializeAnalysisImpl(P);
+      bool LocalChanged;
 
       {
         PassManagerPrettyStackEntry X(P, *CurrentRegion->getEntry());
 
         TimeRegion PassTimer(getPassTimer(P));
-        Changed |= P->runOnRegion(CurrentRegion, *this);
+        LocalChanged = P->runOnRegion(CurrentRegion, *this);
+        Changed |= LocalChanged;
       }
 
       if (isPassDebuggingExecutionsOrMore()) {
-        if (Changed)
+        if (LocalChanged)
           dumpPassInfo(P, MODIFICATION_MSG, ON_REGION_MSG,
                        skipThisRegion ? "<deleted>" :
                                       CurrentRegion->getNameStr());
@@ -120,7 +122,8 @@
         verifyPreservedAnalysis(P);
       }
 
-      removeNotPreservedAnalysis(P);
+      if (LocalChanged)
+        removeNotPreservedAnalysis(P);
       recordAvailableAnalysis(P);
       removeDeadPasses(P,
                        (!isPassDebuggingExecutionsOrMore() || skipThisRegion) ?
Index: llvm/lib/Analysis/LoopPass.cpp
===================================================================
--- llvm/lib/Analysis/LoopPass.cpp
+++ llvm/lib/Analysis/LoopPass.cpp
@@ -241,7 +241,8 @@
         F.getContext().yield();
       }
 
-      removeNotPreservedAnalysis(P);
+      if (LocalChanged)
+        removeNotPreservedAnalysis(P);
       recordAvailableAnalysis(P);
       removeDeadPasses(P,
                        CurrentLoopDeleted ? "<deleted>"
Index: llvm/lib/Analysis/CallGraphSCCPass.cpp
===================================================================
--- llvm/lib/Analysis/CallGraphSCCPass.cpp
+++ llvm/lib/Analysis/CallGraphSCCPass.cpp
@@ -467,15 +467,18 @@
     initializeAnalysisImpl(P);
 
     // Actually run this pass on the current SCC.
-    Changed |= RunPassOnSCC(P, CurSCC, CG,
-                            CallGraphUpToDate, DevirtualizedCall);
+    bool LocalChanged =
+        RunPassOnSCC(P, CurSCC, CG, CallGraphUpToDate, DevirtualizedCall);
 
-    if (Changed)
+    Changed |= LocalChanged;
+
+    if (LocalChanged)
       dumpPassInfo(P, MODIFICATION_MSG, ON_CG_MSG, "");
     dumpPreservedSet(P);
 
     verifyPreservedAnalysis(P);
-    removeNotPreservedAnalysis(P);
+    if (LocalChanged)
+      removeNotPreservedAnalysis(P);
     recordAvailableAnalysis(P);
     removeDeadPasses(P, "", ON_CG_MSG);
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86442.287555.patch
Type: text/x-patch
Size: 2516 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200825/b9c59f91/attachment.bin>


More information about the llvm-commits mailing list