Internals: Remove redundant hash lookup (#5276 partial) (#5303)

Minor help for #5276
This commit is contained in:
Geza Lore 2024-07-25 21:07:58 +01:00 committed by GitHub
parent 87d1c10fa7
commit 0d43c14b93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -360,8 +360,8 @@ bool DfgVertex::equals(const DfgVertex& that, EqualsCache& cache) const {
const auto key = (this < &that) ? EqualsCache::key_type{this, &that} //
: EqualsCache::key_type{&that, this};
// Note: the recursive invocation can cause a re-hash of the cache which invalidates iterators
uint8_t result = cache[key];
// Note: the recursive invocation can cause a re-hash but that will not invalidate references
uint8_t& result = cache[key];
if (!result) {
result = 2; // Assume equals
auto thisPair = this->sourceEdges();
@ -380,7 +380,6 @@ bool DfgVertex::equals(const DfgVertex& that, EqualsCache& cache) const {
break;
}
}
cache[key] = result;
}
return result >> 1;
}