[lld] 1641745 - [lld] Avoid repeated hash lookups (NFC) (#112119)

via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 13 07:33:35 PDT 2024


Author: Kazu Hirata
Date: 2024-10-13T07:33:32-07:00
New Revision: 1641745530efe198dcaafa2f43dc1979e6b50993

URL: https://github.com/llvm/llvm-project/commit/1641745530efe198dcaafa2f43dc1979e6b50993
DIFF: https://github.com/llvm/llvm-project/commit/1641745530efe198dcaafa2f43dc1979e6b50993.diff

LOG: [lld] Avoid repeated hash lookups (NFC) (#112119)

Added: 
    

Modified: 
    lld/ELF/Arch/ARM.cpp

Removed: 
    


################################################################################
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