[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 15:17:02 PDT 2017


danielcdh added inline comments.


================
Comment at: lib/Transforms/IPO/PassManagerBuilder.cpp:464
+  // 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())) {
----------------
mehdi_amini wrote:
> That makes me worried in some way: we're not expecting ICP and SamplePGO to be complementary from each other?
Let me try to clarify here.

* ICP is invoked twice in thinlto: once in compile phase to cover intra-module promotion, another in backend to handle inter-module promotion. The first icp is aiming at reduce callgraph size thus reduce the thinlink burden, but it's not required.
* SamplePGO do interacts a lot with ICP. If an indirect call is inlined in the profile, then before annotation, we need to promote it and inline it as well. This is done before the profile annotation. But after the profile annotation, when we find more ICP opportunities, it will simply use the legacy ICP pass.

So in this patch, instead of invoking legacy ICP pass twice, we only invoke it once in backend if it is samplepgo+thinlto build.


https://reviews.llvm.org/D31217





More information about the llvm-commits mailing list