I've found the piece of code running on ThinLTO internalization phase which seems useless to me.
Also no test seems to depend on it. I've run check-llvm after removal and it passes flawlessly.
It looks like undefined assembly symbols are first put to GlobalResolutions by lto::addModuleToGlobalRes and than
thinLTOInternalizeAndPromoteInIndex is doing the job by setting the proper linkage in ModuleSummaryIndex.
If this code is needed can someone suggest how to write unit test for it?
The thinLTOInternalizeModule running in separate thread for each module being LTO'ed
So if we found some undefined symbol, which defined in another module what we can do now? That other
module might have already been internalized (or is being internalized at the same moment on another CPU core).