===================================================================
@@ -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,10 @@ 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)
+ ipa_maybe_record_reference ((symtab_node) new_node, av->value,
+ IPA_REF_ADDR, NULL);
+
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, " the new node is %s/%i.\n",
===================================================================
@@ -2933,7 +2933,8 @@ ipa-prop.o : ipa-prop.c $(CONFIG_H) $(SY
$(DATA_STREAMER_H) $(TREE_STREAMER_H) $(PARAMS_H)
ipa-ref.o : ipa-ref.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
langhooks.h $(GGC_H) $(TARGET_H) $(CGRAPH_H) $(TREE_H) $(TARGET_H) \
- $(TREE_FLOW_H) $(TM_H) $(TREE_PASS_H) $(FLAGS_H) $(TREE_H) $(GGC_H)
+ $(TREE_FLOW_H) $(TM_H) $(TREE_PASS_H) $(FLAGS_H) $(TREE_H) $(GGC_H) \
+ $(IPA_UTILS_H)
ipa-cp.o : ipa-cp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TREE_H) $(TARGET_H) $(GIMPLE_H) $(CGRAPH_H) $(IPA_PROP_H) $(TREE_FLOW_H) \
$(TREE_PASS_H) $(FLAGS_H) $(DIAGNOSTIC_H) \
===================================================================
@@ -341,27 +341,8 @@ cgraph_create_virtual_clone (struct cgra
|| in_lto_p)
new_node->symbol.unique_name = true;
FOR_EACH_VEC_SAFE_ELT (tree_map, i, map)
- {
- tree var = map->new_tree;
- symtab_node ref_node;
-
- STRIP_NOPS (var);
- if (TREE_CODE (var) != ADDR_EXPR)
- continue;
- var = get_base_var (var);
- if (!var)
- continue;
- if (TREE_CODE (var) != FUNCTION_DECL
- && TREE_CODE (var) != VAR_DECL)
- continue;
-
- /* Record references of the future statement initializing the constant
- argument. */
- ref_node = symtab_get_node (var);
- gcc_checking_assert (ref_node);
- ipa_record_reference ((symtab_node)new_node, (symtab_node)ref_node,
- IPA_REF_ADDR, NULL);
- }
+ ipa_maybe_record_reference ((symtab_node) new_node, map->new_tree,
+ IPA_REF_ADDR, NULL);
if (!args_to_skip)
new_node->clone.combined_args_to_skip = old_node->clone.combined_args_to_skip;
else if (old_node->clone.combined_args_to_skip)
===================================================================
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3.
#include "ggc.h"
#include "target.h"
#include "cgraph.h"
+#include "ipa-utils.h"
static const char *ipa_ref_use_name[] = {"read","write","addr","alias"};
@@ -67,6 +68,30 @@ ipa_record_reference (symtab_node referr
return ref;
}
+/* If VAL is a refeerence to a function or a variable, add a reference from
+ REFERRING_NODE to the corresponding symbol table node. USE_TYPE specify
+ type of the use and STMT the statement (if it exists). Return the new
+ reference or NULL if none was created. */
+
+struct ipa_ref *
+ipa_maybe_record_reference (symtab_node referring_node, tree val,
+ enum ipa_ref_use use_type, gimple stmt)
+{
+ STRIP_NOPS (val);
+ if (TREE_CODE (val) != ADDR_EXPR)
+ return NULL;
+ val = get_base_var (val);
+ if (val && (TREE_CODE (val) == FUNCTION_DECL
+ || TREE_CODE (val) == VAR_DECL))
+ {
+ symtab_node referred = symtab_get_node (val);
+ gcc_checking_assert (referred);
+ return ipa_record_reference (referring_node, referred,
+ use_type, stmt);
+ }
+ return NULL;
+}
+
/* Remove reference REF. */
void
===================================================================
@@ -61,6 +61,8 @@ struct GTY(()) ipa_ref_list
struct ipa_ref * ipa_record_reference (symtab_node,
symtab_node,
enum ipa_ref_use, gimple);
+struct ipa_ref * ipa_maybe_record_reference (symtab_node, tree,
+ enum ipa_ref_use, gimple);
void ipa_remove_reference (struct ipa_ref *);
void ipa_remove_all_references (struct ipa_ref_list *);