From 326ff72499f37cf21451b4b0ff0fba7dee6ec344 Mon Sep 17 00:00:00 2001 From: Kazu Hirata 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 7a7348c04a88c0e..2219d2d6ce0c41c 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 &mapSyms = sectionMap[sec]; + SmallVector &mapSyms = it->second; if (mapSyms.empty()) return;