[PATCH] D60765: [ELF] Place SectionPiece::{Live,Hash} bit fields together

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 18 00:20:23 PDT 2019


MaskRay added a comment.

> Notice that {get,set}OutputOff don't race with accesses to InputOff/Hash/TailHash/Live. So the goal has achieved. Also with this scheme we don't sacrifice the bits of Hash -- Hash member still has the full 32 bits.

I get your idea now: splitting `OutputOff` to make space for `Hash` (to keep it 32 bits). However, the benchmark shows 31-bit `Hash` works just fine.

For a huge internal executable (1.6GiB `clang -O3`), `Strings` in `StringTableBuilder::finalizeStringTable` contains at most 310253 elements.
Every pair has a probability 2^(-31) of colliding. The expected number of pair-wise collisions is 2^(-31) * C(310253,2) ~= 22.41. Note, this number is pair-wise - if 5 elements hash to the same value, they count as C(5,2) collisions. Assume every but one bucket has at most 1 element, that bucket with collision has at most 7 elements => The degraded performance is nearly nothing.

So for simplicity, I prefer leaving `OutputOff` as is.


Repository:
  rLLD LLVM Linker

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60765/new/

https://reviews.llvm.org/D60765





More information about the llvm-commits mailing list