Skip to content

[DWARFLinker] Avoid repeated hash lookups (NFC) #108737

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
13 changes: 4 additions & 9 deletions llvm/lib/DWARFLinker/Parallel/OutputSections.h
Original file line number Diff line number Diff line change
Expand Up @@ -371,16 +371,11 @@ class OutputSections {
/// If descriptor does not exist then creates it.
SectionDescriptor &
getOrCreateSectionDescriptor(DebugSectionKind SectionKind) {
SectionsSetTy::iterator It = SectionDescriptors.find(SectionKind);

if (It == SectionDescriptors.end()) {
SectionDescriptor *Section =
new SectionDescriptor(SectionKind, GlobalData, Format, Endianness);
auto Result = SectionDescriptors.try_emplace(SectionKind, Section);
assert(Result.second);
auto [It, Inserted] = SectionDescriptors.try_emplace(SectionKind);

It = Result.first;
}
if (Inserted)
It->second = std::make_shared<SectionDescriptor>(SectionKind, GlobalData,
Format, Endianness);

return *It->second;
}
Expand Down
Loading