Skip to content

[Object] Avoid repeated hash lookups (NFC) #123448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions llvm/lib/Object/GOFFObjectFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ const uint8_t *GOFFObjectFile::getSymbolEsdRecord(DataRefImpl Symb) const {
}

Expected<StringRef> GOFFObjectFile::getSymbolName(DataRefImpl Symb) const {
if (EsdNamesCache.count(Symb.d.a)) {
auto &StrPtr = EsdNamesCache[Symb.d.a];
if (auto It = EsdNamesCache.find(Symb.d.a); It != EsdNamesCache.end()) {
auto &StrPtr = It->second;
return StringRef(StrPtr.second.get(), StrPtr.first);
}

Expand Down Expand Up @@ -459,8 +459,8 @@ uint64_t GOFFObjectFile::getSectionSize(DataRefImpl Sec) const {
// a contiguous sequence of bytes.
Expected<ArrayRef<uint8_t>>
GOFFObjectFile::getSectionContents(DataRefImpl Sec) const {
if (SectionDataCache.count(Sec.d.a)) {
auto &Buf = SectionDataCache[Sec.d.a];
if (auto It = SectionDataCache.find(Sec.d.a); It != SectionDataCache.end()) {
auto &Buf = It->second;
return ArrayRef<uint8_t>(Buf);
}
uint64_t SectionSize = getSectionSize(Sec);
Expand Down
Loading