https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56727
--- Comment #14 from Jan Hubicka <hubicka at gcc dot gnu.org> --- For the draft patch you need to check for aliases. If global symbol is indeed the only way to reach the function, then the transformation is IMO valid. As for tailcall, we have recursive_call_p predicate that uses symtab_node::semantically_equivalent_p which returns true, because it is called for t and t. It is valid for testcase as written, because we know there is no alias. However void f(int b) { f(0); } void g(int b) __attribute__((alias(("f")))); is indeed misopitmized and the bug is that recursive_call_p needs to check all aliases of the function being semantically equivalent to function itself. I will fix that. For the optimization redirecting to noninterposable aliases, I would be fine with the patch if it was extended by the check verifying that there is at most one externally visible symbol aliasing the definition or that they are all non-interposable. Honza