]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: redundant hashing in register_specialization
authorPatrick Palka <ppalka@redhat.com>
Tue, 22 Oct 2024 12:01:16 +0000 (08:01 -0400)
committerPatrick Palka <ppalka@redhat.com>
Tue, 22 Oct 2024 12:01:16 +0000 (08:01 -0400)
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 <jason@redhat.com>
gcc/cp/pt.cc

index 0141c53b617c87e7ac3afac1fa7e7a5bfca1a474..b590c32345f6e6ba2d6b6fd8cdcb6ed58400d846 100644 (file)
@@ -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)