[llvm] 42ad7e1 - [CSSPGO] Turn off PseudoProbeUpdatePass for non-FDO builds.

Hongtao Yu via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 14 17:29:32 PDT 2021


Author: Hongtao Yu
Date: 2021-10-14T17:12:49-07:00
New Revision: 42ad7e1bc9088d73d87e19c87c69aa4c3434f3c9

URL: https://github.com/llvm/llvm-project/commit/42ad7e1bc9088d73d87e19c87c69aa4c3434f3c9
DIFF: https://github.com/llvm/llvm-project/commit/42ad7e1bc9088d73d87e19c87c69aa4c3434f3c9.diff

LOG: [CSSPGO] Turn off PseudoProbeUpdatePass for non-FDO builds.

PseudoProbeUpdatePass is used to distribute sample counts among dulplicated probes.  It doesn't make sense for it to run without a sample profile. The pass takes 1% of the build time.

Reviewed By: wenlei

Differential Revision: https://reviews.llvm.org/D111847

Added: 
    

Modified: 
    llvm/lib/Passes/PassBuilderPipelines.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index 3028be41d81b..7e694cf7e2fb 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -1202,7 +1202,8 @@ PassBuilder::buildPerModuleDefaultPipeline(OptimizationLevel Level,
   // Now add the optimization pipeline.
   MPM.addPass(buildModuleOptimizationPipeline(Level, LTOPreLink));
 
-  if (PGOOpt && PGOOpt->PseudoProbeForProfiling)
+  if (PGOOpt && PGOOpt->PseudoProbeForProfiling &&
+      PGOOpt->Action == PGOOptions::SampleUse)
     MPM.addPass(PseudoProbeUpdatePass());
 
   // Emit annotation remarks.
@@ -1258,7 +1259,8 @@ PassBuilder::buildThinLTOPreLinkDefaultPipeline(OptimizationLevel Level) {
   // on these, we schedule the cleanup here.
   MPM.addPass(createModuleToFunctionPassAdaptor(CoroCleanupPass()));
 
-  if (PGOOpt && PGOOpt->PseudoProbeForProfiling)
+  if (PGOOpt && PGOOpt->PseudoProbeForProfiling &&
+      PGOOpt->Action == PGOOptions::SampleUse)
     MPM.addPass(PseudoProbeUpdatePass());
 
   // Handle OptimizerLastEPCallbacks added by clang on PreLink. Actual


        


More information about the llvm-commits mailing list