[llvm] 0575815 - [TableGen] Avoid repeated hash lookups (NFC) (#120681)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 20 10:29:01 PST 2024
Author: Kazu Hirata
Date: 2024-12-20T10:28:58-08:00
New Revision: 0575815b70b486240ace728a33f756cea8fe58fa
URL: https://github.com/llvm/llvm-project/commit/0575815b70b486240ace728a33f756cea8fe58fa
DIFF: https://github.com/llvm/llvm-project/commit/0575815b70b486240ace728a33f756cea8fe58fa.diff
LOG: [TableGen] Avoid repeated hash lookups (NFC) (#120681)
Added:
Modified:
llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
index 1a393beaa14f96..1a61d32b4869a4 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 {
More information about the llvm-commits
mailing list