[Bug c++/92077] Multiple independent functions degrades optimizations

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Oct 12 14:01:00 GMT 2019


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

--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> ---
It is quite natural for the compiler to inline functions that are only called
once (it won't take more space) (although the compiler doesn't actually know
that the function isn't also called in another TU) more aggressively than
functions called multiple times. If you specify -O3 -finline-limit=300, we do
inline and simplify. Now of course it would be nice if the compiler realized
that inlining those functions gives a huge benefit in this case.

By the way, at -O2, without -DG, we still emit useless definitions for
functions _M_mutate and _M_dispose which are not called by f anymore, probably
because we remove those calls too late (FRE3).


More information about the Gcc-bugs mailing list