aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraphclones.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2013-05-08 14:59:21 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2013-05-08 12:59:21 +0000
commit702d87032825f284efe6a5287c478692e103318c (patch)
tree4de5ffd28741a97813d02261d3fc8eed70c982ba /gcc/cgraphclones.c
parent8b28cf47bf7f071c979cb13694e45757081ee9d7 (diff)
downloadgcc-702d87032825f284efe6a5287c478692e103318c.zip
gcc-702d87032825f284efe6a5287c478692e103318c.tar.gz
gcc-702d87032825f284efe6a5287c478692e103318c.tar.bz2
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
Diffstat (limited to 'gcc/cgraphclones.c')
-rw-r--r--gcc/cgraphclones.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c
index f015f18..a002c68 100644
--- a/gcc/cgraphclones.c
+++ b/gcc/cgraphclones.c
@@ -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);