This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Optimize getInputSections. NFC
ClosedPublic

Authored by MaskRay on Jul 5 2022, 1:49 AM.

Details

Summary

In the majority of cases (e.g. orphan sections), an OutputSection has at most
one InputSectionDescription (isd). By changing the return type to
ArrayRef<InputSection *> we can just reference the isd->sections. For
OutputSections with more than one InputSectionDescription we use a caller
provided SmallVector to copy the elements as before.

Diff Detail

Event Timeline

MaskRay created this revision.Jul 5 2022, 1:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 5 2022, 1:49 AM
MaskRay requested review of this revision.Jul 5 2022, 1:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 5 2022, 1:49 AM
peter.smith accepted this revision.Jul 5 2022, 3:43 AM

LGTM. A small suggestion for the description/commit message.

In the majority of cases (e.g. orphan sections), an OutputSection has at most one InputSectionDescription (isd). By changing the return type to ArrayRef<InputSection *> we can just reference the isd->sections. For OutputSections with more than one InputSectionDescription we use a caller provided SmallVector to copy the elements as before.
This revision is now accepted and ready to land.Jul 5 2022, 3:43 AM
MaskRay edited the summary of this revision. (Show Details)Jul 5 2022, 12:14 PM
This revision was landed with ongoing or failed builds.Jul 5 2022, 11:31 PM
This revision was automatically updated to reflect the committed changes.