[llvm] [TableGen] Avoid repeated hash lookups (NFC) (PR #120873)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 21 22:19:36 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/120873.diff
1 Files Affected:
- (modified) llvm/utils/TableGen/CallingConvEmitter.cpp (+5-4)
``````````diff
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);
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/120873
More information about the llvm-commits
mailing list