This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Avoid referencing SectionBase::repl after ICF
ClosedPublic

Authored by MaskRay on Dec 21 2021, 1:16 AM.

Details

Summary

It is fairly easy to forget SectionBase::repl after ICF.
Let ICF rewrite a Defined symbol's section field to avoid references to
SectionBase::repl in subsequent passes. This slightly improves the --icf=none
performance due to less indirection (maybe for --icf={safe,all} as well if most
symbols are Defined).

With this change, there is only one reference to repl (--gdb-index D89751).
We can undo f4fb5fd7523f8e3c3b3966d43c0a28457b59d1d8 (Move Repl to SectionBase.)
but move repl to InputSection instead.

Diff Detail

Event Timeline

MaskRay created this revision.Dec 21 2021, 1:16 AM
MaskRay requested review of this revision.Dec 21 2021, 1:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 21 2021, 1:16 AM
ikudrin accepted this revision.Dec 24 2021, 2:30 AM

LGTM

lld/ELF/InputSection.cpp
950–951

The comment has to be updated.

This revision is now accepted and ready to land.Dec 24 2021, 2:30 AM
MaskRay updated this revision to Diff 396170.Dec 24 2021, 11:07 AM
MaskRay marked an inline comment as done.

update comment

MaskRay edited the summary of this revision. (Show Details)Dec 24 2021, 11:28 AM
MaskRay updated this revision to Diff 396175.Dec 24 2021, 12:09 PM
MaskRay edited the summary of this revision. (Show Details)

Move repl to InputSection

This revision was landed with ongoing or failed builds.Dec 24 2021, 12:09 PM
This revision was automatically updated to reflect the committed changes.