[llvm] [FunctionAttrs] deduce attr `cold` on functions if all CG paths call a `cold` function (PR #101298)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 14:05:42 PDT 2024


goldsteinn wrote:

> > LGTM
> > I looked at some cases where code size increases with this patch, and the effect is basically that we don't inline an error handling path, and that reduces the size of a function below the inlining threshold, so it gets inlined (a lot more) in turn. Overall effect is undesirable, but the decisions are all locally reasonable.
> 
> The stats had less total inlining w/ this patch.
> 
> ```diff
> -           27730 inline                       - Number of functions deleted because all callers found
> -          106114 inline                       - Number of functions inlined
> -          132759 inline-cost                  - Number of call sites analyzed
> +           27703 inline                       - Number of functions deleted because all callers found
> +          105963 inline                       - Number of functions inlined
> +          132883 inline-cost                  - Number of call sites analyzed
> ```
> 
> Before I push this, Ill add a stat for total number of callsites inlined which AFAICT is: `IFI.InlinedCallSites.size()` as that is probably a useful metric. Edit: I understand incorrectly. Is `NumInlined` not tracking total number of callsites?

Put a stat in `InlineFunction` and see the same trend.

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


More information about the llvm-commits mailing list