This is an archive of the discontinued LLVM Phabricator instance.

[ThinLTO] Handle bitcode without function summary sections gracefully
ClosedPublic

Authored by tejohnson on Nov 21 2015, 8:03 AM.

Details

Summary

Several fixes to the handling of bitcode files without function summary
sections so that they are skipped during ThinLTO processing in llvm-lto
and the gold plugin when appropriate instead of aborting.

1 Don't assert when trying to add a FunctionInfo that doesn't have

a summary attached.

2 Skip FunctionInfo structures that don't have attached function summary

sections when trying to create the combined function summary.

3 In both llvm-lto and gold-plugin, check whether a bitcode file has

a function summary section before trying to parse the index, and skip
the bitcode file if it does not.

4 Fix hasFunctionSummaryInMemBuffer in BitcodeReader, which had a bug

where we returned to early while looking for the summary section.

Also added llvm-lto and gold-plugin based tests for cases where we
don't have function summaries in the bitcode file. I verified that
either the first couple fixes described above are enough to avoid the
crashes, or fixes 1,3,4. But have combined them all here for added
robustness.

Diff Detail

Event Timeline

tejohnson updated this revision to Diff 40870.Nov 21 2015, 8:03 AM
tejohnson retitled this revision from to [ThinLTO] Handle bitcode without function summary sections gracefully.
tejohnson updated this object.
tejohnson added a reviewer: mehdi_amini.
tejohnson added a subscriber: llvm-commits.
mehdi_amini accepted this revision.Nov 21 2015, 11:10 AM
mehdi_amini edited edge metadata.

LGTM, thanks.

This revision is now accepted and ready to land.Nov 21 2015, 11:10 AM
This revision was automatically updated to reflect the committed changes.