This is an archive of the discontinued LLVM Phabricator instance.

[ThinLTO] only emit used or referenced CFI records to index
ClosedPublic

Authored by inglorion on Jun 27 2019, 10:52 AM.

Details

Summary

We emit CFI_FUNCTION_DEFS and CFI_FUNCTION_DECLS to
distributed ThinLTO indices to implement indirect function call
checking. This change causes us to only emit entries for functions
that are either defined or used by the module we're writing the index
for (instead of all functions in the combined index), which can make
the indices substantially smaller.

Fixes PR42378.

Diff Detail

Repository
rL LLVM

Event Timeline

inglorion created this revision.Jun 27 2019, 10:52 AM

Use ModuleToSummariesForIndex to find GUIDs defined or used by the module

As an example of what this does, I build Chrome (crrev.com/c/1673234 + crrev.com/c/1654198)'s base_unittests with and without this patch and looked at the sizes of the files generated for ThinLTO (.thinlto.bc, imports files, and native .o files).

without patch:

build time: 4:00.55
size of generated files: 1.5G

with patch:

build time: 3:54.38
size of generated files: 754M

The generated base_unittests binary was the same size and passes tests with or without the patch.

inglorion updated this revision to Diff 207886.Jul 3 2019, 2:02 PM
inglorion retitled this revision from [PoC][ThinLTO] only emit used or referenced CFI records to index to [ThinLTO] only emit used or referenced CFI records to index.
inglorion edited the summary of this revision. (Show Details)
inglorion added reviewers: pcc, vitalybuka, eugenis.

Added test and reworded commit message.

inglorion updated this revision to Diff 207887.Jul 3 2019, 2:03 PM

clang-format

vitalybuka accepted this revision.Jul 8 2019, 2:41 PM
vitalybuka added inline comments.
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
3886 ↗(On Diff #207887)

why do you need this change?

This revision is now accepted and ready to land.Jul 8 2019, 2:41 PM
inglorion updated this revision to Diff 208752.Jul 9 2019, 11:15 AM

rebase and back out unnecessary change

inglorion accepted this revision.Jul 9 2019, 11:17 AM
inglorion marked 2 inline comments as done.

Thanks for the review!

llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
3886 ↗(On Diff #207887)

Thanks for spotting that! I don't need this anymore, but forgot to undo it. Undone now.

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