[PATCH] D99370: [CSSPGO] Minor tweak for inline candidate priority tie breaker

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 25 16:54:00 PDT 2021


hoy accepted this revision.
hoy added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/lib/Transforms/IPO/SampleProfile.cpp:329
+    // Tie breaker using number of samples try to favor smaller functions first
+    if (LCS->getBodySamples().size() != RCS->getBodySamples().size())
+      return LCS->getBodySamples().size() > RCS->getBodySamples().size();
----------------
wenlei wrote:
> wenlei wrote:
> > hoy wrote:
> > > Would it make sense to compare callee function size instead?
> > Called that out in the change description. :)  
> Actually let me expand on this. Currently we don't retrieve callee functions when collecting candidate, we retrieve callee function when evaluating inline decisions. 
> 
> We could alternatively retrieve callee functions earlier, but then we could also just run inline cost on it earlier and use that as 1st tier breaker? 
> 
> There're definitely ways to get to more accurate prioritization, but until we know it is actually helping visibly, I'm trying to keep it simple by making a local change to have a better tie breaker than using names. 
I see. Callees can be retrievable after indirect promotion is done. Might be a bit late. Using profile sample size sounds good for now.  


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99370/new/

https://reviews.llvm.org/D99370



More information about the llvm-commits mailing list