re PR target/63892 (gcc.dg/sibcall-3.c fails on darwin with -m32)
authorJakub Jelinek <jakub@redhat.com>
Fri, 20 Feb 2015 16:44:37 +0000 (17:44 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 20 Feb 2015 16:44:37 +0000 (17:44 +0100)
PR target/63892
* ipa-icf.c (sem_function::merge): If DECL_COMDAT_GROUP (alias->decl),
don't try to create_thunk if stdarg_p.  If
!sem_item::target_supports_symbol_aliases_p (), similarly, and try to
redirect_callers if possible.
(sem_item_optimizer::execute): Call unregister_hooks here...
(ipa_icf_driver): ... instead of here.

Co-Authored-By: Martin Liska <mliska@suse.cz>
From-SVN: r220875

gcc/ChangeLog
gcc/ipa-icf.c

index 32cc757278b41bb3901139c3f458334c8a6863ff..cae66174bee090a22d5f9d3d609745fb49375bbe 100644 (file)
@@ -1,3 +1,14 @@
+2015-02-20  Jakub Jelinek  <jakub@redhat.com>
+           Martin Liska  <mliska@suse.cz>
+
+       PR target/63892
+       * ipa-icf.c (sem_function::merge): If DECL_COMDAT_GROUP (alias->decl),
+       don't try to create_thunk if stdarg_p.  If
+       !sem_item::target_supports_symbol_aliases_p (), similarly, and try to
+       redirect_callers if possible.
+       (sem_item_optimizer::execute): Call unregister_hooks here...
+       (ipa_icf_driver): ... instead of here.
+
 2015-02-20  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * config/aarch64/aarch64.md (*aarch64_lshr_sisd_or_int_<mode>3):
index 494fdcf08f50f375588bc068e1909109365188fc..e1af8bf3b09b2cd00ef280e1c2f97c2032b80692 100644 (file)
@@ -651,7 +651,9 @@ sem_function::merge (sem_item *alias_item)
      section (or we risk link failures when section is discarded).  */
   if ((original_address_matters
        && alias_address_matters)
-      || original_discardable)
+      || original_discardable
+      || DECL_COMDAT_GROUP (alias->decl)
+      || !sem_item::target_supports_symbol_aliases_p ())
     {
       create_thunk = !stdarg_p (TREE_TYPE (alias->decl));
       create_alias = false;
@@ -659,6 +661,7 @@ sem_function::merge (sem_item *alias_item)
          the extra thunk wrapper for direct calls.  */
       redirect_callers
        = (!original_discardable
+          && !DECL_COMDAT_GROUP (alias->decl)
           && alias->get_availability () > AVAIL_INTERPOSABLE
           && original->get_availability () > AVAIL_INTERPOSABLE
           && !alias->instrumented_version);
@@ -670,13 +673,6 @@ sem_function::merge (sem_item *alias_item)
       redirect_callers = false;
     }
 
-  if (create_alias && (DECL_COMDAT_GROUP (alias->decl)
-                      || !sem_item::target_supports_symbol_aliases_p ()))
-    {
-      create_alias = false;
-      create_thunk = true;
-    }
-
   /* We want thunk to always jump to the local function body
      unless the body is comdat and may be optimized out.  */
   if ((create_thunk || redirect_callers)
@@ -1714,6 +1710,8 @@ void
 sem_item_optimizer::execute (void)
 {
   filter_removed_items ();
+  unregister_hooks ();
+
   build_hash_based_classes ();
 
   if (dump_file)
@@ -2482,7 +2480,6 @@ ipa_icf_driver (void)
   gcc_assert (optimizer);
 
   optimizer->execute ();
-  optimizer->unregister_hooks ();
 
   delete optimizer;
   optimizer = NULL;