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

--- Comment #12 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
The functions ought to be equivalent, so transfering just some users should not
cause correctness issues. Of course unless the function is turned into a thunk
and/or the rest of references are optimized out, we will not see code size
decrease.

In longer term I would like to get references redirected, but doing so is bit
more touchy than redirecting callers. ipa-visibility already has code to bring
in static variable initializers and update them.  It probably should be
separated and also used by ipa-icf. Redirecting references in function bodies
will need new infrastructure.  

This is not that important issue as it may look, because in most cases we will
not redirect references because we lack knowledge about ADDR_EXPR being
posisbly used for pointer comparsion. For GCC 5 I guess we may want to do
redirection only when symbol passes
will_be_removed_from_program_if_no_direct_calls_p or when we are going to turn
the function into thunk anyway.

For GCC 6 we can introduce analysis to identify symbols whose address can
possibly be compared for equality.  Given the rising number of cases where this
matter, I think doing so will be a win.

Reply via email to