https://gcc.gnu.org/g:9a19811ea1e9b3024c0f41b074d71679088bb2d7

commit r13-8478-g9a19811ea1e9b3024c0f41b074d71679088bb2d7
Author: Richard Biener <rguent...@suse.de>
Date:   Wed Feb 14 12:33:13 2024 +0100

    tree-optimization/113910 - huge compile time during PTA
    
    For the testcase in PR113910 we spend a lot of time in PTA comparing
    bitmaps for looking up equivalence class members.  This points to
    the very weak bitmap_hash function which effectively hashes set
    and a subset of not set bits.
    
    The major problem with it is that it simply truncates the
    BITMAP_WORD sized intermediate hash to hashval_t which is
    unsigned int, effectively not hashing half of the bits.
    
    This reduces the compile-time for the testcase from tens of minutes
    to 42 seconds and PTA time from 99% to 46%.
    
            PR tree-optimization/113910
            * bitmap.cc (bitmap_hash): Mix the full element "hash" to
            the hashval_t hash.
    
    (cherry picked from commit ad7a365aaccecd23ea287c7faaab9c7bd50b944a)

Diff:
---
 gcc/bitmap.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/bitmap.cc b/gcc/bitmap.cc
index 20de562caac..d65f6b259dd 100644
--- a/gcc/bitmap.cc
+++ b/gcc/bitmap.cc
@@ -2673,7 +2673,7 @@ bitmap_hash (const_bitmap head)
       for (ix = 0; ix != BITMAP_ELEMENT_WORDS; ix++)
        hash ^= ptr->bits[ix];
     }
-  return (hashval_t)hash;
+  return iterative_hash (&hash, sizeof (hash), 0);
 }

Reply via email to