[Support] Change StringMap hash function from xxHash64 to xxh3_64bits
authorFangrui Song <i@maskray.me>
Sat, 22 Jul 2023 23:50:47 +0000 (16:50 -0700)
committerFangrui Song <i@maskray.me>
Sat, 22 Jul 2023 23:50:47 +0000 (16:50 -0700)
commitf6cce566b3d06de70efb9271ea9253b1d5845920
tree9b3e1b21e7520d632f626a969bdca24bb0b483ce
parent5d66f9fd8e97c05a5dba317d3ad2566e61ead1ff
[Support] Change StringMap hash function from xxHash64 to xxh3_64bits

Similar to D142862.

xxh3 is significantly faster than xxh64. Switch to xxh3, as we did for
for lld and llvm-dwarfutil to increase performance (D154813 D155675).
While I think StringMap is not a bottleneck for most applications, it
seems good to eliminate the slower xxh64.
In addition, according to Erik Desjardins, an artificial benchmark of
Rust with very large constant strings improves by ~3% locally.

I have fixed all found issues (~20) separately, but one is remaining:

* ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s has a
  failure due to StringMap iteration order. It now passes
  with LLVM_ENABLE_REVERSE_ITERATION=on while failing with
  LLVM_ENABLE_REVERSE_ITERATION=off.

Reviewed By: erikdesjardins

Differential Revision: https://reviews.llvm.org/D155781
llvm/lib/Support/StringMap.cpp
llvm/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s