Hi all,

Just a gentle ping on this patch.

Regards,
Eldar.

On 7/24/26 16:22, Eldar Osmanovic wrote:
> This revision substantially reworks the previous proposal for allowing
> limited inlining growth under -Os.
>
> The v3 patch introduced two new inliner parameters. Following the
> review feedback that the inliner already has too many tuning knobs, v4
> removes both parameters and instead uses the existing distinction
> between -Os and -Oz.
>
> Both -Os and -Oz enable optimize_size, which makes the generic
> callgraph hotness predicate reject all such edges as hot. This revision
> leaves that predicate unchanged because it is also used by IPA
> transformations unrelated to inlining. Instead, it introduces an
> inliner-local decision for OPTIMIZE_SIZE_BALANCED (-Os).
>
> Under -Os, positive growth is permitted only when reliable PGO or
> AutoFDO feedback identifies the call as hot and big_speedup_p predicts
> a significant benefit. Calls that are probably never executed are
> rejected, growth is bounded by the existing automatic inlining limit,
> and simple tail-position calls are excluded. -Oz, -Os without profile
> feedback, and non-size optimization modes retain their existing
> behavior. No new inliner parameters are introduced.
>
> The CoreMark-Pro workloads were analyzed to determine whether each
> patch-induced inline occurred inside the timed kernel or only in setup
> and support code. The core workload was the only workload where the
> patch introduced an additional inline on a path inside the timed kernel:
>
>          crcu8 -> crcu16
>
> Other workloads either had no patch-induced inlining in their timed
> kernels or differed only in shared setup and support code outside the
> measured region. For example, an additional inline involving
> random_u32 and random_u8_vector occurred in input-generation code rather
> than in a timed workload kernel. Their scores are therefore not used
> as evidence for the direct performance benefit of this inlining decision.
>
> The affected CoreMark-Pro core workload produced the following result:
>
> Target         Speedup        Final .text change
> x86_64          +0.50 %          0 bytes
> RISC-V          +0.32 %         +4 bytes (+0.0009 %)
> MIPS            +0.11 %        -16 bytes (-0.0026 %)
>
> All results were optained with CoreMark-Pro's core worklaod compiled
> with -Os and PGO. The baseline and patched compilers used identical
> compiler options and equivalent profile-training inputs. Final performance
> measurments were run natively. The x86_64 measurments were performed on an
> Intel Core i5-11500H, RISC-V measurments on a P8700 Boston board,
> and MIPS measurments on a Cavium Octeon+ V0.1 processor.
>
> To isolate the local effect of the newly permitted inline, I also used
> a PGO microbenchmark whose measured loop is intentionally dominated by
> the affected crcu16 call. It produced the following local speedups:
> +9.43 % for x86_64, +6.00 % for RISC-V and +25.00 % for MIPS. The
> microbenchmark results are intentionally isolated best-case results
> and should not be interpreted as suite-wide or general compiler
> performance improvements. These measurments were also performed natively.
>
> This work originated from the MIPS GCC patch c38d7e548cbb, but v4
> is a substantial rewrite in response to review.
>
> Changes in v4:
>          - Removed early-inlining-insns cold and
>            max-inline-insns-small-and-cold.
>          - Kept cgraph_edge::maybe_hot_p unchanged and scoped the new
>            behavior to the inliner.
>          - Distinguished -Os from -Oz using OPTIMIZE_SIZE_BALANCED.
>          - Required reliable profile hotness and big_speedup_p.
>          - Rejected probably-never-executed ant tail-position calls.
>          - Replaced the parameter-based tests with tests for -Os without a
>            profile, -Os with PGO, profile-cold calls , tail calls and -Oz.
>
> Link to v3:
> https://sourceware.org/pipermail/gcc-patches/2026-June/720810.html
>
> Eldar Osmanovic (1):
>    Possible inlining improvements with -Os
>
>   gcc/ipa-inline.cc                             | 134 +++++++++++++++++-
>   .../gcc.dg/ipa/inline-os-no-profile-1.c       |  24 ++++
>   .../gcc.dg/tree-prof/inline-os-pgo-1.c        |  33 +++++
>   .../gcc.dg/tree-prof/inline-os-pgo-cold-1.c   |  34 +++++
>   .../gcc.dg/tree-prof/inline-os-pgo-tail-1.c   |  32 +++++
>   .../gcc.dg/tree-prof/inline-oz-pgo-1.c        |  33 +++++
>   6 files changed, 287 insertions(+), 3 deletions(-)
>   create mode 100644 gcc/testsuite/gcc.dg/ipa/inline-os-no-profile-1.c
>   create mode 100644 gcc/testsuite/gcc.dg/tree-prof/inline-os-pgo-1.c
>   create mode 100644 gcc/testsuite/gcc.dg/tree-prof/inline-os-pgo-cold-1.c
>   create mode 100644 gcc/testsuite/gcc.dg/tree-prof/inline-os-pgo-tail-1.c
>   create mode 100644 gcc/testsuite/gcc.dg/tree-prof/inline-oz-pgo-1.c
>

Reply via email to