Prototype for an ORC layer that discovers future callees from ThinLTO module summaries. It aims to minimize frontloading and compiler interception overhead.
When adding a module, instead of parsing the entire IR code, the layer will only read its summary and merge it into the global index.
When querying an initial function, the layer will identify the defining module and stage it for compilation. Additionally it discovers all callees from that function, stage their modules and so on.
Materialization for the initial function will then trigger materialization of all callees.
Discovery is not yet configurable. It only runs once and unlimited. Undiscovered call sites will cause resolution errors in the linking layer.
The goal is to limit discovery and insert special stubs at the end points, that would trigger further discovery once execution arrives there. This requires some more work though.
For now I would like to discuss the general approach and find a good way to get rid of the current hack in Core.cpp (search for hackReplaceGuidWithNameIn).
This helped me a lot in debugging.