[PATCH] D31217: Disable loop unrolling and icp in SamplePGO ThinLTO compile phase
Dehao Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 21 14:55:36 PDT 2017
danielcdh created this revision.
Herald added subscribers: Prazek, mehdi_amini.
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.
https://reviews.llvm.org/D31217
Files:
lib/Transforms/IPO/PassManagerBuilder.cpp
Index: lib/Transforms/IPO/PassManagerBuilder.cpp
===================================================================
--- lib/Transforms/IPO/PassManagerBuilder.cpp
+++ lib/Transforms/IPO/PassManagerBuilder.cpp
@@ -435,6 +435,12 @@
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.
+ if (PrepareForThinLTO && !PGOSampleUse.empty())
+ DisableUnrollLoops = true;
+
if (!DisableUnitAtATime) {
// Infer attributes about declarations if possible.
MPM.add(createInferFunctionAttrsLegacyPass());
@@ -453,7 +459,10 @@
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 && !(PrepareForThinLTO && !PGOSampleUse.empty())) {
/// PGO instrumentation is added during the compile phase for ThinLTO, do
/// not run it a second time
addPGOInstrPasses(MPM);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31217.92556.patch
Type: text/x-patch
Size: 1339 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170321/2497f6e2/attachment.bin>
More information about the llvm-commits
mailing list