[llvm] 4b3f0fa - [llvm-jitlink] Avoid repeated hash lookups (NFC) (#129422)

via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 2 01:12:36 PST 2025


Author: Kazu Hirata
Date: 2025-03-02T01:12:33-08:00
New Revision: 4b3f0fa7e7af69a514d7b855cff523539082b292

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

LOG: [llvm-jitlink] Avoid repeated hash lookups (NFC) (#129422)

Added: 
    

Modified: 
    llvm/tools/llvm-jitlink/llvm-jitlink.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
index 34c1b87ae58ad..85cf3a0195964 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -479,8 +479,8 @@ static Error applyHarnessPromotions(Session &S, LinkGraph &G) {
       continue;
 
     if (Sym->getLinkage() == Linkage::Weak) {
-      if (!S.CanonicalWeakDefs.count(*Sym->getName()) ||
-          S.CanonicalWeakDefs[*Sym->getName()] != G.getName()) {
+      auto It = S.CanonicalWeakDefs.find(*Sym->getName());
+      if (It == S.CanonicalWeakDefs.end() || It->second != G.getName()) {
         LLVM_DEBUG({
           dbgs() << "  Externalizing weak symbol " << Sym->getName() << "\n";
         });


        


More information about the llvm-commits mailing list