[llvm] [TableGen] Avoid repeated hash lookups (NFC) (PR #120681)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 19 20:07:45 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-tablegen
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/120681.diff
1 Files Affected:
- (modified) llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp (+1-2)
``````````diff
diff --git a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
index 1a393beaa14f96..7a82581f2240ce 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.try_emplace(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 {
``````````
</details>
https://github.com/llvm/llvm-project/pull/120681
More information about the llvm-commits
mailing list