Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk?
-- >8 -- Since atomic constraints are interned the subsumption machinery can safely use pointer instead of structural hashing for them. This speeds up compilation of the testcase in the PR from ~3s to ~2s. PR c++/118069 gcc/cp/ChangeLog: * constraint.cc (atom_hasher): Define here, instead of ... * cp-tree.h (atom_hasher): ... here. * logic.cc (clause::m_set): Use pointer instead of structural hashing. --- gcc/cp/constraint.cc | 21 +++++++++++++++++++++ gcc/cp/cp-tree.h | 21 --------------------- gcc/cp/logic.cc | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc index 2af1bbc016b..c75982d8009 100644 --- a/gcc/cp/constraint.cc +++ b/gcc/cp/constraint.cc @@ -512,6 +512,27 @@ normalize_concept_check (tree check, tree args, norm_info info) return norm; } +/* A structural hasher for ATOMIC_CONSTRs. */ + +struct atom_hasher : default_hash_traits<tree> +{ + static hashval_t hash (tree t) + { + ++comparing_specializations; + hashval_t val = hash_atomic_constraint (t); + --comparing_specializations; + return val; + } + + static bool equal (tree t1, tree t2) + { + ++comparing_specializations; + bool eq = atomic_constraints_identical_p (t1, t2); + --comparing_specializations; + return eq; + } +}; + /* Used by normalize_atom to cache ATOMIC_CONSTRs. */ static GTY((deletable)) hash_table<atom_hasher> *atom_cache; diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index c5e0fc5c440..53b47b63a2e 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -8712,27 +8712,6 @@ extern void diagnose_constraints (location_t, tree, tree); extern void note_failed_type_completion_for_satisfaction (tree); -/* A structural hasher for ATOMIC_CONSTRs. */ - -struct atom_hasher : default_hash_traits<tree> -{ - static hashval_t hash (tree t) - { - ++comparing_specializations; - hashval_t val = hash_atomic_constraint (t); - --comparing_specializations; - return val; - } - - static bool equal (tree t1, tree t2) - { - ++comparing_specializations; - bool eq = atomic_constraints_identical_p (t1, t2); - --comparing_specializations; - return eq; - } -}; - /* in logic.cc */ extern bool subsumes (tree, tree); diff --git a/gcc/cp/logic.cc b/gcc/cp/logic.cc index e46ea0ebb78..6ee67713ae0 100644 --- a/gcc/cp/logic.cc +++ b/gcc/cp/logic.cc @@ -203,7 +203,7 @@ struct clause } std::list<tree> m_terms; /* The list of terms. */ - hash_set<tree, false, atom_hasher> m_set; /* The set of atomic constraints. */ + hash_set<tree> m_set; /* The set of atomic constraints. */ iterator m_current; /* The current term. */ }; -- 2.48.0.rc0