From 0d43c14b9309610b8091a096c3555309a3f0152c Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Thu, 25 Jul 2024 21:07:58 +0100 Subject: [PATCH] Internals: Remove redundant hash lookup (#5276 partial) (#5303) Minor help for #5276 --- src/V3Dfg.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/V3Dfg.cpp b/src/V3Dfg.cpp index d9647a0f7..7df05cbb4 100644 --- a/src/V3Dfg.cpp +++ b/src/V3Dfg.cpp @@ -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; }