From: Richard Biener Date: Wed, 2 Oct 2024 07:39:50 +0000 (+0200) Subject: Speedup iterative_hash_template_arg X-Git-Tag: basepoints/gcc-16~5530 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=842fbfa15fff2daae4a4d8a9cbcdf18e22635f78;p=thirdparty%2Fgcc.git 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 --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 43468e5f62e..04f0a1d5fff 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))