[llvm] [ExecutionEngine] Avoid repeated hash lookups (NFC) (PR #110451)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 29 22:05:39 PDT 2024


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/110451

None

>From 66bc8f4d9f95dee5d8b276890aaa91bcdbbcc75b Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 29 Sep 2024 09:01:04 -0700
Subject: [PATCH] [ExecutionEngine] Avoid repeated hash lookups (NFC)

---
 llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp
index eab0dfa47e1e7d..cdfcae86f79c28 100644
--- a/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp
@@ -521,10 +521,8 @@ void COFFPlatform::pushInitializersLoop(PushInitializersSendResultFn SendResult,
       }
 
       for (auto *DepJD : JDDepMap[CurJD])
-        if (!Visited.count(DepJD)) {
+        if (Visited.insert(DepJD).second)
           Worklist.push_back(DepJD);
-          Visited.insert(DepJD);
-        }
     }
   });
 



More information about the llvm-commits mailing list