This is an archive of the discontinued LLVM Phabricator instance.

Remove "ExportingModule" from ThinLTO Index
ClosedPublic

Authored by mehdi_amini on Dec 1 2015, 6:40 PM.

Details

Reviewers
tejohnson
Summary

There is no real reason the index has to have the concept of an
exporting Module. We should be able to have one single unique
instance of the Index, and it should be read-only after creation
for the whole ThinLTO processing.
The linker plugin should be able to process multiple modules (in
parallel or in sequence) with the same index.

The only reason the ExportingModule was present seems to be to
implement hasExportedFunctions() that is used by the Module linker
to decide what to do with the current Module.
For now I replaced it with a query to the map of Modules path to
see if this module was declared in the Index and consider that if
it is the case then it is probably exporting function.
On the long term the Linker interface needs to evolve and this
call should not be needed anymore.

Diff Detail

Event Timeline

mehdi_amini updated this revision to Diff 41588.Dec 1 2015, 6:40 PM
mehdi_amini retitled this revision from to Remove "ExportingModule" from ThinLTO Index.
mehdi_amini updated this object.
mehdi_amini added a reviewer: tejohnson.
mehdi_amini added subscribers: llvm-commits, dexonsmith.
tejohnson accepted this revision.Dec 2 2015, 9:29 AM
tejohnson edited edge metadata.

Yes your new check should be sufficient. Eventually when we prune functions from the index that are unlikely to be profitable to import (e.g. they are cold), we should ensure the module string isn't added to the combined index. Looks like that will happen naturally if we do the pruning before we add the module string in FunctionInfoIndex::mergeFrom().

LGTM

This revision is now accepted and ready to land.Dec 2 2015, 9:29 AM