[PM] Run IndirectCallPromotion only when PGO is enabled.

Differential Revision:  https://reviews.llvm.org/D32465

llvm-svn: 301327
This commit is contained in:
Davide Italiano 2017-04-25 16:54:45 +00:00
parent 7603dce6b2
commit 058abf1f61
1 changed files with 9 additions and 9 deletions

View File

@ -282,6 +282,12 @@ void PassManagerBuilder::addPGOInstrPasses(legacy::PassManagerBase &MPM) {
} }
if (!PGOInstrUse.empty()) if (!PGOInstrUse.empty())
MPM.add(createPGOInstrumentationUseLegacyPass(PGOInstrUse)); MPM.add(createPGOInstrumentationUseLegacyPass(PGOInstrUse));
// Indirect call promotion that promotes intra-module targets only.
// For ThinLTO this is done earlier due to interactions with globalopt
// for imported functions. We don't run this at -O0.
if (OptLevel > 0)
MPM.add(
createPGOIndirectCallPromotionLegacyPass(false, !PGOSampleUse.empty()));
} }
void PassManagerBuilder::addFunctionSimplificationPasses( void PassManagerBuilder::addFunctionSimplificationPasses(
legacy::PassManagerBase &MPM) { legacy::PassManagerBase &MPM) {
@ -471,16 +477,10 @@ void PassManagerBuilder::populateModulePassManager(
// For SamplePGO in ThinLTO compile phase, we do not want to do indirect // For SamplePGO in ThinLTO compile phase, we do not want to do indirect
// call promotion as it will change the CFG too much to make the 2nd // call promotion as it will change the CFG too much to make the 2nd
// profile annotation in backend more difficult. // profile annotation in backend more difficult.
if (!PerformThinLTO && !PrepareForThinLTOUsingPGOSampleProfile) { // PGO instrumentation is added during the compile phase for ThinLTO, do
/// PGO instrumentation is added during the compile phase for ThinLTO, do // not run it a second time
/// not run it a second time if (!PerformThinLTO && !PrepareForThinLTOUsingPGOSampleProfile)
addPGOInstrPasses(MPM); addPGOInstrPasses(MPM);
// Indirect call promotion that promotes intra-module targets only.
// For ThinLTO this is done earlier due to interactions with globalopt
// for imported functions.
MPM.add(
createPGOIndirectCallPromotionLegacyPass(false, !PGOSampleUse.empty()));
}
if (EnableNonLTOGlobalsModRef) if (EnableNonLTOGlobalsModRef)
// We add a module alias analysis pass here. In part due to bugs in the // We add a module alias analysis pass here. In part due to bugs in the