[all-commits] [llvm/llvm-project] 4143ee: [Hashing] Replace hash_integer_value with splitmix...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Jun 9 20:59:33 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4143eee75d13ce3a10fbf81b56220e1e13b915f1
      https://github.com/llvm/llvm-project/commit/4143eee75d13ce3a10fbf81b56220e1e13b915f1
  Author: Fangrui Song <i at maskray.me>
  Date:   2026-06-10 (Wed, 10 Jun 2026)

  Changed paths:
    M llvm/include/llvm/ADT/Hashing.h

  Log Message:
  -----------
  [Hashing] Replace hash_integer_value with splitmix64 finalizer (#199471)

hash_integer_value used a CityHash-era construction: read the uint64_t
value as two endian-normalized 4-byte halves via fetch32, then combine
through hash_16_bytes. Treat the integer as a number instead.

A direct hash_16_bytes(value, seed) has the right shape but inherits a
defect from its Murmur three-multiply chain: the top input bit maps
deterministically to the top output bit. Use the splitmix64 finalizer
(xmxmx) instead -- the same shape xxh3 uses for its 4-8 byte path.

bit-independence bias on eight input classes (sequential/step-aligned
ints, stack-, malloc-, code-segment-shaped pointers, random uint64):

```
// Read https://jonkagstrom.com/bit-mixer-construction/ for columns
                      bic_mean   bic_max
  fetch32 + 16_bytes: 0.04-0.14% 7-13%
  hash_16_bytes:      0.18%      42%
  splitmix64 xmxmx:   0.04%      0.17%
```

This also drops fetch32 and hash_16_bytes from the header; the three
byte-stable out-of-header callers were already moved to file-local
copies.

Depends on #196854
Aided by Claude Opus 4.7



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list