[llvm] [ADT] Use xxh3_64bits in DenseMapInfo<StringRef>::getHashValue (PR #191115)
Alexandre Ganea via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 10 07:57:29 PDT 2026
================
@@ -614,5 +615,12 @@ unsigned DenseMapInfo<StringRef, void>::getHashValue(StringRef Val) {
"Cannot hash the empty key!");
assert(Val.data() != getTombstoneKey().data() &&
"Cannot hash the tombstone key!");
- return (unsigned)(hash_value(Val));
+ auto hash = xxh3_64bits(Val);
+ // In LLVM_ENABLE_ABI_BREAKING_CHECKS builds, the seed is non-deterministic
+ // per process (address of a function in LLVMSupport) to prevent having users
+ // depend on the particular hash values.
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
+ hash ^= hashing::detail::get_execution_seed();
+#endif
+ return hash;
----------------
aganea wrote:
explicit cast to avoid conversion warnings?
https://github.com/llvm/llvm-project/pull/191115
More information about the llvm-commits
mailing list