]> git.ipfire.org Git - thirdparty/gcc.git/commit
Enable early inlining into always_inline functions
authorJan Hubicka <jh@suse.cz>
Wed, 28 Jun 2023 21:05:28 +0000 (23:05 +0200)
committerJan Hubicka <jh@suse.cz>
Wed, 28 Jun 2023 21:06:18 +0000 (23:06 +0200)
commitd88fd2e1d0720e6f892da9ff48e9a301a7ad0ad4
treecc88e993b5c20eb13f41e991dbb43e6bfc77ade8
parent8736d6b14a4dfdfb58c80ccd398981b0fb5d00aa
Enable early inlining into always_inline functions

Early inliner currently skips always_inline functions and moreover we ignore
calls from always_inline in ipa_reverse_postorder.  This leads to disabling
most of propagation done using early optimization that is quite bad when
early inline functions are not leaf functions, which is now quite common
in libstdc++.

This patch instead of fully disabling the inline checks calls in callee.
I am quite conservative about what can be inlined as this patch is bit
touchy anyway.  To avoid problems with always_inline being optimized
after early inline I extended inline_always_inline_functions to lazilly
compute fnsummary when needed.

gcc/ChangeLog:

PR middle-end/110334
* ipa-fnsummary.h (ipa_fn_summary): Add
safe_to_inline_to_always_inline.
* ipa-inline.cc (can_early_inline_edge_p): ICE
if SSA is not built; do cycle checking for
always_inline functions.
(inline_always_inline_functions): Be recrusive;
watch for cycles; do not updat overall summary.
(early_inliner): Do not give up on always_inlines.
* ipa-utils.cc (ipa_reverse_postorder): Do not skip
always inlines.

gcc/testsuite/ChangeLog:

PR middle-end/110334
* g++.dg/opt/pr66119.C: Disable early inlining.
* gcc.c-torture/compile/pr110334.c: New test.
* gcc.dg/tree-ssa/pr110334.c: New test.
gcc/ipa-fnsummary.h
gcc/ipa-inline.cc
gcc/ipa-utils.cc
gcc/testsuite/g++.dg/opt/pr66119.C
gcc/testsuite/gcc.c-torture/compile/pr110334.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/pr110334.c [new file with mode: 0644]