This is an archive of the discontinued LLVM Phabricator instance.

[ThinLTO] - Fix for "ThinLTO inlines variables that should be discarded".
ClosedPublic

Authored by grimar on Feb 1 2018, 8:02 AM.

Details

Summary

This fixes PR36187.

Patch teaches ThinLTO to drop non-prevailing variables,
just like we recently did for functions (in r323633).

Diff Detail

Repository
rL LLVM

Event Timeline

grimar created this revision.Feb 1 2018, 8:02 AM
tejohnson accepted this revision.Feb 1 2018, 8:22 AM

LGTM with some comment requests below.

lib/LTO/LTOBackend.cpp
410 ↗(On Diff #132399)

add a FIXME comment somewhere here that we eventually want to drop dead aliases, but that this needs support in convertToDeclaration. Can you also add a FIXME into convertToDeclaration that alias support is needed for dropDeadSymbols to behave correctly for aliases? It would also be great to file a bug to track the alias handling, similar to the bug you filed for global variables for this patch.

411 ↗(On Diff #132399)

add comment that this is walking functions (when investigating this I had to go look at Module.h to confirm what is returned by the default iterator).

This revision is now accepted and ready to land.Feb 1 2018, 8:22 AM
grimar marked 2 inline comments as done.Feb 2 2018, 4:19 AM
grimar added inline comments.
lib/LTO/LTOBackend.cpp
410 ↗(On Diff #132399)

I added comment to dropDeadSymbols before commit.
Will try to prepare testcase, fill the bug and add the second comment in a follow up.

This revision was automatically updated to reflect the committed changes.
grimar marked an inline comment as done.