This is an archive of the discontinued LLVM Phabricator instance.

[ThinLTO] Remove unused symbol declarations when possible
AbandonedPublic

Authored by tejohnson on Dec 4 2020, 11:16 AM.

Details

Reviewers
wmi
Summary

Follow on to D42816 which dropped declarations of dead symbols. With
this change we also drop declarations which were never defined in this
module, but which are also unused after dead symbols are removed. These
symbols may or may not be dead in their defining modules.

Removing the unused declarations will prevent indirect call promotion in
the ThinLTO Backend from adding a new reference to a symbol, which can
result in linker unsats if that symbol was in fact dead and therefore
removed in its defining module. This can happen when we compile with a
sample profile collected from one binary but used for another, which may
have profiled targets that aren't used in the new binary.

Some test changes occur as a result (for whole program devirtualization,
we end up with a cast if there is no declaration in the module, for ICP
tests we may need to add a direct call to keep the declaration around).

Diff Detail

Event Timeline

tejohnson created this revision.Dec 4 2020, 11:16 AM
tejohnson requested review of this revision.Dec 4 2020, 11:16 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptDec 4 2020, 11:16 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
tejohnson abandoned this revision.Dec 7 2020, 5:17 PM

Subsumed by D92804