@@ -3007,13 +3007,12 @@ TreePatternNodePtr TreePattern::ParseTreePattern(const Init *TheInit,
30073007 // and "(MY_PAT $b, $a)" should not be allowed in the same pattern;
30083008 // neither should "(MY_PAT_1 $a, $b)" and "(MY_PAT_2 $a, $b)".
30093009 auto OperandId = std::make_pair (Operator, i);
3010- auto PrevOp = ComplexPatternOperands.find (Child->getName ());
3011- if (PrevOp != ComplexPatternOperands.end ()) {
3012- if (PrevOp->getValue () != OperandId)
3013- error (" All ComplexPattern operands must appear consistently: "
3014- " in the same order in just one ComplexPattern instance." );
3015- } else
3016- ComplexPatternOperands[Child->getName ()] = OperandId;
3010+ auto [PrevOp, Inserted] =
3011+ ComplexPatternOperands.try_emplace (Child->getName (), OperandId);
3012+ if (!Inserted && PrevOp->getValue () != OperandId) {
3013+ error (" All ComplexPattern operands must appear consistently: "
3014+ " in the same order in just one ComplexPattern instance." );
3015+ }
30173016 }
30183017 }
30193018
@@ -3095,14 +3094,14 @@ bool TreePattern::InferAllTypes(
30953094 // If we have input named node types, propagate their types to the named
30963095 // values here.
30973096 if (InNamedTypes) {
3098- if (!InNamedTypes->count (Entry.getKey ())) {
3097+ auto InIter = InNamedTypes->find (Entry.getKey ());
3098+ if (InIter == InNamedTypes->end ()) {
30993099 error (" Node '" + std::string (Entry.getKey ()) +
31003100 " ' in output pattern but not input pattern" );
31013101 return true ;
31023102 }
31033103
3104- const SmallVectorImpl<TreePatternNode *> &InNodes =
3105- InNamedTypes->find (Entry.getKey ())->second ;
3104+ const SmallVectorImpl<TreePatternNode *> &InNodes = InIter->second ;
31063105
31073106 // The input types should be fully resolved by now.
31083107 for (TreePatternNode *Node : Nodes) {
@@ -3855,7 +3854,8 @@ void CodeGenDAGPatterns::parseInstructionPattern(CodeGenInstruction &CGI,
38553854 continue ;
38563855 }
38573856
3858- if (!InstInputs.count (OpName)) {
3857+ auto InIter = InstInputs.find (OpName);
3858+ if (InIter == InstInputs.end ()) {
38593859 // If this is an operand with a DefaultOps set filled in, we can ignore
38603860 // this. When we codegen it, we will do so as always executed.
38613861 if (Op.Rec ->isSubClassOf (" OperandWithDefaultOps" )) {
@@ -3868,8 +3868,8 @@ void CodeGenDAGPatterns::parseInstructionPattern(CodeGenInstruction &CGI,
38683868 " does not appear in the instruction pattern" );
38693869 continue ;
38703870 }
3871- TreePatternNodePtr InVal = InstInputs[OpName] ;
3872- InstInputs.erase (OpName ); // It occurred, remove from map.
3871+ TreePatternNodePtr InVal = InIter-> second ;
3872+ InstInputs.erase (InIter ); // It occurred, remove from map.
38733873
38743874 if (InVal->isLeaf () && isa<DefInit>(InVal->getLeafValue ())) {
38753875 const Record *InRec = cast<DefInit>(InVal->getLeafValue ())->getDef ();
0 commit comments