[llvm-branch-commits] [Hashing] Use a non-deterministic seed (PR #96282)

Fangrui Song via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jun 21 19:18:28 PDT 2024


MaskRay wrote:

Due to ASLR and malloc non-determinism, `DenseMap<A *, X>` already introduces a lot of non-determinism to release builds.
`DenseMap<StringRef, X>` issues are less pronounced compared with `DenseMap<A *, X>`.

> I'm a little concerned that doing this in release builds is going to lead to weird bug reports

I understand the concern. If we receive 10 weird bug reports root caused to `DenseMap<A *, X>`,
the number of `DenseMap<StringRef, X>` bug reports might just be 1.

---

The next step is to make integer type keys (e.g. `DenseMap<uint64_t, X>`) non-deterministic.
IIRC the recent uint64_t getHashKey changes does not require any test update.
The number of `DenseMap<integer, X>` bug reports might be small.

As my previous comment says:

> we could consider restrict the nondeterminism to LLVM_ENABLE_ASSERTIONS=on.

but I haven't found it necessary.

https://github.com/llvm/llvm-project/pull/96282


More information about the llvm-branch-commits mailing list