[llvm][inliner] Reuse the inliner pass to implement 'always inliner'
authorMircea Trofin <mtrofin@google.com>
Mon, 16 Nov 2020 22:01:53 +0000 (14:01 -0800)
committerMircea Trofin <mtrofin@google.com>
Mon, 30 Nov 2020 20:03:39 +0000 (12:03 -0800)
commit5fe10263ab39be96e316f37272b85a72596a7928
tree9cd42685a6c1c338363e12131380bfefd2e2048a
parentb5f23189fb051e720d43f8a80c09038d4860b8a1
[llvm][inliner] Reuse the inliner pass to implement 'always inliner'

Enable performing mandatory inlinings upfront, by reusing the same logic
as the full inliner, instead of the AlwaysInliner. This has the
following benefits:
- reduce code duplication - one inliner codebase
- open the opportunity to help the full inliner by performing additional
function passes after the mandatory inlinings, but before th full
inliner. Performing the mandatory inlinings first simplifies the problem
the full inliner needs to solve: less call sites, more contextualization, and,
depending on the additional function optimization passes run between the
2 inliners, higher accuracy of cost models / decision policies.

Note that this patch does not yet enable much in terms of post-always
inline function optimization.

Differential Revision: https://reviews.llvm.org/D91567
24 files changed:
clang/test/CodeGen/thinlto-distributed-newpm.ll
clang/test/Frontend/optimization-remark-line-directive.c
clang/test/Frontend/optimization-remark-new-pm.c
clang/test/Frontend/optimization-remark-with-hotness-new-pm.c
clang/test/Frontend/optimization-remark.c
llvm/include/llvm/Analysis/InlineAdvisor.h
llvm/include/llvm/Passes/PassBuilder.h
llvm/lib/Analysis/InlineAdvisor.cpp
llvm/lib/Analysis/MLInlineAdvisor.cpp
llvm/lib/Passes/PassBuilder.cpp
llvm/lib/Passes/PassRegistry.def
llvm/lib/Transforms/IPO/Inliner.cpp
llvm/test/Other/new-pm-defaults.ll
llvm/test/Other/new-pm-lto-defaults.ll
llvm/test/Other/new-pm-module-inliner-wrapper.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/ML/bounds-checks-rewards.ll
llvm/test/Transforms/Inline/ML/bounds-checks.ll
llvm/test/Transforms/Inline/inline_stats.ll
llvm/test/Transforms/Inline/pr46945.ll