diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 359b9d844d9..4c9554a8212 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-09-02 Jan Hubicka + + * lto-symtab.c (lto_symtab_merge_symbols): Add comments; merge + duplicated nodes for assembler names. + * symtab.c (symtab_unregister_node): Do not attempt to unlink + hard registers from assembler name hash. + 2013-09-02 Jan Hubicka * ipa-split.c (execute_split_functions): Split externally visible diff --git a/gcc/lto-symtab.c b/gcc/lto-symtab.c index 83026ef7c8c..76e94400f6a 100644 --- a/gcc/lto-symtab.c +++ b/gcc/lto-symtab.c @@ -586,6 +586,9 @@ lto_symtab_merge_symbols (void) FOR_EACH_SYMBOL (node) { cgraph_node *cnode, *cnode2; + varpool_node *vnode; + symtab_node node2; + if (!node->symbol.analyzed && node->symbol.alias_target) { symtab_node tgt = symtab_node_for_asm (node->symbol.alias_target); @@ -594,22 +597,37 @@ lto_symtab_merge_symbols (void) symtab_resolve_alias (node, tgt); } node->symbol.aux = NULL; - + if (!(cnode = dyn_cast (node)) || !cnode->clone_of || cnode->clone_of->symbol.decl != cnode->symbol.decl) { + /* Builtins are not merged via decl merging. It is however + possible that tree merging unified the declaration. We + do not want duplicate entries in symbol table. */ if (cnode && DECL_BUILT_IN (node->symbol.decl) && (cnode2 = cgraph_get_node (node->symbol.decl)) && cnode2 != cnode) lto_cgraph_replace_node (cnode2, cnode); + /* The user defined assembler variables are also not unified by their + symbol name (since it is irrelevant), but we need to unify symbol + nodes if tree merging occured. */ + if ((vnode = dyn_cast (node)) + && DECL_HARD_REGISTER (vnode->symbol.decl) + && (node2 = symtab_get_node (vnode->symbol.decl)) + && node2 != node) + lto_varpool_replace_node (dyn_cast (node2), + vnode); + + /* Abstract functions may have duplicated cgraph nodes attached; remove them. */ else if (cnode && DECL_ABSTRACT (cnode->symbol.decl) && (cnode2 = cgraph_get_node (node->symbol.decl)) && cnode2 != cnode) cgraph_remove_node (cnode2); + symtab_insert_node_to_hashtable ((symtab_node)node); } } diff --git a/gcc/symtab.c b/gcc/symtab.c index bfbc03b6a82..253ba981844 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -283,7 +283,8 @@ symtab_unregister_node (symtab_node node) else *slot = replacement_node; } - unlink_from_assembler_name_hash (node, false); + if (!is_a (node) || !DECL_HARD_REGISTER (node->symbol.decl)) + unlink_from_assembler_name_hash (node, false); } /* Return symbol table node associated with DECL, if any,