summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Passes
diff options
context:
space:
mode:
authorDehao Chen <dehao@google.com>2017-06-29 23:33:05 +0000
committerDehao Chen <dehao@google.com>2017-06-29 23:33:05 +0000
commit2f31d0d86e924c95b4b4ff3d2c7b165204ebaa9a (patch)
treef7f96182ee8bff2695964cbbcd98f9c44b3b5fc3 /llvm/lib/Passes
parent56f481b78e4f3abee9d51e892d9b7618d58f7085 (diff)
downloadbcm5719-llvm-2f31d0d86e924c95b4b4ff3d2c7b165204ebaa9a.tar.gz
bcm5719-llvm-2f31d0d86e924c95b4b4ff3d2c7b165204ebaa9a.zip
Hook the sample PGO machinery in the new PM
Summary: This patch hooks up SampleProfileLoaderPass with the new PM. Reviewers: chandlerc, davidxl, davide, tejohnson Reviewed By: chandlerc, tejohnson Subscribers: tejohnson, llvm-commits, sanjoy Differential Revision: https://reviews.llvm.org/D34720 llvm-svn: 306763
Diffstat (limited to 'llvm/lib/Passes')
-rw-r--r--llvm/lib/Passes/PassBuilder.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index bc73cdda88b..0380bd991d7 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -535,13 +535,17 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
// Add all the requested passes for PGO, if requested.
if (PGOOpt) {
- assert(PGOOpt->RunProfileGen || PGOOpt->SamplePGO ||
+ assert(PGOOpt->RunProfileGen || !PGOOpt->SampleProfileFile.empty() ||
!PGOOpt->ProfileUseFile.empty());
- addPGOInstrPasses(MPM, DebugLogging, Level, PGOOpt->RunProfileGen,
- PGOOpt->ProfileGenFile, PGOOpt->ProfileUseFile);
+ if (PGOOpt->SampleProfileFile.empty())
+ addPGOInstrPasses(MPM, DebugLogging, Level, PGOOpt->RunProfileGen,
+ PGOOpt->ProfileGenFile, PGOOpt->ProfileUseFile);
+ else
+ MPM.addPass(SampleProfileLoaderPass(PGOOpt->SampleProfileFile));
// Indirect call promotion that promotes intra-module targes only.
- MPM.addPass(PGOIndirectCallPromotion(false, PGOOpt && PGOOpt->SamplePGO));
+ MPM.addPass(PGOIndirectCallPromotion(
+ false, PGOOpt && !PGOOpt->SampleProfileFile.empty()));
}
// Require the GlobalsAA analysis for the module so we can query it within
@@ -776,9 +780,9 @@ PassBuilder::buildThinLTODefaultPipeline(OptimizationLevel Level,
// During the ThinLTO backend phase we perform early indirect call promotion
// here, before globalopt. Otherwise imported available_externally functions
// look unreferenced and are removed.
- MPM.addPass(PGOIndirectCallPromotion(true /* InLTO */,
- PGOOpt && PGOOpt->SamplePGO &&
- !PGOOpt->ProfileUseFile.empty()));
+ MPM.addPass(PGOIndirectCallPromotion(
+ true /* InLTO */, PGOOpt && !PGOOpt->SampleProfileFile.empty() &&
+ !PGOOpt->ProfileUseFile.empty()));
// Add the core simplification pipeline.
MPM.addPass(buildModuleSimplificationPipeline(Level, DebugLogging));
@@ -818,8 +822,8 @@ ModulePassManager PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,
// left by the earlier promotion pass that promotes intra-module targets.
// This two-step promotion is to save the compile time. For LTO, it should
// produce the same result as if we only do promotion here.
- MPM.addPass(PGOIndirectCallPromotion(true /* InLTO */,
- PGOOpt && PGOOpt->SamplePGO));
+ MPM.addPass(PGOIndirectCallPromotion(
+ true /* InLTO */, PGOOpt && !PGOOpt->SampleProfileFile.empty()));
// Propagate constants at call sites into the functions they call. This
// opens opportunities for globalopt (and inlining) by substituting function
OpenPOWER on IntegriCloud