diff --git a/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.cpp b/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.cpp index 21db090f62cce..4c809b4016cbd 100644 --- a/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.cpp +++ b/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.cpp @@ -834,7 +834,9 @@ Error RuleMatcher::defineComplexSubOperand(StringRef SymbolicName, unsigned SubOperandID, StringRef ParentSymbolicName) { std::string ParentName(ParentSymbolicName); - if (ComplexSubOperands.count(SymbolicName)) { + auto [It, Inserted] = ComplexSubOperands.try_emplace( + SymbolicName, ComplexPattern, RendererID, SubOperandID); + if (!Inserted) { const std::string &RecordedParentName = ComplexSubOperandsParentName[SymbolicName]; if (RecordedParentName != ParentName) @@ -847,7 +849,6 @@ Error RuleMatcher::defineComplexSubOperand(StringRef SymbolicName, return Error::success(); } - ComplexSubOperands[SymbolicName] = {ComplexPattern, RendererID, SubOperandID}; ComplexSubOperandsParentName[SymbolicName] = std::move(ParentName); return Error::success();