On 10/2/24 7:49 AM, Richard Biener wrote:
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%.
Bootstrapped and tested on x86_64-unknown-linux-gnu.
OK for trunk?
OK.
Thanks,
Richard.
gcc/cp/
* pt.cc (iterative_hash_template_arg): Avoid using
iterative_hash_object.
---
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 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))