[llvm] 4cfeebd - [ExecutionEngine] Avoid repeated hash lookups (NFC) (#127577)

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 18 08:39:47 PST 2025


Author: Kazu Hirata
Date: 2025-02-18T08:39:44-08:00
New Revision: 4cfeebd9b4823025ed6bd992cf9310725e487aea

URL: https://github.com/llvm/llvm-project/commit/4cfeebd9b4823025ed6bd992cf9310725e487aea
DIFF: https://github.com/llvm/llvm-project/commit/4cfeebd9b4823025ed6bd992cf9310725e487aea.diff

LOG: [ExecutionEngine] Avoid repeated hash lookups (NFC) (#127577)

Added: 
    

Modified: 
    llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp
index 7f0a45941cf9b..9ac8c5ef66de6 100644
--- a/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp
@@ -469,11 +469,12 @@ void ELFNixPlatform::pushInitializersLoop(
       Worklist.pop_back();
 
       // If we've already visited this JITDylib on this iteration then continue.
-      if (JDDepMap.count(DepJD))
+      auto [It, Inserted] = JDDepMap.try_emplace(DepJD);
+      if (!Inserted)
         continue;
 
       // Add dep info.
-      auto &DM = JDDepMap[DepJD];
+      auto &DM = It->second;
       DepJD->withLinkOrderDo([&](const JITDylibSearchOrder &O) {
         for (auto &KV : O) {
           if (KV.first == DepJD)


        


More information about the llvm-commits mailing list