Hi,

the patch reportedly fixes an issue when LTO building chromium.  It
adds references that are created by IPA-CP when propagating references
from aggregates (the scalar case is handled by the call graph
infrastructure).

Bootstrapped and tested on x86_64-linux.  OK for trunk?

Thanks,

Martin


2013-06-24  Martin Jambor  <mjam...@suse.cz>

        PR lto/57208
        * ipa-cp.c (create_specialized_node): Add newly created references
        to the symbol table.

Index: src/gcc/ipa-cp.c
===================================================================
--- src.orig/gcc/ipa-cp.c
+++ src/gcc/ipa-cp.c
@@ -2663,6 +2663,7 @@ create_specialized_node (struct cgraph_n
 {
   struct ipa_node_params *new_info, *info = IPA_NODE_REF (node);
   vec<ipa_replace_map_p, va_gc> *replace_trees = NULL;
+  struct ipa_agg_replacement_value *av;
   struct cgraph_node *new_node;
   int i, count = ipa_get_param_count (info);
   bitmap args_to_skip;
@@ -2704,6 +2705,23 @@ create_specialized_node (struct cgraph_n
   new_node = cgraph_create_virtual_clone (node, callers, replace_trees,
                                          args_to_skip, "constprop");
   ipa_set_node_agg_value_chain (new_node, aggvals);
+  for (av = aggvals; av; av = av->next)
+    {
+      tree base;
+      if (TREE_CODE (av->value) != ADDR_EXPR)
+       continue;
+      base = get_base_var (av->value);
+      if (base && (TREE_CODE (base) == FUNCTION_DECL
+                  || TREE_CODE (base) == VAR_DECL))
+       {
+         symtab_node referred = symtab_get_node (base);
+
+         gcc_checking_assert (referred);
+         ipa_record_reference ((symtab_node) new_node, referred,
+                               IPA_REF_ADDR, NULL);
+       }
+    }
+
   if (dump_file && (dump_flags & TDF_DETAILS))
     {
       fprintf (dump_file, "     the new node is %s/%i.\n",

Reply via email to