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

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 26 20:38:12 PST 2025


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

None

>From 413f5cb410399a7dd590088a724ca7ddbf757156 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 26 Feb 2025 07:43:52 -0800
Subject: [PATCH] [ExecutionEngine] Avoid repeated hash lookups (NFC)

---
 llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp b/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
index 89a7a4e86f1bf..1b649227b38a0 100644
--- a/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
@@ -398,9 +398,10 @@ Error StaticLibraryDefinitionGenerator::tryToGenerate(
 
   for (const auto &KV : Symbols) {
     const auto &Name = KV.first;
-    if (!ObjectFilesMap.count(Name))
+    auto It = ObjectFilesMap.find(Name);
+    if (It == ObjectFilesMap.end())
       continue;
-    auto ChildBuffer = ObjectFilesMap[Name];
+    auto ChildBuffer = It->second;
     ChildBufferInfos.insert(
         {ChildBuffer.getBuffer(), ChildBuffer.getBufferIdentifier()});
   }



More information about the llvm-commits mailing list