https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103989

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to hubicka from comment #8)
> > You can not disable an IPA pass becasuse then we will mishandle
> > optimize attributes.  I think you simply want to set
> > 
> > flag_inline_small_functions = 0
> > flag_inline_functions_called_once = 0 

I'm doing the above.

> Actually I forgot, we have flag_no_inline which makes
> tree_inlinable_function_p to return false for everything except for
> ALWAYS_INLINE and so we only want to set this one for Og.

And I'm intentionally not doing this because -Og should still remove
abstraction during early inlining (for functions marked 'inline'), we
just don't want to spend the extra compile time doing IPA inlining
or cleaning up after IPA inlining.

As can be seen with the testcase there are 5 calls inlined at IPA time
still (and 47 in early inlining):

> grep optimized: t.C.083i.inline 
/home/rguenther/install/gcc-12/usr/local/include/c++/12.0.0/optional:703:11:
optimized:  Inlined constexpr std::_Optional_base<_Tp, <anonymous>, <anonymous>
>::_Optional_base(const std::_Optional_base<_Tp, <anonymous>, <anonymous> >&)
[with _Tp = A; bool <anonymous> = false; bool <anonymous> = false]/387 into int
main()/360 which now has time 34.125000 and size 17, net change of -7.
/home/rguenther/install/gcc-12/usr/local/include/c++/12.0.0/bits/shared_ptr_base.h:785:26:
optimized:  Inlined void std::_Sp_counted_base<_Lp>::_M_add_ref_copy() [with
__gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]/459 into A::A(const A&)/453
which now has time 13.010361 and size 17, net change of -6.
/home/rguenther/install/gcc-12/usr/local/include/c++/12.0.0/bits/shared_ptr_base.h:196:28:
optimized:  Inlined void std::_Sp_counted_base<_Lp>::_M_release_last_use()
[with __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]/416 into void
std::_Sp_counted_base<_Lp>::_M_release_last_use_cold() [with
__gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]/367 which now has time
33.410000 and size 23, net change of -7.
/home/rguenther/install/gcc-12/usr/local/include/c++/12.0.0/bits/stl_construct.h:119:7:
optimized:  Inlined A::A(const A&)/453 into constexpr std::_Optional_base<_Tp,
<anonymous>, <anonymous> >::_Optional_base(const std::_Optional_base<_Tp,
<anonymous>, <anonymous> >&) [with _Tp = A; bool <anonymous> = false; bool
<anonymous> = false]/387 which now has time 32.808419 and size 11, net change
of -9.
/home/rguenther/install/gcc-12/usr/local/include/c++/12.0.0/bits/shared_ptr_base.h:778:21:
optimized:  Inlined void std::_Sp_counted_base<_Lp>::_M_release() [with
__gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]/272 into constexpr void
std::_Optional_payload_base<_Tp>::_M_reset() [with _Tp = A]/427 which now has
time 14.914755 and size 39, net change of -7.

but of course IPA inline size estimates are a bit off since we are not
going to do any optimization on the inlined body.

Reply via email to