Skip to content

[BOLT] Switch BF::computeHash to xxh3 #65437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions bolt/lib/Core/BinaryFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "llvm/Support/Regex.h"
#include "llvm/Support/Timer.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/xxhash.h"
#include <functional>
#include <limits>
#include <numeric>
Expand Down Expand Up @@ -3585,12 +3586,12 @@ size_t BinaryFunction::computeHash(bool UseDFS,
llvm::copy(Layout.blocks(), std::back_inserter(Order));

// The hash is computed by creating a string of all instruction opcodes and
// possibly their operands and then hashing that string with std::hash.
// possibly their operands and then hashing that string with xxh3.
std::string HashString;
for (const BinaryBasicBlock *BB : Order)
HashString.append(hashBlock(BC, *BB, OperandHashFunc));

return Hash = std::hash<std::string>{}(HashString);
return Hash = llvm::xxh3_64bits(HashString);
}

void BinaryFunction::insertBasicBlocks(
Expand Down
2 changes: 1 addition & 1 deletion bolt/test/X86/pre-aggregated-perf.test
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ PERF2BOLT: 1 usqrt a 1 usqrt 10 0 22

NEWFORMAT: - name: 'frame_dummy/1'
NEWFORMAT: fid: 3
NEWFORMAT: hash: 0x24496F7F9594E89F
NEWFORMAT: hash: 0x28C72085C0BD8D37
NEWFORMAT: exec: 1

NEWFORMAT: - name: usqrt
Expand Down