[lld] [lld] Avoid repeated hash lookups (NFC) (PR #112119)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 12 21:13:30 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/112119
None
>From 326ff72499f37cf21451b4b0ff0fba7dee6ec344 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 12 Oct 2024 08:12:34 -0700
Subject: [PATCH] [lld] Avoid repeated hash lookups (NFC)
---
lld/ELF/Arch/ARM.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
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;
More information about the llvm-commits
mailing list