Using the linker-supplied list of "preserved" symbols, we can compute
the list of "dead" symbols, i.e. the one that are not reachable from
a "preserved" symbol transitively on the reference graph.
Right now we are using this information to mark these functions as
non-eligible for import.
The impact is two folds:
- Reduction of compile time: we don't import these functions anywhere or import the function these symbols are calling.
- The limited number of import/export leads to better internalization.
Please also add this handling to LTO.cpp so that the optimization is available for all client linkers. As a bonus, then DeadSymbols doesn't need ot be optional. For LTO.cpp, the set of preserved GUIDs is currently computed just below the call to ComputeCrossModuleImport as ExportedGUIDs, and can simply be moved up so that it can be passed to computeDeadSymbols.
Alternatively, do we want to instead pass in the set of preserved GUIDs to ComputeCrossModuleImport and invoke computeDeadSymbols there, or do we anticipate that there will be other uses outside of ComptueCrossModuleImport? If not, then I think it is cleaner to do the dead symbol computation there.