Hashing.h provides hash_value/hash_combine/hash_combine_range, which are primarily used by `DenseMap<StringRef, X>` Users shouldn't rely on specific hash values due to size_t differences on 32-bit/64-bit platforms and potential algorithm changes. `set_fixed_execution_hash_seed` is provided but it has never been used. In LLVM_ENABLE_ABI_BREAKING_CHECKS builds, take the the address of a static storage duration variable as the seed like absl/hash/internal/hash.h `kSeed`. (See https://reviews.llvm.org/D93931 for workaround for older Clang. Mach-O x86-64 forces PIC, so absl's `__apple_build_version__` check is unnecessary.) LLVM_ENABLE_ABI_BREAKING_CHECKS defaults to `WITH_ASSERTS` and is enabled in an assertion build. In a non-assertion build, `get_execution_seed` returns the fixed value regardless of `NDEBUG`. Removing a variable load yields noticeable size/performance improvement. A few users relying on the iteration order of `DenseMap<StringRef, X>` have been fixed (e.g.,f8f4235612c025bd1fdb89e8e63f4786eb6bf671eb8d0365650ea6b8e47658d7a6e0e68ea31db272592abf29f9664497557a). From my experience fixing [`StringMap`](https://discourse.llvm.org/t/reverse-iteration-bots/72224) iteration order issues, the scale of issues is similar. Pull Request: https://github.com/llvm/llvm-project/pull/96282
15 KiB
15 KiB