[lld] [lld] Avoid repeated hash lookups (NFC) (PR #112119)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 12 21:14:04 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lld
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/112119.diff
1 Files Affected:
- (modified) lld/ELF/Arch/ARM.cpp (+3-2)
``````````diff
diff --git a/lld/ELF/Arch/ARM.cpp b/lld/ELF/Arch/ARM.cpp
index 7a7348c04a88c0..2219d2d6ce0c41 100644
--- a/lld/ELF/Arch/ARM.cpp
+++ b/lld/ELF/Arch/ARM.cpp
@@ -1103,10 +1103,11 @@ static void toLittleEndianInstructions(uint8_t *buf, uint64_t start,
// [$t, non $t) and convert these to little endian a word or half word at a
// time respectively.
void elf::convertArmInstructionstoBE8(InputSection *sec, uint8_t *buf) {
- if (!sectionMap.contains(sec))
+ auto it = sectionMap.find(sec);
+ if (it == sectionMap.end())
return;
- SmallVector<const Defined *, 0> &mapSyms = sectionMap[sec];
+ SmallVector<const Defined *, 0> &mapSyms = it->second;
if (mapSyms.empty())
return;
``````````
</details>
https://github.com/llvm/llvm-project/pull/112119
More information about the llvm-commits
mailing list