]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/113910 - huge compile time during PTA
authorRichard Biener <rguenther@suse.de>
Wed, 14 Feb 2024 11:33:13 +0000 (12:33 +0100)
committerRichard Biener <rguenther@suse.de>
Thu, 21 Mar 2024 11:48:58 +0000 (12:48 +0100)
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)

gcc/bitmap.cc

index 20de562caac07d2716ff96a1a61ded3ed8dc32c1..d65f6b259dd799bec5f2a9d31189ab1340590929 100644 (file)
@@ -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);
 }
 
 \f