Skip to content

Commit efae9f3

Browse files
[MIRParser] Avoid repeated map lookups (NFC) (#123561)
1 parent 7fa1936 commit efae9f3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/CodeGen/MIRParser/MIParser.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,9 +1316,10 @@ bool MIParser::parseMachineMetadata() {
13161316

13171317
assert(PFS.MachineMetadataNodes[ID] == MD && "Tracking VH didn't work");
13181318
} else {
1319-
if (PFS.MachineMetadataNodes.count(ID))
1319+
auto [It, Inserted] = PFS.MachineMetadataNodes.try_emplace(ID);
1320+
if (!Inserted)
13201321
return error("Metadata id is already used");
1321-
PFS.MachineMetadataNodes[ID].reset(MD);
1322+
It->second.reset(MD);
13221323
}
13231324

13241325
return false;

0 commit comments

Comments
 (0)