re PR lto/54095 (Unnecessary static variable renaming)

PR lto/54095
	* cgraph.c (cgraph_make_node_local_1): Se unique_name.
	* cgraph.h (symtab_node_base): Add unique_name.
	* lto-cgraph.c (lto_output_node, lto_output_varpool_node,
	input_overwrite_node, input_varpool_node): Stream unique_name.
	* cgraphclones.c (cgraph_create_virtual_clone,
	cgraph_function_versioning): Set unique_name.
	* ipa.c (function_and_variable_visibility): Set unique_name.

From-SVN: r198710
This commit is contained in:
Jan Hubicka 2013-05-08 14:59:21 +02:00 committed by Jan Hubicka
parent 8b28cf47bf
commit 702d870328
6 changed files with 40 additions and 0 deletions

View File

@ -1,3 +1,14 @@
2013-05-08 Jan Hubicka <jh@suse.cz>
PR lto/54095
* cgraph.c (cgraph_make_node_local_1): Se unique_name.
* cgraph.h (symtab_node_base): Add unique_name.
* lto-cgraph.c (lto_output_node, lto_output_varpool_node,
input_overwrite_node, input_varpool_node): Stream unique_name.
* cgraphclones.c (cgraph_create_virtual_clone,
cgraph_function_versioning): Set unique_name.
* ipa.c (function_and_variable_visibility): Set unique_name.
2013-05-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
* gimple-ssa-strength-reduction.c (find_phi_def): Revert former "fix."

View File

@ -1798,6 +1798,8 @@ cgraph_make_node_local_1 (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED)
node->symbol.externally_visible = false;
node->local.local = true;
node->symbol.unique_name = (node->symbol.resolution == LDPR_PREVAILING_DEF_IRONLY
|| node->symbol.resolution == LDPR_PREVAILING_DEF_IRONLY_EXP);
node->symbol.resolution = LDPR_PREVAILING_DEF_IRONLY;
gcc_assert (cgraph_function_body_availability (node) == AVAIL_LOCAL);
}

View File

@ -62,6 +62,8 @@ struct GTY(()) symtab_node_base
/* Needed variables might become dead by optimization. This flag
forces the variable to be output even if it appears dead otherwise. */
unsigned force_output : 1;
/* True when the name is known to be unique and thus it does not need mangling. */
unsigned unique_name : 1;
/* Ordering of all symtab entries. */
int order;

View File

@ -324,6 +324,14 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node,
DECL_STATIC_DESTRUCTOR (new_node->symbol.decl) = 0;
new_node->clone.tree_map = tree_map;
new_node->clone.args_to_skip = args_to_skip;
/* Clones of global symbols or symbols with unique names are unique. */
if ((TREE_PUBLIC (old_decl)
&& !DECL_EXTERNAL (old_decl)
&& !DECL_WEAK (old_decl)
&& !DECL_COMDAT (old_decl))
|| in_lto_p)
new_node->symbol.unique_name = true;
FOR_EACH_VEC_SAFE_ELT (tree_map, i, map)
{
tree var = map->new_tree;
@ -739,6 +747,13 @@ cgraph_function_versioning (struct cgraph_node *old_version_node,
new_version_node->symbol.externally_visible = 0;
new_version_node->local.local = 1;
new_version_node->lowered = true;
/* Clones of global symbols or symbols with unique names are unique. */
if ((TREE_PUBLIC (old_decl)
&& !DECL_EXTERNAL (old_decl)
&& !DECL_WEAK (old_decl)
&& !DECL_COMDAT (old_decl))
|| in_lto_p)
new_version_node->symbol.unique_name = true;
/* Update the call_expr on the edges to call the new version node. */
update_call_expr (new_version_node);

View File

@ -786,6 +786,9 @@ function_and_variable_visibility (bool whole_program)
{
gcc_assert (whole_program || in_lto_p
|| !TREE_PUBLIC (node->symbol.decl));
node->symbol.unique_name = ((node->symbol.resolution == LDPR_PREVAILING_DEF_IRONLY
|| node->symbol.resolution == LDPR_PREVAILING_DEF_IRONLY_EXP)
&& TREE_PUBLIC (node->symbol.decl));
symtab_make_decl_local (node->symbol.decl);
node->symbol.resolution = LDPR_PREVAILING_DEF_IRONLY;
if (node->symbol.same_comdat_group)
@ -861,6 +864,9 @@ function_and_variable_visibility (bool whole_program)
{
gcc_assert (in_lto_p || whole_program || !TREE_PUBLIC (vnode->symbol.decl));
symtab_make_decl_local (vnode->symbol.decl);
vnode->symbol.unique_name = ((vnode->symbol.resolution == LDPR_PREVAILING_DEF_IRONLY
|| vnode->symbol.resolution == LDPR_PREVAILING_DEF_IRONLY_EXP)
&& TREE_PUBLIC (vnode->symbol.decl));
if (vnode->symbol.same_comdat_group)
symtab_dissolve_same_comdat_group_list ((symtab_node) vnode);
vnode->symbol.resolution = LDPR_PREVAILING_DEF_IRONLY;

View File

@ -468,6 +468,7 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
bp_pack_value (&bp, node->local.can_change_signature, 1);
bp_pack_value (&bp, node->local.redefined_extern_inline, 1);
bp_pack_value (&bp, node->symbol.force_output, 1);
bp_pack_value (&bp, node->symbol.unique_name, 1);
bp_pack_value (&bp, node->symbol.address_taken, 1);
bp_pack_value (&bp, node->abstract_and_needed, 1);
bp_pack_value (&bp, tag == LTO_symtab_analyzed_node
@ -533,6 +534,7 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, struct varpool_node
bp = bitpack_create (ob->main_stream);
bp_pack_value (&bp, node->symbol.externally_visible, 1);
bp_pack_value (&bp, node->symbol.force_output, 1);
bp_pack_value (&bp, node->symbol.unique_name, 1);
bp_pack_value (&bp, node->finalized, 1);
bp_pack_value (&bp, node->alias, 1);
bp_pack_value (&bp, node->alias_of != NULL, 1);
@ -886,6 +888,7 @@ input_overwrite_node (struct lto_file_decl_data *file_data,
node->local.can_change_signature = bp_unpack_value (bp, 1);
node->local.redefined_extern_inline = bp_unpack_value (bp, 1);
node->symbol.force_output = bp_unpack_value (bp, 1);
node->symbol.unique_name = bp_unpack_value (bp, 1);
node->symbol.address_taken = bp_unpack_value (bp, 1);
node->abstract_and_needed = bp_unpack_value (bp, 1);
node->symbol.used_from_other_partition = bp_unpack_value (bp, 1);
@ -1040,6 +1043,7 @@ input_varpool_node (struct lto_file_decl_data *file_data,
bp = streamer_read_bitpack (ib);
node->symbol.externally_visible = bp_unpack_value (&bp, 1);
node->symbol.force_output = bp_unpack_value (&bp, 1);
node->symbol.unique_name = bp_unpack_value (&bp, 1);
node->finalized = bp_unpack_value (&bp, 1);
node->alias = bp_unpack_value (&bp, 1);
non_null_aliasof = bp_unpack_value (&bp, 1);