https://gcc.gnu.org/g:842fbfa15fff2daae4a4d8a9cbcdf18e22635f78
commit r15-4023-g842fbfa15fff2daae4a4d8a9cbcdf18e22635f78 Author: Richard Biener <rguent...@suse.de> Date: Wed Oct 2 09:39:50 2024 +0200 Speedup iterative_hash_template_arg Using iterative_hash_object is expensive compared to using iterative_hash_hashval_t which is fit for integer sized values. The following reduces the number of perf cycles spent in iterative_hash_template_arg and iterative_hash combined by 20%. gcc/cp/ * pt.cc (iterative_hash_template_arg): Avoid using iterative_hash_object. Diff: --- gcc/cp/pt.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 43468e5f62e8..04f0a1d5fff7 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -1751,7 +1751,7 @@ hashval_t iterative_hash_template_arg (tree arg, hashval_t val) { if (arg == NULL_TREE) - return iterative_hash_object (arg, val); + return iterative_hash_hashval_t (0, val); if (!TYPE_P (arg)) /* Strip nop-like things, but not the same as STRIP_NOPS. */ @@ -1762,7 +1762,7 @@ iterative_hash_template_arg (tree arg, hashval_t val) enum tree_code code = TREE_CODE (arg); - val = iterative_hash_object (code, val); + val = iterative_hash_hashval_t (code, val); switch (code) { @@ -1777,7 +1777,7 @@ iterative_hash_template_arg (tree arg, hashval_t val) return val; case IDENTIFIER_NODE: - return iterative_hash_object (IDENTIFIER_HASH_VALUE (arg), val); + return iterative_hash_hashval_t (IDENTIFIER_HASH_VALUE (arg), val); case TREE_VEC: for (tree elt : tree_vec_range (arg))