Skip to content

Commit 619688f

Browse files
[IR] Avoid repeated hash lookups (NFC) (#110450)
1 parent bfa8519 commit 619688f

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

llvm/lib/IR/AsmWriter.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,12 +1338,8 @@ void SlotTracker::CreateMetadataSlot(const MDNode *N) {
13381338
void SlotTracker::CreateAttributeSetSlot(AttributeSet AS) {
13391339
assert(AS.hasAttributes() && "Doesn't need a slot!");
13401340

1341-
as_iterator I = asMap.find(AS);
1342-
if (I != asMap.end())
1343-
return;
1344-
1345-
unsigned DestSlot = asNext++;
1346-
asMap[AS] = DestSlot;
1341+
if (asMap.try_emplace(AS, asNext).second)
1342+
++asNext;
13471343
}
13481344

13491345
/// Create a new slot for the specified Module

0 commit comments

Comments
 (0)