summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorDehao Chen <dehao@google.com>2017-03-23 21:20:05 +0000
committerDehao Chen <dehao@google.com>2017-03-23 21:20:05 +0000
commit8c88671985d716c4da49e592a77443ea65cbf2f0 (patch)
treea6f3008e6dc285ca0041b32b1e9e6f693b709db6 /llvm
parent63dee972182d32080d509e343e1408a78a59d27b (diff)
downloadbcm5719-llvm-8c88671985d716c4da49e592a77443ea65cbf2f0.tar.gz
bcm5719-llvm-8c88671985d716c4da49e592a77443ea65cbf2f0.zip
Disable loop unrolling and icp in SamplePGO ThinLTO compile phase
Summary: loop unrolling and icp will make the sample profile annotation much harder in the backend. So disable these 2 optimization in the ThinLTO compile phase. Will add a test in cfe in a separate patch. Reviewers: tejohnson Reviewed By: tejohnson Subscribers: mehdi_amini, llvm-commits, Prazek Differential Revision: https://reviews.llvm.org/D31217 llvm-svn: 298646
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Transforms/IPO/PassManagerBuilder.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
index 734f81b0877..b07b7d1b5ff 100644
--- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
+++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
@@ -435,6 +435,14 @@ void PassManagerBuilder::populateModulePassManager(
MPM.add(createPGOIndirectCallPromotionLegacyPass(/*InLTO = */ true,
!PGOSampleUse.empty()));
+ // For SamplePGO in ThinLTO compile phase, we do not want to unroll loops
+ // as it will change the CFG too much to make the 2nd profile annotation
+ // in backend more difficult.
+ bool PrepareForThinLTOUsingPGOSampleProfile =
+ PrepareForThinLTO && !PGOSampleUse.empty();
+ if (PrepareForThinLTOUsingPGOSampleProfile)
+ DisableUnrollLoops = true;
+
if (!DisableUnitAtATime) {
// Infer attributes about declarations if possible.
MPM.add(createInferFunctionAttrsLegacyPass());
@@ -453,7 +461,10 @@ void PassManagerBuilder::populateModulePassManager(
MPM.add(createCFGSimplificationPass()); // Clean up after IPCP & DAE
}
- if (!PerformThinLTO) {
+ // 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
+ // profile annotation in backend more difficult.
+ if (!PerformThinLTO && !PrepareForThinLTOUsingPGOSampleProfile) {
/// PGO instrumentation is added during the compile phase for ThinLTO, do
/// not run it a second time
addPGOInstrPasses(MPM);
OpenPOWER on IntegriCloud