This is an archive of the discontinued LLVM Phabricator instance.

[ThinLTO] Always emit a summary when compiling in ThinLTO mode
ClosedPublic

Authored by tejohnson on Sep 20 2016, 1:08 PM.

Details

Summary

Emit an empty summary section, instead of no summary section, when
there are no global variables in the index. This ensures that LTO
will treat these files as ThinLTO inputs, instead of as regular
LTO inputs.

In addition to not being what the user likely intended when
compiling with -flto=thin, the current behavior is problematic for
distributed build systems that expect to get ThinLTO index and imports
files back for each input compiled with -flto=thin. Combining into
a single regular LTO module also reduces the backend parallelism.
And in the case where the index was suppressed due to uses in
inline assembly, combining into a single LTO module could provoke
renaming of duplicates that we were trying to prevent by suppressing
the index.

This change required a couple of fixes to handle the empty summary
section.

Diff Detail

Repository
rL LLVM

Event Timeline

tejohnson updated this revision to Diff 71971.Sep 20 2016, 1:08 PM
tejohnson retitled this revision from to [ThinLTO] Always emit a summary when compiling in ThinLTO mode.
tejohnson updated this object.
tejohnson added a reviewer: mehdi_amini.
tejohnson added subscribers: pcc, llvm-commits.
mehdi_amini edited edge metadata.Sep 20 2016, 2:32 PM

Can you add a simple test that checks that a summary has been emitted? (So that we don't depend on the distributed thing to test this).
I believe we already have test for opt -module-summary, using llvm-bcanalyzer IIRC.

tejohnson updated this revision to Diff 71997.Sep 20 2016, 4:09 PM
tejohnson edited edge metadata.

Add llvm-bcanalyzer based test

mehdi_amini accepted this revision.Sep 20 2016, 4:15 PM
mehdi_amini edited edge metadata.

Thanks!

This revision is now accepted and ready to land.Sep 20 2016, 4:15 PM
This revision was automatically updated to reflect the committed changes.