Skip to content

Commit f30ff0b

Browse files
[TableGen] Avoid repeated hash lookups (NFC) (#123161)
1 parent 95d21f6 commit f30ff0b

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -875,10 +875,8 @@ unsigned RuleMatcher::getInsnVarID(InstructionMatcher &InsnMatcher) const {
875875
}
876876

877877
void RuleMatcher::defineOperand(StringRef SymbolicName, OperandMatcher &OM) {
878-
if (!DefinedOperands.contains(SymbolicName)) {
879-
DefinedOperands[SymbolicName] = &OM;
878+
if (DefinedOperands.try_emplace(SymbolicName, &OM).second)
880879
return;
881-
}
882880

883881
// If the operand is already defined, then we must ensure both references in
884882
// the matcher have the exact same node.
@@ -889,8 +887,7 @@ void RuleMatcher::defineOperand(StringRef SymbolicName, OperandMatcher &OM) {
889887
}
890888

891889
void RuleMatcher::definePhysRegOperand(const Record *Reg, OperandMatcher &OM) {
892-
if (!PhysRegOperands.contains(Reg))
893-
PhysRegOperands[Reg] = &OM;
890+
PhysRegOperands.try_emplace(Reg, &OM);
894891
}
895892

896893
InstructionMatcher &

0 commit comments

Comments
 (0)