diff options
author | Xin Tong <trent.xin.tong@gmail.com> | 2018-11-15 18:06:42 +0000 |
---|---|---|
committer | Xin Tong <trent.xin.tong@gmail.com> | 2018-11-15 18:06:42 +0000 |
commit | 642c8d35755887b2c06cb589371c0c13b3530ad7 (patch) | |
tree | 826710d188b86d4b3f1cea385c57088eb3c44afb /llvm/lib/Passes/PassBuilder.cpp | |
parent | 924f1934190691a2eca6e8f6a0f0be25ba61bb7f (diff) | |
download | bcm5719-llvm-642c8d35755887b2c06cb589371c0c13b3530ad7.tar.gz bcm5719-llvm-642c8d35755887b2c06cb589371c0c13b3530ad7.zip |
[LTO] Load sample profile in LTO link step.
Summary:
Load sample profile in LTO link step.
ThinLTO calls populateModulePassManager to load the profile
Reviewers: tejohnson, davidxl, danielcdh
Subscribers: mehdi_amini, inglorion, steven_wu, dexonsmith, llvm-commits
Differential Revision: https://reviews.llvm.org/D54564
llvm-svn: 346971
Diffstat (limited to 'llvm/lib/Passes/PassBuilder.cpp')
-rw-r--r-- | llvm/lib/Passes/PassBuilder.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index 33f74cfd9ed..d6c6413986e 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -1004,6 +1004,13 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level, bool DebugLogging, assert(Level != O0 && "Must request optimizations for the default pipeline!"); ModulePassManager MPM(DebugLogging); + if (PGOOpt && !PGOOpt->SampleProfileFile.empty()) { + // Load sample profile before running the LTO optimization pipeline. + MPM.addPass(SampleProfileLoaderPass(PGOOpt->SampleProfileFile, + PGOOpt->ProfileRemappingFile, + false /* ThinLTOPhase::PreLink */)); + } + // Remove unused virtual tables to improve the quality of code generated by // whole-program devirtualization and bitset lowering. MPM.addPass(GlobalDCEPass()); |