[PATCH] D152104: [LightAttributor] Run only as CFSCCPass.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 4 09:16:08 PDT 2023


fhahn created this revision.
Herald added subscribers: StephenFan, okura, hiraditya.
Herald added a project: All.
fhahn requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: sstefan1.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Depends on D152081 <https://reviews.llvm.org/D152081>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152104

Files:
  llvm/lib/Passes/PassBuilderPipelines.cpp


Index: llvm/lib/Passes/PassBuilderPipelines.cpp
===================================================================
--- llvm/lib/Passes/PassBuilderPipelines.cpp
+++ llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -257,6 +257,10 @@
     cl::desc(
         "Enable pass to eliminate conditions based on linear constraints"));
 
+static cl::opt<bool> UseLightAttributor("enable-light-attributor",
+                                        cl::init(true), cl::Hidden,
+                                        cl::desc(""));
+
 static cl::opt<AttributorRunOption> AttributorRun(
     "attributor-enable", cl::Hidden, cl::init(AttributorRunOption::NONE),
     cl::desc("Enable the attributor inter-procedural deduction pass"),
@@ -879,7 +883,11 @@
   // simplification pipeline, so this only needs to run when it could affect the
   // function simplification pipeline, which is only the case with recursive
   // functions.
-  MainCGPipeline.addPass(PostOrderFunctionAttrsPass(/*SkipNonRecursive*/ true));
+  if (UseLightAttributor)
+    MainCGPipeline.addPass(LightweightAttributorCGSCCPass());
+  else
+    MainCGPipeline.addPass(
+        PostOrderFunctionAttrsPass(/*SkipNonRecursive*/ true));
 
   // When at O3 add argument promotion to the pass pipeline.
   // FIXME: It isn't at all clear why this should be limited to O3.
@@ -901,7 +909,10 @@
 
   // Finally, deduce any function attributes based on the fully simplified
   // function.
-  MainCGPipeline.addPass(PostOrderFunctionAttrsPass());
+  if (UseLightAttributor)
+    MainCGPipeline.addPass(LightweightAttributorCGSCCPass());
+  else
+    MainCGPipeline.addPass(PostOrderFunctionAttrsPass());
 
   // Mark that the function is fully simplified and that it shouldn't be
   // simplified again if we somehow revisit it due to CGSCC mutations unless


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152104.528228.patch
Type: text/x-patch
Size: 1804 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230604/f4c81d32/attachment.bin>


More information about the llvm-commits mailing list