This is an archive of the discontinued LLVM Phabricator instance.

Update ThinLTO Indexing logic
ClosedPublic

Authored by rdhindsa on May 4 2018, 3:33 PM.

Details

Summary
  1. Instead of writing empty index for file, this patch tracks the state of files in ObjectToIndexFileState. If the files are not indexed , only then we emit the empty files.
  2. For ThinLTO Index only, skip cache pruning and iterating over tasks, since there is at most one output object file

Diff Detail

Repository
rL LLVM

Event Timeline

rdhindsa created this revision.May 4 2018, 3:33 PM
tejohnson added inline comments.May 4 2018, 3:42 PM
lld/ELF/LTO.cpp
300 ↗(On Diff #145312)

There won't always be a regular LTO file created via splitting for ThinLTO builds, so Buff[0] should be empty some of the time. Do you have a test for this case?

The other thing being done by the loop below is a call to createObjectFile, does that need to be done for Buff[0] if non-empty too?

pcc added a comment.May 4 2018, 4:00 PM

This seems fine for now, but instead of copying this behaviour into LLD, it really ought to be a feature of the LTO implementation.

lld/ELF/LTO.cpp
262–269 ↗(On Diff #145312)

I think this needs to be moved after the call to LTO::run.

300 ↗(On Diff #145312)

Buff[0] should always be non-empty, see D41267.

rdhindsa updated this revision to Diff 145508.May 7 2018, 11:37 AM
rdhindsa marked an inline comment as done.May 7 2018, 11:40 AM
rdhindsa added inline comments.
lld/ELF/LTO.cpp
300 ↗(On Diff #145312)

I have added the test as well to ensure that one file is generated in this case. We just need to save this file and, we don't need to call createObjectFile, since we exit from LLD just after this step.

This LGTM, but wait until pcc or ruiu accept it.

pcc added a comment.May 7 2018, 9:31 PM

I think this will need a rebase.

rdhindsa updated this revision to Diff 145753.May 8 2018, 12:00 PM

Rebased diff.

pcc accepted this revision.May 8 2018, 12:26 PM

LGTM

This revision is now accepted and ready to land.May 8 2018, 12:26 PM
This revision was automatically updated to reflect the committed changes.