PR lto/57208
* ipa-ref.h (ipa_maybe_record_reference): Declare.
* ipa-ref.c (ipa_maybe_record_reference): New function.
* cgraphclones.c (cgraph_create_virtual_clone): Use it.
* ipa-cp.c (create_specialized_node): Record potential references from
aggvals.
* Makefile.in (ipa-ref.o): Add IPA_REF_H to dependencies.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200468
138bc75d-0d04-0410-961f-
82ee72b054a4
+2013-06-27 Martin Jambor <mjambor@suse.cz>
+
+ PR lto/57208
+ * ipa-ref.h (ipa_maybe_record_reference): Declare.
+ * ipa-ref.c (ipa_maybe_record_reference): New function.
+ * cgraphclones.c (cgraph_create_virtual_clone): Use it.
+ * ipa-cp.c (create_specialized_node): Record potential references from
+ aggvals.
+ * Makefile.in (ipa-ref.o): Add IPA_REF_H to dependencies.
+
2013-06-27 Yufeng Zhang <yufeng.zhang@arm.com>
* config/aarch64/aarch64.c (aarch64_force_temporary): Add an extra
$(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) \
|| 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)
{
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;
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",
#include "ggc.h"
#include "target.h"
#include "cgraph.h"
+#include "ipa-utils.h"
static const char *ipa_ref_use_name[] = {"read","write","addr","alias"};
return ref;
}
+/* If VAL is a reference 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
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 *);