[PATCH] D149209: [StructuralHash] Track global variables
Arthur Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 15 17:05:21 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGce90dfc74b90: [StructuralHash] Track global variables (authored by aeubanks).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149209/new/
https://reviews.llvm.org/D149209
Files:
llvm/lib/IR/StructuralHash.cpp
Index: llvm/lib/IR/StructuralHash.cpp
===================================================================
--- llvm/lib/IR/StructuralHash.cpp
+++ llvm/lib/IR/StructuralHash.cpp
@@ -8,6 +8,7 @@
#include "llvm/IR/StructuralHash.h"
#include "llvm/IR/Function.h"
+#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Module.h"
using namespace llvm;
@@ -27,9 +28,12 @@
StructuralHashImpl() : Hash(4) {}
void update(const Function &F) {
- if (F.empty())
+ // Declarations don't affect analyses.
+ if (F.isDeclaration())
return;
+ hash(12345); // Function header
+
hash(F.isVarArg());
hash(F.arg_size());
@@ -53,7 +57,17 @@
}
}
+ void update(const GlobalVariable &GV) {
+ // used/compiler.used don't affect analyses.
+ if (GV.getName() == "llvm.compiler.used" || GV.getName() == "llvm.used")
+ return;
+ hash(23456); // Global header
+ hash(GV.getValueType()->getTypeID());
+ }
+
void update(const Module &M) {
+ for (const GlobalVariable &GV : M.globals())
+ update(GV);
for (const Function &F : M)
update(F);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149209.522390.patch
Type: text/x-patch
Size: 1110 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230516/ad66bf5a/attachment.bin>
More information about the llvm-commits
mailing list