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

--- Comment #20 from Iain Sandoe <iains at gcc dot gnu.org> ---
testing:
diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index e1af8bf..4d72e42 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -660,7 +660,8 @@ sem_function::merge (sem_item *alias_item)
       /* When both alias and original are not overwritable, we can save
          the extra thunk wrapper for direct calls.  */
       redirect_callers
-       = (!original_discardable
+       = (alias->callers
+          && !original_discardable
           && !DECL_COMDAT_GROUP (alias->decl)
           && alias->get_availability () > AVAIL_INTERPOSABLE
           && original->get_availability () > AVAIL_INTERPOSABLE
@@ -724,7 +725,7 @@ sem_function::merge (sem_item *alias_item)

       /* The alias function is removed if symbol address
          does not matter.  */
-      if (!alias_address_matters)
+      if (!alias_address_matters && alias->ref_list.referring.is_empty())
        alias->remove ();

       if (dump_file && redirected)

Reply via email to