[PATCH] D17864: [PGO] Promote indirect calls to conditional direct calls with value-profile

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 6 13:23:45 PDT 2016


> On Apr 6, 2016, at 1:12 PM, Rong Xu <xur at google.com> wrote:
> 
> 
> 
> On Wed, Apr 6, 2016 at 12:46 PM, Mehdi AMINI <mehdi.amini at apple.com <mailto:mehdi.amini at apple.com>> wrote:
> joker.eph added inline comments.
> 
> ================
> Comment at: lib/Transforms/IPO/PassManagerBuilder.cpp:383
> @@ -380,1 +382,3 @@
> +    MPM.add(createPGOIndirectCallPromotionPass());
> +  }
> 
> ----------------
> Why is it running twice in LTO mode?
> The first one is for intra module promotions. The second one is for cross module promotion.
> The idea is to run as many promotions in pre lto compilation (until we see a cross module target -- the targets are sorted based on the counts). I think this will save compile time for parallel build. 

But do you get the same result?
I think I’ll have to dive into “how it actually works under the hood” to understand.

In any case: document this for the second insertion in the PassManage Builder.


> 
> ================
> Comment at: lib/Transforms/IPO/PassManagerBuilder.cpp:588
> @@ -583,1 +587,3 @@
> 
> +  // Indirect call promotion. (xur)
> +  PM.add(createPGOIndirectCallPromotionPass(true));
> ----------------
> What is the meaning of the "xur" here?
> 
> Should be removed.  
> 
> ================
> Comment at: lib/Transforms/Instrumentation/IndirectCallPromotion.cpp:534
> @@ +533,3 @@
> +
> +bool PGOIndirectCallPromotion::runOnModule(Module &M) {
> +  if (DisableICP)
> ----------------
> Can you implement this in a utility function? I expect the "pass wrapper" to have a dummy runOnModule that would only call the public API.
> Sorry, can you explain a little more? 
> Do you mean I move the current in current runOnModule to a static function and call it from runOnModule?


Yes: decoupling pass registration and interaction with the pass manager from the "utility as a library”.
If needed we should just have to promote the static function to a non-static to have a public API for anything.
It also reduces the cost of any port to the new pass-manager.

— 
Mehdi

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160406/80f89f40/attachment.html>


More information about the llvm-commits mailing list