Skip to content

Commit f33dca4

Browse files
[llvm-rtdyld] Avoid repeated hash lookups (NFC) (#130711)
1 parent 3339632 commit f33dca4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -929,15 +929,17 @@ static int linkAndVerify() {
929929
StringRef SymbolName,
930930
StringRef KindNameFilter)
931931
-> Expected<RuntimeDyldChecker::MemoryRegionInfo> {
932-
if (!StubMap.count(StubContainer))
932+
auto SMIt = StubMap.find(StubContainer);
933+
if (SMIt == StubMap.end())
933934
return make_error<StringError>("Stub container not found: " +
934935
StubContainer,
935936
inconvertibleErrorCode());
936-
if (!StubMap[StubContainer].count(SymbolName))
937+
auto It = SMIt->second.find(SymbolName);
938+
if (It == SMIt->second.end())
937939
return make_error<StringError>("Symbol name " + SymbolName +
938940
" in stub container " + StubContainer,
939941
inconvertibleErrorCode());
940-
auto &SI = StubMap[StubContainer][SymbolName];
942+
auto &SI = It->second;
941943
RuntimeDyldChecker::MemoryRegionInfo StubMemInfo;
942944
StubMemInfo.setTargetAddress(Dyld.getSectionLoadAddress(SI.SectionID) +
943945
SI.Offset);

0 commit comments

Comments
 (0)