https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81000
Marc Glisse <glisse at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2017-06-07 CC| |marxin at gcc dot gnu.org Component|c++ |ipa Ever confirmed|0 |1 --- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> --- This is almost a duplicate of similar PRs about std::function, etc. We discover that _S_manage is the function that is called only in FRE3, much too late to inline it. IIRC, LLVM alternates between inlining and other optimizations, which helps a lot on this kind of code. Sprinkling __attribute__((always_inline)) is not sufficient, we need to inline one function before FRE or similar can propagate which function is called next and needs inlining before FRE etc. (Of course, a different implementation of std::any might be easier to optimize)