This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Optimization to LinkerScript::computeInputSections NFC
ClosedPublic

Authored by andrewng on Jan 15 2020, 9:01 AM.

Details

Summary

Moved the section name check ahead of any filename matching or
exclusion. Firstly, this reduces the need to retrieve the filename and
secondly, reduces the amount of potentially expensive filename pattern
matching if such rules are present in the linker script.

The impact of this change is particularly significant when linking
objects built with -ffunction-sections and -fstack-size-section, using a
linker script that includes non-trivial filename patterns. In a number
of such cases, the link time is halved.

Diff Detail

Event Timeline

andrewng created this revision.Jan 15 2020, 9:01 AM
Herald added a project: Restricted Project. · View Herald Transcript
MaskRay accepted this revision.Jan 15 2020, 10:37 AM
MaskRay added inline comments.
lld/ELF/LinkerScript.cpp
429

check the section name

This revision is now accepted and ready to land.Jan 15 2020, 10:37 AM

It'd be great if you can provide the exact numbers.

It'd be great if you can provide the exact numbers.

No stack sizesStack SizesOverhead of stack sizes
Link 11.246s2.127s70.71%
Link 1*0.874s0.995s13.84%
Link 22.042s3.885s90.25%
Link 2*1.635s1.933s18.23%

Where * = with this patch
Run with a release build with assertions enabled on Windows 10 with AMD Ryzen 3900X (12C/24T).

This revision was automatically updated to reflect the committed changes.