diff options
author | Martin Liska <mliska@suse.cz> | 2015-03-01 21:23:21 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2015-03-01 20:23:21 +0000 |
commit | b6cddc7fb673b0712f03dfb3b7c1f7df81a139c6 (patch) | |
tree | fe24d2aee9562db1a7e4fe3b11e9626f5700ae13 /gcc/ipa-icf-gimple.c | |
parent | f0e677d2e0e9252bd9cb32f3f606ebc7612217ba (diff) | |
download | gcc-b6cddc7fb673b0712f03dfb3b7c1f7df81a139c6.zip gcc-b6cddc7fb673b0712f03dfb3b7c1f7df81a139c6.tar.gz gcc-b6cddc7fb673b0712f03dfb3b7c1f7df81a139c6.tar.bz2 |
re PR ipa/65245 (internal compiler error: in address_matters_p, at symtab.c:1908)
2015-02-28 Martin Liska <mliska@suse.cz>
Jan Hubicka <hubicka@ucw.cz>
PR ipa/65245
* ipa-icf-gimple.c (func_checker::compare_function_decl):
Remove.
(func_checker::compare_variable_decl): Skip symtab vars.
(func_checker::compare_cst_or_decl): Update.
* ipa-icf.c (sem_function::parse): Do not consider aliases.
(sem_function::compare_cgraph_references): Add ADDRESS parameter;
use correct symtab predicates.
(sem_function::equals_wpa): Update uses of compare_cgraph_references.
(sem_variable::parse): Update comment.
(sem_item_optimizer::build_graph): Consider ultimate aliases
for references.
* gcc.dg/ipa/ipa-icf-34.c: New test.
Co-Authored-By: Jan Hubicka <hubicka@ucw.cz>
From-SVN: r221090
Diffstat (limited to 'gcc/ipa-icf-gimple.c')
-rw-r--r-- | gcc/ipa-icf-gimple.c | 58 |
1 files changed, 7 insertions, 51 deletions
diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c index 1863173..7cc58d4 100644 --- a/gcc/ipa-icf-gimple.c +++ b/gcc/ipa-icf-gimple.c @@ -312,10 +312,9 @@ func_checker::compare_cst_or_decl (tree t1, tree t2) return return_with_debug (ret); } case FUNCTION_DECL: - { - ret = compare_function_decl (t1, t2); - return return_with_debug (ret); - } + /* All function decls are in the symbol table and known to match + before we start comparing bodies. */ + return true; case VAR_DECL: return return_with_debug (compare_variable_decl (t1, t2)); case FIELD_DECL: @@ -537,39 +536,6 @@ func_checker::compare_tree_list_operand (tree t1, tree t2) return true; } -/* Verifies that trees T1 and T2, representing function declarations - are equivalent from perspective of ICF. */ - -bool -func_checker::compare_function_decl (tree t1, tree t2) -{ - bool ret = false; - - if (t1 == t2) - return true; - - symtab_node *n1 = symtab_node::get (t1); - symtab_node *n2 = symtab_node::get (t2); - - if (m_ignored_source_nodes != NULL && m_ignored_target_nodes != NULL) - { - ret = m_ignored_source_nodes->contains (n1) - && m_ignored_target_nodes->contains (n2); - - if (ret) - return true; - } - - /* If function decl is WEAKREF, we compare targets. */ - cgraph_node *f1 = cgraph_node::get (t1); - cgraph_node *f2 = cgraph_node::get (t2); - - if(f1 && f2 && f1->weakref && f2->weakref) - ret = f1->alias_target == f2->alias_target; - - return ret; -} - /* Verifies that trees T1 and T2 do correspond. */ bool @@ -590,20 +556,10 @@ func_checker::compare_variable_decl (tree t1, tree t2) && DECL_ASSEMBLER_NAME (t1) != DECL_ASSEMBLER_NAME (t2)) return return_false_with_msg ("HARD REGISTERS are different"); - if (TREE_CODE (t1) == VAR_DECL && (DECL_EXTERNAL (t1) || TREE_STATIC (t1))) - { - symtab_node *n1 = symtab_node::get (t1); - symtab_node *n2 = symtab_node::get (t2); - - if (m_ignored_source_nodes != NULL && m_ignored_target_nodes != NULL) - { - ret = m_ignored_source_nodes->contains (n1) - && m_ignored_target_nodes->contains (n2); - - if (ret) - return true; - } - } + /* Symbol table variables are known to match before we start comparing + bodies. */ + if (decl_in_symtab_p (t1)) + return decl_in_symtab_p (t2); ret = compare_decl (t1, t2); return return_with_debug (ret); |