Skip to content

Commit 076342e

Browse files
[GVNSink] Avoid repeated hash lookups (NFC)
1 parent 8673d0e commit 076342e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/Transforms/Scalar/GVNSink.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,12 +535,12 @@ class ValueTable {
535535
uint32_t e = ExpressionNumbering[exp];
536536
if (!e) {
537537
hash_code H = exp->getHashValue([=](Value *V) { return lookupOrAdd(V); });
538-
auto I = HashNumbering.find(H);
539-
if (I != HashNumbering.end()) {
538+
auto [I, Inserted] = HashNumbering.try_emplace(H);
539+
if (!Inserted) {
540540
e = I->second;
541541
} else {
542542
e = nextValueNumber++;
543-
HashNumbering[H] = e;
543+
I->second = e;
544544
ExpressionNumbering[exp] = e;
545545
}
546546
}

0 commit comments

Comments
 (0)