[llvm] ede866d - [ExecutionEngine] Avoid repeated hash lookups (NFC) (#110621)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 1 07:48:45 PDT 2024
Author: Kazu Hirata
Date: 2024-10-01T07:48:41-07:00
New Revision: ede866d708c1af64d333da77b024ce2b50b2a5da
URL: https://github.com/llvm/llvm-project/commit/ede866d708c1af64d333da77b024ce2b50b2a5da
DIFF: https://github.com/llvm/llvm-project/commit/ede866d708c1af64d333da77b024ce2b50b2a5da.diff
LOG: [ExecutionEngine] Avoid repeated hash lookups (NFC) (#110621)
Added:
Modified:
llvm/lib/ExecutionEngine/Orc/Debugging/VTuneSupportPlugin.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ExecutionEngine/Orc/Debugging/VTuneSupportPlugin.cpp b/llvm/lib/ExecutionEngine/Orc/Debugging/VTuneSupportPlugin.cpp
index 30a9728c8c20e3..de02a20524b9cb 100644
--- a/llvm/lib/ExecutionEngine/Orc/Debugging/VTuneSupportPlugin.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Debugging/VTuneSupportPlugin.cpp
@@ -39,12 +39,12 @@ static VTuneMethodBatch getMethodBatch(LinkGraph &G, bool EmitDebugInfo) {
auto GetStringIdx = [Deduplicator = StringMap<uint32_t>(),
&Batch](StringRef S) mutable {
- auto I = Deduplicator.find(S);
- if (I != Deduplicator.end())
- return I->second;
-
- Batch.Strings.push_back(S.str());
- return Deduplicator[S] = Batch.Strings.size();
+ auto [I, Inserted] = Deduplicator.try_emplace(S);
+ if (Inserted) {
+ Batch.Strings.push_back(S.str());
+ I->second = Batch.Strings.size();
+ }
+ return I->second;
};
for (auto Sym : G.defined_symbols()) {
if (!Sym->isCallable())
More information about the llvm-commits
mailing list