diff options
author | Patrick Palka <ppalka@redhat.com> | 2024-10-22 08:01:16 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2024-10-22 08:01:16 -0400 |
commit | ae614b8a3d7866764bfea6f30605f90268db572b (patch) | |
tree | 42a8da1baf1cf2804a0ee6697918402a614d6f5d | |
parent | 4e80432c52a18b92899244e8ce3c243f560766a6 (diff) | |
download | gcc-ae614b8a3d7866764bfea6f30605f90268db572b.zip gcc-ae614b8a3d7866764bfea6f30605f90268db572b.tar.gz gcc-ae614b8a3d7866764bfea6f30605f90268db572b.tar.bz2 |
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 <jason@redhat.com>
-rw-r--r-- | gcc/cp/pt.cc | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 0141c53..b590c32 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) |