[llvm] f33dca4 - [llvm-rtdyld] Avoid repeated hash lookups (NFC) (#130711)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 11 07:34:30 PDT 2025
Author: Kazu Hirata
Date: 2025-03-11T07:34:27-07:00
New Revision: f33dca41a3a0c4cea90b7c476b1cff9cade430e7
URL: https://github.com/llvm/llvm-project/commit/f33dca41a3a0c4cea90b7c476b1cff9cade430e7
DIFF: https://github.com/llvm/llvm-project/commit/f33dca41a3a0c4cea90b7c476b1cff9cade430e7.diff
LOG: [llvm-rtdyld] Avoid repeated hash lookups (NFC) (#130711)
Added:
Modified:
llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp b/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp
index 06ac98b0c5e13..40a7b86078d87 100644
--- a/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp
+++ b/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp
@@ -929,15 +929,17 @@ static int linkAndVerify() {
StringRef SymbolName,
StringRef KindNameFilter)
-> Expected<RuntimeDyldChecker::MemoryRegionInfo> {
- if (!StubMap.count(StubContainer))
+ auto SMIt = StubMap.find(StubContainer);
+ if (SMIt == StubMap.end())
return make_error<StringError>("Stub container not found: " +
StubContainer,
inconvertibleErrorCode());
- if (!StubMap[StubContainer].count(SymbolName))
+ auto It = SMIt->second.find(SymbolName);
+ if (It == SMIt->second.end())
return make_error<StringError>("Symbol name " + SymbolName +
" in stub container " + StubContainer,
inconvertibleErrorCode());
- auto &SI = StubMap[StubContainer][SymbolName];
+ auto &SI = It->second;
RuntimeDyldChecker::MemoryRegionInfo StubMemInfo;
StubMemInfo.setTargetAddress(Dyld.getSectionLoadAddress(SI.SectionID) +
SI.Offset);
More information about the llvm-commits
mailing list