Skip to content

Commit ae03401

Browse files
MaskRayadrian-prantl
authored andcommitted
[Passes] Switch to xxh3_64bits
FNV is slow and the name StableHashing.h might be misleading. Just use xxh3_64bits, which has been adopted in many places. (cherry picked from commit 7b1bb2b)
1 parent 2f2f958 commit ae03401

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

llvm/lib/Passes/StandardInstrumentations.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#include "llvm/Passes/StandardInstrumentations.h"
1616
#include "llvm/ADT/Any.h"
17-
#include "llvm/ADT/StableHashing.h"
1817
#include "llvm/ADT/StringRef.h"
1918
#include "llvm/Analysis/CallGraphSCCPass.h"
2019
#include "llvm/Analysis/LazyCallGraph.h"
@@ -43,6 +42,7 @@
4342
#include "llvm/Support/Regex.h"
4443
#include "llvm/Support/Signals.h"
4544
#include "llvm/Support/raw_ostream.h"
45+
#include "llvm/Support/xxhash.h"
4646
#include <unordered_map>
4747
#include <unordered_set>
4848
#include <utility>
@@ -752,28 +752,27 @@ static SmallString<32> getIRFileDisplayName(Any IR) {
752752
SmallString<32> Result;
753753
raw_svector_ostream ResultStream(Result);
754754
const Module *M = unwrapModule(IR);
755-
stable_hash NameHash = stable_hash_combine_string(M->getName());
756-
unsigned int MaxHashWidth = sizeof(stable_hash) * 8 / 4;
755+
uint64_t NameHash = xxh3_64bits(M->getName());
756+
unsigned MaxHashWidth = sizeof(uint64_t) * 2;
757757
write_hex(ResultStream, NameHash, HexPrintStyle::Lower, MaxHashWidth);
758758
if (unwrapIR<Module>(IR)) {
759759
ResultStream << "-module";
760760
} else if (const auto *F = unwrapIR<Function>(IR)) {
761761
ResultStream << "-function-";
762-
stable_hash FunctionNameHash = stable_hash_combine_string(F->getName());
762+
auto FunctionNameHash = xxh3_64bits(F->getName());
763763
write_hex(ResultStream, FunctionNameHash, HexPrintStyle::Lower,
764764
MaxHashWidth);
765765
} else if (const auto *C = unwrapIR<LazyCallGraph::SCC>(IR)) {
766766
ResultStream << "-scc-";
767-
stable_hash SCCNameHash = stable_hash_combine_string(C->getName());
767+
auto SCCNameHash = xxh3_64bits(C->getName());
768768
write_hex(ResultStream, SCCNameHash, HexPrintStyle::Lower, MaxHashWidth);
769769
} else if (const auto *L = unwrapIR<Loop>(IR)) {
770770
ResultStream << "-loop-";
771-
stable_hash LoopNameHash = stable_hash_combine_string(L->getName());
771+
auto LoopNameHash = xxh3_64bits(L->getName());
772772
write_hex(ResultStream, LoopNameHash, HexPrintStyle::Lower, MaxHashWidth);
773773
} else if (const auto *MF = unwrapIR<MachineFunction>(IR)) {
774774
ResultStream << "-machine-function-";
775-
stable_hash MachineFunctionNameHash =
776-
stable_hash_combine_string(MF->getName());
775+
auto MachineFunctionNameHash = xxh3_64bits(MF->getName());
777776
write_hex(ResultStream, MachineFunctionNameHash, HexPrintStyle::Lower,
778777
MaxHashWidth);
779778
} else {

0 commit comments

Comments
 (0)