[llvm] [Hashing] Replace CityHash mixers with xxh3 (PR #194567)
Jakub Kuderski via llvm-commits
llvm-commits at lists.llvm.org
Sat May 9 11:47:21 PDT 2026
================
@@ -320,6 +170,13 @@ inline uint64_t get_execution_seed() {
#endif
}
+/// Hash a contiguous byte buffer to a hash_code. The execution seed is XORed
+/// into the result (not propagated through the avalanche), so a given byte
+/// stream produces the same xxh3 output modulo the per-process seed.
+inline hash_code combine_bytes(const char *data, size_t len) {
+ return xxh3_64bits(reinterpret_cast<const uint8_t *>(data), len) ^
+ get_execution_seed();
----------------
kuhar wrote:
Could this use a seeded `xxh3` entry point instead of XORing `get_execution_seed()` after the avalanche? With post-XOR seeding, `hash_combine(x) ^ hash_combine(y)` cancels the process seed, which seems to weaken the ABI-breaking hash perturbation this seed is meant to provide.
https://github.com/llvm/llvm-project/pull/194567
More information about the llvm-commits
mailing list