[PATCH] D42995: [ThinLTO] Ignore object files with empty ThinLTO index

Teresa Johnson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 6 19:21:40 PST 2018


tejohnson added a comment.

> Empty ThinLTOIndexFile signals that we don't need this module during
>  linking.

Not the only case actually. We now also pass an empty index file when we want to compile the bitcode down to object without applying any LTO optimization (there are a few cases where we decide we want to turn off LTO optimizations for some links), and this is currently relying on being able to pass /dev/null for the index file that would be broken by this change.

> So we should not run ThinLTO backend even if it contains the
>  ThinLTO module. Backend may fail because of lack of necessary
>  information which should be provided by ThinLTOIndex.

This shouldn't happen - are you seeing cases where we fail? After loadModule() is called, EmitBackendOutput() is called which passes /*IgnoreEmptyThinLTOIndexFile*/true to  getModuleSummaryIndexForFile, which would cause it to return nullptr if the index file is empty.  Back in EmitBackendOutput(), if the combined index is null we will skip ThinLTO compilation and fall back to normal compilation.


https://reviews.llvm.org/D42995





More information about the cfe-commits mailing list