File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -19,19 +19,19 @@ namespace {
19
19
// llvm/lib/Transforms/Utils/FunctionComparator.cpp
20
20
21
21
class StructuralHashImpl {
22
- uint64_t Hash = 0x6acaa36bef8325c5ULL ;
22
+ hash_code Hash;
23
23
24
- void update ( uint64_t V) { Hash = hashing::detail::hash_16_bytes (Hash, V); }
24
+ template < typename T> void hash ( const T & V) { Hash = hash_combine (Hash, V); }
25
25
26
26
public:
27
- StructuralHashImpl () = default ;
27
+ StructuralHashImpl () : Hash( 4 ) {}
28
28
29
29
void update (const Function &F) {
30
30
if (F.empty ())
31
31
return ;
32
32
33
- update (F.isVarArg ());
34
- update (F.arg_size ());
33
+ hash (F.isVarArg ());
34
+ hash (F.arg_size ());
35
35
36
36
SmallVector<const BasicBlock *, 8 > BBs;
37
37
SmallPtrSet<const BasicBlock *, 16 > VisitedBBs;
@@ -40,9 +40,9 @@ class StructuralHashImpl {
40
40
VisitedBBs.insert (BBs[0 ]);
41
41
while (!BBs.empty ()) {
42
42
const BasicBlock *BB = BBs.pop_back_val ();
43
- update (45798 ); // Block header
43
+ hash (45798 ); // Block header
44
44
for (auto &Inst : *BB)
45
- update (Inst.getOpcode ());
45
+ hash (Inst.getOpcode ());
46
46
47
47
const Instruction *Term = BB->getTerminator ();
48
48
for (unsigned i = 0 , e = Term->getNumSuccessors (); i != e; ++i) {
You can’t perform that action at this time.
0 commit comments