diff options
author | Dehao Chen <dehao@google.com> | 2017-02-23 22:15:18 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2017-02-23 22:15:18 +0000 |
commit | 8580d5005b7d2aacf66e81079625dfd64d1d775f (patch) | |
tree | d0eaf3a07d8885728a122afa2b94a2d2ce9531b4 /lib/Passes | |
parent | 9bb4f10172a963415d97576498c60af4d8b3db61 (diff) |
Add call branch annotation for ICP promoted direct call in SamplePGO mode.
Summary: SamplePGO uses branch_weight annotation to represent callsite hotness. When ICP promotes an indirect call to direct call, we need to make sure the direct call is annotated with branch_weight in SamplePGO mode, so that downstream function inliner can use hot callsite heuristic.
Reviewers: davidxl, eraman, xur
Reviewed By: davidxl, xur
Subscribers: mehdi_amini, llvm-commits
Differential Revision: https://reviews.llvm.org/D30282
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296028 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Passes')
-rw-r--r-- | lib/Passes/PassBuilder.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Passes/PassBuilder.cpp b/lib/Passes/PassBuilder.cpp index 6f41109dd0a6..ac77b1d511bf 100644 --- a/lib/Passes/PassBuilder.cpp +++ b/lib/Passes/PassBuilder.cpp @@ -486,13 +486,14 @@ PassBuilder::buildPerModuleDefaultPipeline(OptimizationLevel Level, // Add all the requested passes for PGO Instrumentation, if requested. if (PGOOpt) { - assert(PGOOpt->RunProfileGen || !PGOOpt->ProfileUseFile.empty()); + assert(PGOOpt->RunProfileGen || PGOOpt->SamplePGO || + !PGOOpt->ProfileUseFile.empty()); addPGOInstrPasses(MPM, DebugLogging, Level, PGOOpt->RunProfileGen, PGOOpt->ProfileGenFile, PGOOpt->ProfileUseFile); } // Indirect call promotion that promotes intra-module targes only. - MPM.addPass(PGOIndirectCallPromotion()); + MPM.addPass(PGOIndirectCallPromotion(false, PGOOpt && PGOOpt->SamplePGO)); // Require the GlobalsAA analysis for the module so we can query it within // the CGSCC pipeline. @@ -665,7 +666,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 */)); + MPM.addPass(PGOIndirectCallPromotion(true /* InLTO */, + PGOOpt && PGOOpt->SamplePGO)); // Propagate constants at call sites into the functions they call. This // opens opportunities for globalopt (and inlining) by substituting function |