diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -257,6 +257,10 @@ cl::desc( "Enable pass to eliminate conditions based on linear constraints")); +static cl::opt UseLightAttributor("enable-light-attributor", + cl::init(true), cl::Hidden, + cl::desc("")); + static cl::opt 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