Commit 79ee9826 by Martin Jambor Committed by Martin Jambor

re PR c++/57208 (Latest chromium compilation fails with enabled LTO)

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.

From-SVN: r200468
parent e18b4a81
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
......
......@@ -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) \
......
......@@ -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)
......
......@@ -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",
......
......@@ -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
......
......@@ -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 *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment