[lld] [lld-macho,BalancedPartition] Simplify relocation hash and avoid xxHash (PR #121729)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 6 20:13:10 PST 2025


MaskRay wrote:

> Only very minor size changes on my end. I'm curious if @Colibrow sees and size regressions. LGTM after fixing the `data.size() < windowSize` issue.

Thanks. I've changed the tail hashing scheme to:

```
    if (data.size() >= windowSize)
      for (size_t i = 0; i <= data.size() - windowSize; ++i)
        hashes.push_back(llvm::support::endian::read32le(data.data() + i));
    for (uint8_t byte : data.take_back(windowSize - 1))
      hashes.push_back(byte);
```

This helps group 0102 and 0201 together. The similarity between 030201 and 0201 is now the same as 030201 and 0102, which should be fine.

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


More information about the llvm-commits mailing list