diff options
author | Fangrui Song <i@maskray.me> | 2024-07-28 10:14:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-28 10:14:21 -0700 |
commit | c53843415ebba4d7c295bcd31bb325bfd08570a6 (patch) | |
tree | 7165db922eb7dfc2d3e631645ce7a6cf6edd8a27 /llvm/lib/CodeGen | |
parent | 991192b211212aa366bf73b993ac444839c10bf5 (diff) | |
download | llvm-c53843415ebba4d7c295bcd31bb325bfd08570a6.zip llvm-c53843415ebba4d7c295bcd31bb325bfd08570a6.tar.gz llvm-c53843415ebba4d7c295bcd31bb325bfd08570a6.tar.bz2 |
[ADT,CodeGen] Remove stable_hash_combine_string
FNV, used by stable_hash_combine_string is extremely slow. For string
hashing with good avalanche effects, we prefer xxh3_64bits.
StableHashing.h might still be useful as it provides a stable
hash_combine while Hashing.h's might be non-deterministic (#96282).
Pull Request: https://github.com/llvm/llvm-project/pull/100668
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/MachineStableHash.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/MachineStableHash.cpp b/llvm/lib/CodeGen/MachineStableHash.cpp index 5abfbd5..d2e02a2 100644 --- a/llvm/lib/CodeGen/MachineStableHash.cpp +++ b/llvm/lib/CodeGen/MachineStableHash.cpp @@ -33,6 +33,7 @@ #include "llvm/MC/MCSymbol.h" #include "llvm/Support/Alignment.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/xxhash.h" #define DEBUG_TYPE "machine-stable-hash" @@ -100,8 +101,7 @@ stable_hash llvm::stableHashValue(const MachineOperand &MO) { case MachineOperand::MO_TargetIndex: { if (const char *Name = MO.getTargetIndexName()) return stable_hash_combine(MO.getType(), MO.getTargetFlags(), - stable_hash_combine_string(Name), - MO.getOffset()); + xxh3_64bits(Name), MO.getOffset()); StableHashBailingTargetIndexNoName++; return 0; } @@ -113,7 +113,7 @@ stable_hash llvm::stableHashValue(const MachineOperand &MO) { case MachineOperand::MO_ExternalSymbol: return hash_combine(MO.getType(), MO.getTargetFlags(), MO.getOffset(), - stable_hash_combine_string(MO.getSymbolName())); + xxh3_64bits(MO.getSymbolName())); case MachineOperand::MO_RegisterMask: case MachineOperand::MO_RegisterLiveOut: { @@ -151,7 +151,7 @@ stable_hash llvm::stableHashValue(const MachineOperand &MO) { case MachineOperand::MO_MCSymbol: { auto SymbolName = MO.getMCSymbol()->getName(); return hash_combine(MO.getType(), MO.getTargetFlags(), - stable_hash_combine_string(SymbolName)); + xxh3_64bits(SymbolName)); } case MachineOperand::MO_CFIIndex: return stable_hash_combine(MO.getType(), MO.getTargetFlags(), |