diff --git a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp index 1a393beaa14f9..1a61d32b4869a 100644 --- a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp +++ b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp @@ -3508,9 +3508,8 @@ void CodeGenDAGPatterns::FindPatternInputsAndOutputs( Val->getDef()->isSubClassOf("PointerLikeRegClass")) { if (Dest->getName().empty()) I.error("set destination must have a name!"); - if (InstResults.count(Dest->getName())) + if (!InstResults.insert_or_assign(Dest->getName(), Dest).second) I.error("cannot set '" + Dest->getName() + "' multiple times"); - InstResults[Dest->getName()] = Dest; } else if (Val->getDef()->isSubClassOf("Register")) { InstImpResults.push_back(Val->getDef()); } else {