Inlining: Run the legacy AlwaysInliner before the regular inliner.
authorAmara Emerson <amara@apple.com>
Thu, 9 Feb 2023 03:52:00 +0000 (19:52 -0800)
committerAmara Emerson <amara@apple.com>
Fri, 10 Feb 2023 00:49:29 +0000 (16:49 -0800)
commitcae033dcf227aeecf58fca5af6fc7fde1fd2fb4f
treea48a0df3feea2a252403a20a32a64a832e43eef5
parente6edc1bd69c881eabf78c439be7f42a639f0df79
Inlining: Run the legacy AlwaysInliner before the regular inliner.

We have several situations where it's beneficial for code size to ensure that every
call to always-inline functions are inlined before normal inlining decisions are
made. While the normal inliner runs in a "MandatoryOnly" mode to try to do this,
it only does it on a per-SCC basis, rather than the whole module. Ensuring that
all mandatory inlinings are done before any heuristic based decisions are made
just makes sense.

Despite being referred to the "legacy" AlwaysInliner pass, it's already necessary
for -O0 because the CGSCC inliner is too expensive in compile time to run at -O0.

This also fixes an exponential compile time blow up in
https://github.com/llvm/llvm-project/issues/59126

Differential Revision: https://reviews.llvm.org/D143624
14 files changed:
clang/test/CodeGen/code-coverage.c
clang/test/Frontend/optimization-remark-with-hotness-new-pm.c
clang/test/Headers/__clang_hip_math.hip
clang/test/OpenMP/bug57757.cpp
llvm/lib/Passes/PassBuilderPipelines.cpp
llvm/test/Other/new-pm-defaults.ll
llvm/test/Other/new-pm-print-pipeline.ll
llvm/test/Other/new-pm-thinlto-defaults.ll
llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
llvm/test/Transforms/Inline/always-inline-newpm.ll [new file with mode: 0644]
llvm/test/Transforms/PhaseOrdering/ARM/arm_mult_q15.ll