diff --git a/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.cpp b/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.cpp index a81f2b53f2846..d56623ed60b36 100644 --- a/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.cpp +++ b/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.cpp @@ -875,10 +875,8 @@ unsigned RuleMatcher::getInsnVarID(InstructionMatcher &InsnMatcher) const { } void RuleMatcher::defineOperand(StringRef SymbolicName, OperandMatcher &OM) { - if (!DefinedOperands.contains(SymbolicName)) { - DefinedOperands[SymbolicName] = &OM; + if (DefinedOperands.try_emplace(SymbolicName, &OM).second) return; - } // If the operand is already defined, then we must ensure both references in // the matcher have the exact same node. @@ -889,8 +887,7 @@ void RuleMatcher::defineOperand(StringRef SymbolicName, OperandMatcher &OM) { } void RuleMatcher::definePhysRegOperand(const Record *Reg, OperandMatcher &OM) { - if (!PhysRegOperands.contains(Reg)) - PhysRegOperands[Reg] = &OM; + PhysRegOperands.try_emplace(Reg, &OM); } InstructionMatcher &