From: Martin Liska Date: Wed, 30 Oct 2019 12:02:17 +0000 (+0100) Subject: Remove comparison for polymorphic types. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=430d1e8de0800bc758534ad8048d9e8d53bb2335;p=gcc.git Remove comparison for polymorphic types. 2019-10-30 Martin Liska * ipa-icf-gimple.c (func_checker::func_checker): Do not initialize m_compare_polymorphic. (func_checker::compare_decl): Do not compare polymorphic types. * ipa-icf-gimple.h (m_compare_polymorphic): Remove. * ipa-icf.c (sem_function::equals_private): Do not call compare_polymorphic_p. From-SVN: r277617 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ec1002176be..3537a6152c1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-10-30 Martin Liska + + * ipa-icf-gimple.c (func_checker::func_checker): Do not + initialize m_compare_polymorphic. + (func_checker::compare_decl): Do not compare polymorphic types. + * ipa-icf-gimple.h (m_compare_polymorphic): Remove. + * ipa-icf.c (sem_function::equals_private): Do not call + compare_polymorphic_p. + 2019-10-30 Martin Liska * ipa-icf-gimple.c (func_checker::compare_ssa_name): Call diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c index f4e9a75b9de..3193823ce5a 100644 --- a/gcc/ipa-icf-gimple.c +++ b/gcc/ipa-icf-gimple.c @@ -51,14 +51,12 @@ namespace ipa_icf_gimple { of declarations that can be skipped. */ func_checker::func_checker (tree source_func_decl, tree target_func_decl, - bool compare_polymorphic, bool ignore_labels, hash_set *ignored_source_nodes, hash_set *ignored_target_nodes) : m_source_func_decl (source_func_decl), m_target_func_decl (target_func_decl), m_ignored_source_nodes (ignored_source_nodes), m_ignored_target_nodes (ignored_target_nodes), - m_compare_polymorphic (compare_polymorphic), m_ignore_labels (ignore_labels) { function *source_func = DECL_STRUCT_FUNCTION (source_func_decl); @@ -156,23 +154,7 @@ func_checker::compare_decl (tree t1, tree t2) if (!compatible_types_p (TREE_TYPE (t1), TREE_TYPE (t2))) return return_false (); - /* TODO: we are actually too strict here. We only need to compare if - T1 can be used in polymorphic call. */ - if (TREE_ADDRESSABLE (t1) - && m_compare_polymorphic - && !compatible_polymorphic_types_p (TREE_TYPE (t1), TREE_TYPE (t2), - false)) - return return_false (); - - if ((t == VAR_DECL || t == PARM_DECL || t == RESULT_DECL) - && DECL_BY_REFERENCE (t1) - && m_compare_polymorphic - && !compatible_polymorphic_types_p (TREE_TYPE (t1), TREE_TYPE (t2), - true)) - return return_false (); - bool existed_p; - tree &slot = m_decl_map.get_or_insert (t1, &existed_p); if (existed_p) return return_with_debug (slot == t2); diff --git a/gcc/ipa-icf-gimple.h b/gcc/ipa-icf-gimple.h index 9118f895e92..8e0f03c1d14 100644 --- a/gcc/ipa-icf-gimple.h +++ b/gcc/ipa-icf-gimple.h @@ -128,7 +128,6 @@ public: Similarly, IGNORE_SOURCE_DECLS and IGNORE_TARGET_DECLS are sets of declarations that can be skipped. */ func_checker (tree source_func_decl, tree target_func_decl, - bool compare_polymorphic, bool ignore_labels = false, hash_set *ignored_source_nodes = NULL, hash_set *ignored_target_nodes = NULL); @@ -258,9 +257,6 @@ private: /* Label to basic block index mapping. */ hash_map m_label_bb_map; - /* Flag if polymorphic comparison should be executed. */ - bool m_compare_polymorphic; - /* Flag if ignore labels in comparison. */ bool m_ignore_labels; diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c index ec3bd4183aa..67dd56f3f17 100644 --- a/gcc/ipa-icf.c +++ b/gcc/ipa-icf.c @@ -845,7 +845,6 @@ sem_function::equals_private (sem_item *item) return return_false (); m_checker = new func_checker (decl, m_compared_func->decl, - compare_polymorphic_p (), false, &refs_set, &m_compared_func->refs_set);