Skip to content

Commit 4cfeebd

Browse files
[ExecutionEngine] Avoid repeated hash lookups (NFC) (#127577)
1 parent 4405451 commit 4cfeebd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,11 +469,12 @@ void ELFNixPlatform::pushInitializersLoop(
469469
Worklist.pop_back();
470470

471471
// If we've already visited this JITDylib on this iteration then continue.
472-
if (JDDepMap.count(DepJD))
472+
auto [It, Inserted] = JDDepMap.try_emplace(DepJD);
473+
if (!Inserted)
473474
continue;
474475

475476
// Add dep info.
476-
auto &DM = JDDepMap[DepJD];
477+
auto &DM = It->second;
477478
DepJD->withLinkOrderDo([&](const JITDylibSearchOrder &O) {
478479
for (auto &KV : O) {
479480
if (KV.first == DepJD)

0 commit comments

Comments
 (0)