https://gcc.gnu.org/g:ae614b8a3d7866764bfea6f30605f90268db572b

commit r15-4544-gae614b8a3d7866764bfea6f30605f90268db572b
Author: Patrick Palka <ppa...@redhat.com>
Date:   Tue Oct 22 08:01:16 2024 -0400

    c++: redundant hashing in register_specialization
    
    After r15-4050-g5dad738c1dd164 register_specialization needs to set
    elt.hash to the (maybe) precomputed hash so that the lookup uses it
    rather than redundantly computing it from scratch.
    
    gcc/cp/ChangeLog:
    
            * pt.cc (register_specialization): Set elt.hash.
    
    Reviewed-by: Jason Merrill <ja...@redhat.com>

Diff:
---
 gcc/cp/pt.cc | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 0141c53b617c..b590c32345f6 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -1546,9 +1546,7 @@ register_specialization (tree spec, tree tmpl, tree args, 
bool is_friend,
   elt.tmpl = tmpl;
   elt.args = args;
   elt.spec = spec;
-
-  if (hash == 0)
-    hash = spec_hasher::hash (&elt);
+  elt.hash = hash;
 
   spec_entry **slot = decl_specializations->find_slot (&elt, INSERT);
   if (*slot)

Reply via email to