[llvm] [GVNSink] Avoid repeated hash lookups (NFC) (PR #113023)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 19 00:38:57 PDT 2024
================
@@ -535,12 +535,12 @@ class ValueTable {
uint32_t e = ExpressionNumbering[exp];
if (!e) {
hash_code H = exp->getHashValue([=](Value *V) { return lookupOrAdd(V); });
- auto I = HashNumbering.find(H);
- if (I != HashNumbering.end()) {
+ auto [I, Inserted] = HashNumbering.try_emplace(H);
+ if (!Inserted) {
e = I->second;
} else {
e = nextValueNumber++;
- HashNumbering[H] = e;
+ I->second = e;
----------------
nikic wrote:
Pass nextValueNumber to try_emplace instead?
https://github.com/llvm/llvm-project/pull/113023
More information about the llvm-commits
mailing list