From b3af74d72daabb6b1b4741504bf9ac874070352c Mon Sep 17 00:00:00 2001 From: hubicka Date: Sat, 21 Nov 2015 03:57:48 +0000 Subject: [PATCH] * ipa-icf.c (sem_item::add_type): Do not look for TYPE_CANONICAL; do not check AGGREGATE_TYPE_P when adding TYPE_MODE; Check that all record types are complete. * ipa-icf-gimple.c (func_checker::compatible_types_p): Do not compare alias sets for types w/o alias sets. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230698 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/ipa-icf-gimple.c | 10 +++++++++- gcc/ipa-icf.c | 6 ++---- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 659e6ba..1b7c5d2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2015-11-07 Jan Hubicka + + * ipa-icf.c (sem_item::add_type): Do not look for TYPE_CANONICAL; + do not check AGGREGATE_TYPE_P when adding TYPE_MODE; + Check that all record types are complete. + * ipa-icf-gimple.c (func_checker::compatible_types_p): Do not + compare alias sets for types w/o alias sets. + 2015-11-20 Eric Botcazou * config/sparc/sparc.md (umulxhi_vis): Move around. diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c index ca489c1..992ee7a 100644 --- a/gcc/ipa-icf-gimple.c +++ b/gcc/ipa-icf-gimple.c @@ -233,7 +233,15 @@ func_checker::compatible_types_p (tree t1, tree t2) if (!types_compatible_p (t1, t2)) return return_false_with_msg ("types are not compatible"); - if (get_alias_set (t1) != get_alias_set (t2)) + /* We do a lot of unnecesary matching of types that are not being + accessed and thus do not need to be compatible. In longer term we should + remove these checks on all types which are not accessed as memory + locations. + + For time being just avoid calling get_alias_set on types that are not + having alias sets defined at all. */ + if (type_with_alias_set_p (t1) && type_with_alias_set_p (t2) + && get_alias_set (t1) != get_alias_set (t2)) return return_false_with_msg ("alias sets are different"); return true; diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c index bf1acae..0c76672 100644 --- a/gcc/ipa-icf.c +++ b/gcc/ipa-icf.c @@ -1543,11 +1543,8 @@ sem_item::add_type (const_tree type, inchash::hash &hstate) } type = TYPE_MAIN_VARIANT (type); - if (TYPE_CANONICAL (type)) - type = TYPE_CANONICAL (type); - if (!AGGREGATE_TYPE_P (type)) - hstate.add_int (TYPE_MODE (type)); + hstate.add_int (TYPE_MODE (type)); if (TREE_CODE (type) == COMPLEX_TYPE) { @@ -1574,6 +1571,7 @@ sem_item::add_type (const_tree type, inchash::hash &hstate) } else if (RECORD_OR_UNION_TYPE_P (type)) { + gcc_checking_assert (COMPLETE_TYPE_P (type)); hashval_t *val = optimizer->m_type_hash_cache.get (type); if (!val) -- 2.7.4