This is an archive of the discontinued LLVM Phabricator instance.

Change ModuleLinker to take a set of GlobalValues to import instead of a single one
ClosedPublic

Authored by mehdi_amini on Nov 30 2015, 10:43 PM.

Details

Summary

For efficiency reason, when importing multiple functions for the same Module,
we can avoid reparsing it every time.

Diff Detail

Event Timeline

mehdi_amini retitled this revision from to Change ModuleLinker to take a set of GlobalValues to import instead of a single one.
mehdi_amini updated this object.
mehdi_amini added reviewers: tejohnson, rafael.
mehdi_amini added subscribers: dexonsmith, llvm-commits.
tejohnson added inline comments.Dec 1 2015, 6:49 AM
lib/Transforms/IPO/FunctionImport.cpp
107

I don't see this map being populated anywhere?

192

Needs merge - I have already implemented this functionality in head.

204

This fundamentally changes the pass from doing an iterative worklist approach to a single pass of import per module, and makes it more difficult to go to a priority queue type approach. I don't think it will merge with the changes I made from head for adding newly imported external calls to the worklist actually.

We may not decide it is profitable to import every external call into a particular module at once. E.g. we may see a cold-ish call into an external module, and later after another import expose a hotter call that bumps its priority. I'm fine with passing in a list of functions to import in one go though - there may be multiple calls into that module that have similar priority, and they can be batch imported.

Perhaps add in the mechanics for doing a list of imports, but leave out the changes to this function for now (and just continue to pass in a single function) until we figure out how that should work.

mehdi_amini updated this revision to Diff 41583.Dec 1 2015, 5:30 PM

Rebased. There is only the API change now, we can't yet take advantage of this.

tejohnson accepted this revision.Dec 1 2015, 7:54 PM
tejohnson edited edge metadata.
This revision is now accepted and ready to land.Dec 1 2015, 7:54 PM

LGTM, thanks

rafael accepted this revision.Dec 2 2015, 6:08 AM
rafael edited edge metadata.

LGTM