[llvm] b0e43f8 - [TableGen] Avoid repeated hash lookups (NFC) (#120873)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 22 01:30:29 PST 2024
Author: Kazu Hirata
Date: 2024-12-22T01:30:27-08:00
New Revision: b0e43f815ac69eaab503984a187d8099b5c4b707
URL: https://github.com/llvm/llvm-project/commit/b0e43f815ac69eaab503984a187d8099b5c4b707
DIFF: https://github.com/llvm/llvm-project/commit/b0e43f815ac69eaab503984a187d8099b5c4b707.diff
LOG: [TableGen] Avoid repeated hash lookups (NFC) (#120873)
Added:
Modified:
llvm/utils/TableGen/CallingConvEmitter.cpp
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/CallingConvEmitter.cpp b/llvm/utils/TableGen/CallingConvEmitter.cpp
index 444b10719cb034..b315aa7d86fe91 100644
--- a/llvm/utils/TableGen/CallingConvEmitter.cpp
+++ b/llvm/utils/TableGen/CallingConvEmitter.cpp
@@ -378,10 +378,11 @@ void CallingConvEmitter::emitArgRegisterLists(raw_ostream &O) {
const std::string &InnerCCName = InnerEntry.first;
std::set<std::string> &InnerRegisters = InnerEntry.second;
- if (InnerRegisters.find(CCName) != InnerRegisters.end()) {
- AssignedRegsMap[InnerCCName].insert(AssignedRegsMap[CCName].begin(),
- AssignedRegsMap[CCName].end());
- InnerRegisters.erase(CCName);
+ auto It = InnerRegisters.find(CCName);
+ if (It != InnerRegisters.end()) {
+ const auto &Src = AssignedRegsMap[CCName];
+ AssignedRegsMap[InnerCCName].insert(Src.begin(), Src.end());
+ InnerRegisters.erase(It);
}
}
More information about the llvm-commits
mailing list