aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/IPO/MergeFunctions.cpp
diff options
context:
space:
mode:
authorKyungwoo Lee <kyulee@meta.com>2024-10-26 09:20:26 -0700
committerGitHub <noreply@github.com>2024-10-26 09:20:26 -0700
commitb667d161f0a9ff6b29cda0ccdb0081610c1e8b8c (patch)
treef7bd6f75a45771c00a47b4166840816760c0e8fd /llvm/lib/Transforms/IPO/MergeFunctions.cpp
parenta917ae0b4fc0d792ee0e2c512c4ea539f98e1204 (diff)
downloadllvm-b667d161f0a9ff6b29cda0ccdb0081610c1e8b8c.zip
llvm-b667d161f0a9ff6b29cda0ccdb0081610c1e8b8c.tar.gz
llvm-b667d161f0a9ff6b29cda0ccdb0081610c1e8b8c.tar.bz2
[StructuralHash] Refactor (#112621)
This is largely NFC, and it prepares for #112638. - Use stable_hash instead of uint64_t - Rename update* to hash* functions. They compute stable_hash locally and return it. This is a patch for https://discourse.llvm.org/t/rfc-global-function-merging/82608.
Diffstat (limited to 'llvm/lib/Transforms/IPO/MergeFunctions.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/MergeFunctions.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
index b50a700..ad16b0b 100644
--- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp
+++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
@@ -172,14 +172,14 @@ namespace {
class FunctionNode {
mutable AssertingVH<Function> F;
- IRHash Hash;
+ stable_hash Hash;
public:
// Note the hash is recalculated potentially multiple times, but it is cheap.
FunctionNode(Function *F) : F(F), Hash(StructuralHash(*F)) {}
Function *getFunc() const { return F; }
- IRHash getHash() const { return Hash; }
+ stable_hash getHash() const { return Hash; }
/// Replace the reference to the function F by the function G, assuming their
/// implementations are equal.
@@ -420,7 +420,7 @@ bool MergeFunctions::runOnModule(Module &M) {
// All functions in the module, ordered by hash. Functions with a unique
// hash value are easily eliminated.
- std::vector<std::pair<IRHash, Function *>> HashedFuncs;
+ std::vector<std::pair<stable_hash, Function *>> HashedFuncs;
for (Function &Func : M) {
if (isEligibleForMerging(Func)) {
HashedFuncs.push_back({StructuralHash(Func), &Func});