cgraph: ifunc resolvers cannot be made local (PR 92697)
authorMartin Jambor <mjambor@suse.cz>
Thu, 28 Nov 2019 15:39:48 +0000 (16:39 +0100)
committerMartin Jambor <jamborm@gcc.gnu.org>
Thu, 28 Nov 2019 15:39:48 +0000 (16:39 +0100)
2019-11-28  Martin Jambor  <mjambor@suse.cz>

PR ipa/92697
* cgraph.c (cgraph_node_cannot_be_local_p_1): Return true for
ifunc_resolvers.
* symtab.c (symtab_node::dump_base): Dump ifunc_resolver flag.
Removed trailig whitespace.

testsuite/
* g++.dg/ipa/pr92697.C: New.

From-SVN: r278812

gcc/ChangeLog
gcc/cgraph.c
gcc/symtab.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ipa/pr92697.C [new file with mode: 0644]

index 064dd8ef83e25bdbffba826a26dea94801504973..60863539404a8d3e1a97ac3dfc61b85a6d28fd4c 100644 (file)
@@ -1,3 +1,11 @@
+2019-11-28  Martin Jambor  <mjambor@suse.cz>
+
+       PR ipa/92697
+       * cgraph.c (cgraph_node_cannot_be_local_p_1): Return true for
+       ifunc_resolvers.
+       * symtab.c (symtab_node::dump_base): Dump ifunc_resolver flag.
+       Removed trailig whitespace.
+
 2019-11-28  Jan Hubicka  <hubicka@ucw.cz>
 
        * profile-count.h (profile_count::combine_with_ipa_count_within):
index 1f7a5c58d98713f22e7704231dfdf6bf2634e539..dd07516b83e8f7032efd9c5dea56e5fc8142375f 100644 (file)
@@ -2227,6 +2227,7 @@ static bool
 cgraph_node_cannot_be_local_p_1 (cgraph_node *node, void *)
 {
   return !(!node->force_output
+          && !node->ifunc_resolver
           && ((DECL_COMDAT (node->decl)
                && !node->forced_by_abi
                && !node->used_from_object_file_p ()
index 3e634e22c8668bc00dfa05772c8f0351cc398206..5a3122fc8bb9675fe48b9cb08f479cc1cfade759 100644 (file)
@@ -914,8 +914,10 @@ symtab_node::dump_base (FILE *f)
       if (DECL_STATIC_DESTRUCTOR (decl))
        fprintf (f, " destructor");
     }
+  if (ifunc_resolver)
+    fprintf (f, " ifunc_resolver");
   fprintf (f, "\n");
-  
+
   if (same_comdat_group)
     fprintf (f, "  Same comdat group as: %s\n",
             same_comdat_group->dump_asm_name ());
index a7533838f989f30da21f581be0cec774c4eba2ac..eeb4379b5d066dbfc93924dad53336d6de0ea5c8 100644 (file)
@@ -1,3 +1,8 @@
+2019-11-28  Martin Jambor  <mjambor@suse.cz>
+
+       PR ipa/92697
+       * g++.dg/ipa/pr92697.C: New.
+
 2019-11-28  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/92645
diff --git a/gcc/testsuite/g++.dg/ipa/pr92697.C b/gcc/testsuite/g++.dg/ipa/pr92697.C
new file mode 100644 (file)
index 0000000..8958bd0
--- /dev/null
@@ -0,0 +1,51 @@
+/* { dg-do compile } */
+/* { dg-require-ifunc "" } */
+/* { dg-options "-O2 -fdump-ipa-sra" } */
+
+extern int have_avx2;
+extern int have_ssse3;
+
+namespace NTL
+{
+
+  static void randomstream_impl_init_base ()
+  {
+    __builtin_printf ("Frob1\n");
+  }
+
+  static void // __attribute__ ((target ("ssse3")))
+    randomstream_impl_init_ssse3 ()
+  {
+    __builtin_printf ("Frob2\n");
+  }
+
+  static void
+    //__attribute__ ((target ("avx2,fma,avx,pclmul,ssse3")))
+    randomstream_impl_init_avx2 ()
+  {
+    __builtin_printf ("Frob3\n");
+  }
+
+  extern "C"
+  {
+    static void (*resolve_randomstream_impl_init (void)) ()
+    {
+      if (have_avx2)
+       return &randomstream_impl_init_avx2;
+      if (have_ssse3)
+       return &randomstream_impl_init_ssse3;
+      return &randomstream_impl_init_base;
+    }
+  }
+  static void
+    __attribute__ ((ifunc ("resolve_" "randomstream_impl_init")))
+    randomstream_impl_init ();
+  void foo ()
+  {
+    randomstream_impl_init ();
+  }
+
+}
+
+
+/* { dg-final { scan-ipa-dump-not "Created new node" "sra" } } */