[llvm] [ExecutionEngine] Avoid repeated hash lookups (NFC) (PR #127303)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 14 21:36:31 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/127303
None
>From 89ce13ee328c83ce6190e124b8ffc7ede43d1b81 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 14 Feb 2025 02:47:02 -0800
Subject: [PATCH] [ExecutionEngine] Avoid repeated hash lookups (NFC)
---
llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
index d4e341a96f5b1..380a173c1d7ed 100644
--- a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
@@ -635,11 +635,12 @@ void MachOPlatform::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