This is an archive of the discontinued LLVM Phabricator instance.

COFF: Do not create SectionChunks for discarded comdat sections.
ClosedPublic

Authored by pcc on Nov 19 2017, 11:49 PM.

Details

Summary

With this change, instead of creating a SectionChunk for each section
in the object file, we only create them when we encounter a prevailing
comdat section.

Also change how symbol resolution occurs between comdat symbols. Now
only the comdat leader participates in comdat resolution, and not any
other external associated symbols. This is more in line with how COFF
semantics are defined, and should allow for a more straightforward
implementation of non-ANY comdat types.

On my machine, this change reduces our runtime linking a release
build of chrome_child.dll with /nopdb from 5.65s to 4.54s (median of
50 runs).

Diff Detail

Repository
rL LLVM

Event Timeline

pcc created this revision.Nov 19 2017, 11:49 PM
pcc updated this revision to Diff 123708.Nov 20 2017, 7:27 PM
  • Finish LTO implementation
pcc retitled this revision from [wip] COFF: Do not create SectionChunks for discarded comdat sections. to COFF: Do not create SectionChunks for discarded comdat sections..Nov 20 2017, 7:27 PM
pcc edited the summary of this revision. (Show Details)
ruiu added inline comments.Nov 20 2017, 10:46 PM
lld/COFF/InputFiles.cpp
142 ↗(On Diff #123708)

It seems a bit odd that you ignored a return value here. Turns out that readSection mutates SparseChunks as a side effect. But can you remove that assignment from that function and instead doing it explicitly in this line?

214 ↗(On Diff #123708)

I'd return early if Parent is PendingComdat.

222 ↗(On Diff #123708)

Replace auto with its actual type.

276 ↗(On Diff #123708)

Do you think you can make readSectionDefinition to have fewer side effects? Not always using its return value seems a bit odd.

lld/COFF/InputFiles.h
148 ↗(On Diff #123708)

Can you add a blank line after a multi-line declaration?

lld/COFF/SymbolTable.cpp
241 ↗(On Diff #123708)

Maybe just returning {S, true} and {S, false} is easier to read than using Prevailing variable.

242 ↗(On Diff #123708)

nit: add {}

pcc updated this revision to Diff 124013.Nov 22 2017, 2:59 PM
pcc marked 6 inline comments as done.
  • Address review comments
pcc marked an inline comment as done.Nov 22 2017, 3:00 PM
ruiu accepted this revision.Nov 27 2017, 9:46 AM

LGTM

lld/COFF/InputFiles.cpp
251–252 ↗(On Diff #124013)

else if

333 ↗(On Diff #124013)

auto -> const coff_aux_section_definition *

lld/COFF/SymbolTable.cpp
241 ↗(On Diff #124013)

Remove else after return.

This revision is now accepted and ready to land.Nov 27 2017, 9:46 AM
This revision was automatically updated to reflect the committed changes.
pcc marked 3 inline comments as done.