[llvm] a952d72 - [SampleFDO] Skip PreLink ICP for better profile quality of MonoLTO PostLink
Wenlei He via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 19 19:37:53 PST 2021
Author: Wenlei He
Date: 2021-02-19T19:35:23-08:00
New Revision: a952d7291e99aded397073f61e091c0f011da779
URL: https://github.com/llvm/llvm-project/commit/a952d7291e99aded397073f61e091c0f011da779
DIFF: https://github.com/llvm/llvm-project/commit/a952d7291e99aded397073f61e091c0f011da779.diff
LOG: [SampleFDO] Skip PreLink ICP for better profile quality of MonoLTO PostLink
For ThinLTO, PreLink ICP is skipped to favor better profile annotation during LTO PostLink. This change applies the same tweak for MonoLTO. Note that PreLink ICP not only makes PostLink profile annotation harder, it is also uncoordinated with PostLink ICP so duplicated ICP could happen.
Differential Revision: https://reviews.llvm.org/D97028
Added:
Modified:
llvm/lib/Passes/PassBuilder.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index 1e75690d554d..c3f9c7e0903f 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -1081,15 +1081,16 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
// Cache ProfileSummaryAnalysis once to avoid the potential need to insert
// RequireAnalysisPass for PSI before subsequent non-module passes.
MPM.addPass(RequireAnalysisPass<ProfileSummaryAnalysis, Module>());
- // Do not invoke ICP in the ThinLTOPrelink phase as it makes it hard
- // for the profile annotation to be accurate in the ThinLTO backend.
- if (Phase != ThinOrFullLTOPhase::ThinLTOPreLink)
+ // Do not invoke ICP in the LTOPrelink phase as it makes it hard
+ // for the profile annotation to be accurate in the LTO backend.
+ if (Phase != ThinOrFullLTOPhase::ThinLTOPreLink &&
+ Phase != ThinOrFullLTOPhase::FullLTOPreLink)
// We perform early indirect call promotion here, before globalopt.
// This is important for the ThinLTO backend phase because otherwise
// imported available_externally functions look unreferenced and are
// removed.
- MPM.addPass(PGOIndirectCallPromotion(
- Phase == ThinOrFullLTOPhase::ThinLTOPostLink, true /* SamplePGO */));
+ MPM.addPass(
+ PGOIndirectCallPromotion(true /* IsInLTO */, true /* SamplePGO */));
}
if (AttributorRun & AttributorRunOption::MODULE)
More information about the llvm-commits
mailing list