[llvm] [Sample Profile] Check hot callsite threshold when inlining a function with a sample profile (PR #93286)

via llvm-commits llvm-commits at lists.llvm.org
Fri May 24 16:48:59 PDT 2024


WenleiHe wrote:

> foo calls bar multiple times and each call site is calculated to be hot by the profile , bar itself contains many nested function calls that are inlined. bar is processed first and after inlining it becomes very large (> 50000 instructions), and foo still unconditionally inline every call to bar without a cost threshold check.

It sounds like it is about top-down run away inlining then. Usually top-down inlining needs to have a size budget/cap for the inliner, to avoid inlining many individually small callee and eventually bloating size too much. In the case of old sample loader inline, we don't have such cap because inlining is guaranteed to be bounded by the inlining done in the previous build. If we iteratively trace back to the first build, the inlining should come from non-PGO CGSCC inlining which is bounded due to bottom-up nature. 

So I still don't see what's unique in your case. 

> The reason that bar shows up previously inlined in the profile is that another function calling bar could be processed before bar itself's inlining, and at this point its instruction count is still small

So in previous build, the inlining happened also because of top-down order? Then it goes back to my comment above. 

https://github.com/llvm/llvm-project/pull/93286


More information about the llvm-commits mailing list