[llvm] [InlineCost] Enable the cost benefit analysis for Sample PGO (PR #66457)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 18 17:58:03 PDT 2023


HaohaiWen wrote:

> Thank you for the patch. Do you have any details you can share? Performance numbers?
> 
> With sample profiling, a lot of inlining is done in the sample profile loader. Do you you see meaningful inlining opportunities left for `llvm/lib/Transforms/IPO/Inliner.cpp` for large applications, such as clang?

```
caller:
  1: 10
  3: 500
  5: callee : 500
  10: 10
```
Given this simple example sample profile file, callee was not inlined when we collected profile file.
If I recall correctly, Sample Loader pass only inline a function if it was inlined when collecting profile file. In this case, callee will not be inlined by Sample Loader pass.
The InlinerPass will then try to analyze inline cost for callee. If it is IPGO, cost benefit analysis is done, and the profile result is used to determine whether callee should be inlined. Without this patch, for SPGO, InlinerPass only uses its internal heuristic to analyze cost. Inline result for callee should be same as the version before doing SPGO. This is what we found on our internal experiment.
  


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


More information about the llvm-commits mailing list