[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
This commit is contained in:
Hongtao Yu 2021-10-14 11:37:44 -07:00
parent a1e78aee66
commit 42ad7e1bc9
1 changed files with 4 additions and 2 deletions

View File

@ -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