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

--- Comment #6 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Comdats are really in conflict with the fact that we have command line options.
I blame C++ standard for that and I don't think there is fully satisfactory
solution to this problem.

I was playing with the idea of warning when at lto time when comdats have
different command line options, but this triggers way too often in practice. We
would need to determine "dangerous" one i.e. when -fno-avx2 is replaced by
-favx2 code. 
There are many ways one can stubly change semantics of the IL which makes
merging possibly dangerous which is done often in larger projects, like
firefox.

With syntactic aliases it is possible to keep multiple copies of comdat
function through merging process so inlining will chose corresponding one, but
it does make other things harder. One important anoyance is that it makes it a
lot harder to estimate overall size of the translation unit and how inlining
affects it. We currently assume that every function will need offline unless
all calls to it disappears. We will need to understand that this is true across
all syntacit aliases.

Also that conditional that disables early inliner for all always_inlines is
probably bit harmful these days as libstdc++ indeed has quite interesting set
of always_inlines that call normal inlines. I noticed that just recently while
looking into the push_back implementation how complex maze it got.

I will fix early inliner to allow safe inlining to always_inlines.

Reply via email to