[llvm] 7b1bb2b - [Passes] Switch to xxh3_64bits
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 25 15:35:08 PDT 2024
Author: Fangrui Song
Date: 2024-07-25T15:35:03-07:00
New Revision: 7b1bb2bbebc4705e2f30bb2179636a73696c4656
URL: https://github.com/llvm/llvm-project/commit/7b1bb2bbebc4705e2f30bb2179636a73696c4656
DIFF: https://github.com/llvm/llvm-project/commit/7b1bb2bbebc4705e2f30bb2179636a73696c4656.diff
LOG: [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.
Added:
Modified:
llvm/lib/Passes/StandardInstrumentations.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Passes/StandardInstrumentations.cpp b/llvm/lib/Passes/StandardInstrumentations.cpp
index fc7b82d522bf0..8f2461f40cb00 100644
--- a/llvm/lib/Passes/StandardInstrumentations.cpp
+++ b/llvm/lib/Passes/StandardInstrumentations.cpp
@@ -14,7 +14,6 @@
#include "llvm/Passes/StandardInstrumentations.h"
#include "llvm/ADT/Any.h"
-#include "llvm/ADT/StableHashing.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Analysis/CallGraphSCCPass.h"
#include "llvm/Analysis/LazyCallGraph.h"
@@ -44,6 +43,7 @@
#include "llvm/Support/Regex.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/xxhash.h"
#include <unordered_map>
#include <unordered_set>
#include <utility>
@@ -753,28 +753,27 @@ static SmallString<32> getIRFileDisplayName(Any IR) {
SmallString<32> Result;
raw_svector_ostream ResultStream(Result);
const Module *M = unwrapModule(IR);
- stable_hash NameHash = stable_hash_combine_string(M->getName());
- unsigned int MaxHashWidth = sizeof(stable_hash) * 8 / 4;
+ uint64_t NameHash = xxh3_64bits(M->getName());
+ unsigned MaxHashWidth = sizeof(uint64_t) * 2;
write_hex(ResultStream, NameHash, HexPrintStyle::Lower, MaxHashWidth);
if (unwrapIR<Module>(IR)) {
ResultStream << "-module";
} else if (const auto *F = unwrapIR<Function>(IR)) {
ResultStream << "-function-";
- stable_hash FunctionNameHash = stable_hash_combine_string(F->getName());
+ auto FunctionNameHash = xxh3_64bits(F->getName());
write_hex(ResultStream, FunctionNameHash, HexPrintStyle::Lower,
MaxHashWidth);
} else if (const auto *C = unwrapIR<LazyCallGraph::SCC>(IR)) {
ResultStream << "-scc-";
- stable_hash SCCNameHash = stable_hash_combine_string(C->getName());
+ auto SCCNameHash = xxh3_64bits(C->getName());
write_hex(ResultStream, SCCNameHash, HexPrintStyle::Lower, MaxHashWidth);
} else if (const auto *L = unwrapIR<Loop>(IR)) {
ResultStream << "-loop-";
- stable_hash LoopNameHash = stable_hash_combine_string(L->getName());
+ auto LoopNameHash = xxh3_64bits(L->getName());
write_hex(ResultStream, LoopNameHash, HexPrintStyle::Lower, MaxHashWidth);
} else if (const auto *MF = unwrapIR<MachineFunction>(IR)) {
ResultStream << "-machine-function-";
- stable_hash MachineFunctionNameHash =
- stable_hash_combine_string(MF->getName());
+ auto MachineFunctionNameHash = xxh3_64bits(MF->getName());
write_hex(ResultStream, MachineFunctionNameHash, HexPrintStyle::Lower,
MaxHashWidth);
} else {
More information about the llvm-commits
mailing list