summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-27 13:49:28 +0000
committerjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-27 13:49:28 +0000
commit3c0fe71b4a4380ef9c96310e22eaf2479e4baec3 (patch)
treec4683ccba1c2ba8180759aa2dbf98cf9ef9d90d3
parent6b765f96c1c4013ad1158ebd4c7cf647786ba5a8 (diff)
downloadgcc-3c0fe71b4a4380ef9c96310e22eaf2479e4baec3.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200468 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/Makefile.in3
-rw-r--r--gcc/cgraphclones.c23
-rw-r--r--gcc/ipa-cp.c5
-rw-r--r--gcc/ipa-ref.c25
-rw-r--r--gcc/ipa-ref.h2
6 files changed, 46 insertions, 22 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4a8023bf960..1ecbfda1f62 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+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
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index d5121f3b43c..ffd85e76f03 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -2933,7 +2933,8 @@ ipa-prop.o : ipa-prop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(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) \
diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c
index f2a57fc1d08..5c328b7055e 100644
--- a/gcc/cgraphclones.c
+++ b/gcc/cgraphclones.c
@@ -341,27 +341,8 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node,
|| 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)
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 9c29d1dbc91..05c6e74d195 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -2663,6 +2663,7 @@ create_specialized_node (struct cgraph_node *node,
{
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_node *node,
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",
diff --git a/gcc/ipa-ref.c b/gcc/ipa-ref.c
index 7909805e0ce..a6ffdf3e5bb 100644
--- a/gcc/ipa-ref.c
+++ b/gcc/ipa-ref.c
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
#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 referring_node,
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
diff --git a/gcc/ipa-ref.h b/gcc/ipa-ref.h
index 79f60056601..c25e4e46f9d 100644
--- a/gcc/ipa-ref.h
+++ b/gcc/ipa-ref.h
@@ -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 *);