From 4b4cd645a829b8e510bdb008f449969d7bf53c30 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sun, 13 Apr 2025 05:46:15 -0700 Subject: [PATCH] [ExecutionEngine] Avoid repeated map lookups (NFC) (#135541) --- llvm/lib/ExecutionEngine/Orc/DebugObjectManagerPlugin.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/llvm/lib/ExecutionEngine/Orc/DebugObjectManagerPlugin.cpp b/llvm/lib/ExecutionEngine/Orc/DebugObjectManagerPlugin.cpp index 80b7452a0b22..15e583ca7685 100644 --- a/llvm/lib/ExecutionEngine/Orc/DebugObjectManagerPlugin.cpp +++ b/llvm/lib/ExecutionEngine/Orc/DebugObjectManagerPlugin.cpp @@ -475,8 +475,9 @@ Error DebugObjectManagerPlugin::notifyEmitted( FinalizePromise.set_value(MR.withResourceKeyDo([&](ResourceKey K) { assert(PendingObjs.count(&MR) && "We still hold PendingObjsLock"); std::lock_guard Lock(RegisteredObjsLock); - RegisteredObjs[K].push_back(std::move(PendingObjs[&MR])); - PendingObjs.erase(&MR); + auto It = PendingObjs.find(&MR); + RegisteredObjs[K].push_back(std::move(It->second)); + PendingObjs.erase(It); })); });