[PATCH] D97814: [CGSCC] Skip SCC if we will revisit it later

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 2 15:19:22 PST 2021


aeubanks created this revision.
Herald added a subscriber: hiraditya.
aeubanks requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97814

Files:
  llvm/include/llvm/Analysis/CGSCCPassManager.h
  llvm/lib/Analysis/CGSCCPassManager.cpp


Index: llvm/lib/Analysis/CGSCCPassManager.cpp
===================================================================
--- llvm/lib/Analysis/CGSCCPassManager.cpp
+++ llvm/lib/Analysis/CGSCCPassManager.cpp
@@ -81,6 +81,12 @@
       AM.getCachedResult<FunctionAnalysisManagerCGSCCProxy>(*C)->getManager();
 
   for (auto &Pass : Passes) {
+    if (UR.SkipCurrentC) {
+      UR.SkipCurrentC = false;
+      LLVM_DEBUG(dbgs() << "?\n");
+      break;
+    }
+
     // Check the PassInstrumentation's BeforePass callbacks before running the
     // pass, skip its execution completely if asked to (callback returns false).
     if (!PI.runBeforePass(*Pass, *C))
@@ -174,10 +180,16 @@
   SmallDenseSet<std::pair<LazyCallGraph::Node *, LazyCallGraph::SCC *>, 4>
       InlinedInternalEdges;
 
-  CGSCCUpdateResult UR = {
-      RCWorklist, CWorklist, InvalidRefSCCSet,         InvalidSCCSet,
-      nullptr,    nullptr,   PreservedAnalyses::all(), InlinedInternalEdges,
-      {}};
+  CGSCCUpdateResult UR = {RCWorklist,
+                          CWorklist,
+                          InvalidRefSCCSet,
+                          InvalidSCCSet,
+                          nullptr,
+                          nullptr,
+                          false,
+                          PreservedAnalyses::all(),
+                          InlinedInternalEdges,
+                          {}};
 
   // Request PassInstrumentation from analysis manager, will use it to run
   // instrumenting callbacks for the passes later.
@@ -1200,6 +1212,7 @@
       UR.CWorklist.insert(C);
       LLVM_DEBUG(dbgs() << "Enqueuing the existing SCC in the worklist: " << *C
                         << "\n");
+      UR.SkipCurrentC = true;
       // Enqueue in reverse order as we pop off the back of the worklist.
       for (SCC &MovedC : llvm::reverse(make_range(RC->begin() + InitialSCCIndex,
                                                   RC->begin() + NewSCCIndex))) {
Index: llvm/include/llvm/Analysis/CGSCCPassManager.h
===================================================================
--- llvm/include/llvm/Analysis/CGSCCPassManager.h
+++ llvm/include/llvm/Analysis/CGSCCPassManager.h
@@ -292,6 +292,8 @@
   /// post-order walk.
   LazyCallGraph::SCC *UpdatedC;
 
+  bool SkipCurrentC;
+
   /// Preserved analyses across SCCs.
   ///
   /// We specifically want to allow CGSCC passes to mutate ancestor IR


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97814.327605.patch
Type: text/x-patch
Size: 2385 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210302/0a032f9d/attachment.bin>


More information about the llvm-commits mailing list