[llvm] 9372d1d - [TableGen] Avoid repeated hash lookups (NFC) (#129655)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 4 01:50:33 PST 2025
Author: Kazu Hirata
Date: 2025-03-04T01:50:30-08:00
New Revision: 9372d1d72ab287d5121ca1961dd416cf51224e62
URL: https://github.com/llvm/llvm-project/commit/9372d1d72ab287d5121ca1961dd416cf51224e62
DIFF: https://github.com/llvm/llvm-project/commit/9372d1d72ab287d5121ca1961dd416cf51224e62.diff
LOG: [TableGen] Avoid repeated hash lookups (NFC) (#129655)
Added:
Modified:
llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.cpp
Removed:
################################################################################
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();
More information about the llvm-commits
mailing list