https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114262
--- Comment #6 from Jan Hubicka <hubicka at ucw dot cz> --- > Note GCC has not retuned its -Os heurstics for a long time because it has been > decent enough for most folks and corner cases like this is almost never come > up. There were quite few changes to -Os heuristics :) One of bigger challenges is that we do see more and more C++ code built with -Os which relies on certain functions to be inlined and optimized in context, so we had to get more optimistic in a hope that inlined code will optimize well. COMDAT functions are more likely inlined because statistics shows that many of them are not really shared between translations units (see -param=comdat-sharing-probability parameter). This was necessary to get reasonable code for Firefox approx 15 years ago.