ipa-prop.c (jump_function_useful_p): New.
authorJan Hubicka <hubicka@ucw.cz>
Tue, 4 Dec 2018 21:38:01 +0000 (22:38 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Tue, 4 Dec 2018 21:38:01 +0000 (21:38 +0000)
* ipa-prop.c (jump_function_useful_p): New.
(ipa_read_node_info): Do not allocated useless jump functions.

From-SVN: r266799

gcc/ChangeLog
gcc/ipa-prop.c

index 795dbb1..baf3825 100644 (file)
@@ -1,3 +1,8 @@
+2018-12-04  Jan Hubicka  <hubicka@ucw.cz>
+
+       * ipa-prop.c (jump_function_useful_p): New.
+       (ipa_read_node_info): Do not allocated useless jump functions.
+
 2018-12-04  David Malcolm  <dmalcolm@redhat.com>
 
        PR c/82967
index 7405235..f19b3ab 100644 (file)
@@ -4344,6 +4344,26 @@ ipa_write_node_info (struct output_block *ob, struct cgraph_node *node)
     }
 }
 
+/* If jump functions points to node we possibly can propagate into.
+   At this moment symbol table is still not merged, but the prevailing
+   symbol is always first in the list.  */
+
+static bool
+jump_function_useful_p (symtab_node *node)
+{
+  /* While incremental linking we may end up getting function body later.  */
+  if (flag_incremental_link == INCREMENTAL_LINK_LTO)
+    return true;
+  if (!TREE_PUBLIC (node->decl) && !DECL_EXTERNAL (node->decl))
+    return true;
+  for (int n = 10; node->previous_sharing_asm_name && n ; n--)
+    node = node->previous_sharing_asm_name;
+  if (node->previous_sharing_asm_name)
+    node = symtab_node::get_for_asmname (DECL_ASSEMBLER_NAME (node->decl));
+  gcc_assert (TREE_PUBLIC (node->decl));
+  return node->definition;
+}
+
 /* Stream in NODE info from IB.  */
 
 static void
@@ -4380,6 +4400,20 @@ ipa_read_node_info (struct lto_input_block *ib, struct cgraph_node *node,
 
       if (!count)
        continue;
+      if (!jump_function_useful_p (e->callee))
+       {
+          for (k = 0; k < count; k++)
+           {
+             struct ipa_jump_func dummy;
+             ipa_read_jump_function (ib, &dummy, e, data_in);
+             if (contexts_computed)
+               {
+                 struct ipa_polymorphic_call_context ctx;
+                 ctx.stream_in (ib, data_in);
+               }
+           }
+         continue;
+       }
       vec_safe_grow_cleared (args->jump_functions, count);
       if (contexts_computed)
        vec_safe_grow_cleared (args->polymorphic_call_contexts, count);