Auto merge of #60313 - cuviper:thinlto-import, r=alexcrichton

Limit internalization in LLVM 8 ThinLTO

Fixes #60184.
r? @alexcrichton
This commit is contained in:
bors 2019-04-27 19:53:00 +00:00
commit 938d4ffe16

View File

@ -873,8 +873,11 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
return PrevailingType::Unknown;
};
#if LLVM_VERSION_GE(8, 0)
// We don't have a complete picture in our use of ThinLTO, just our immediate
// crate, so we need `ImportEnabled = false` to limit internalization.
// Otherwise, we sometimes lose `static` values -- see #60184.
computeDeadSymbolsWithConstProp(Ret->Index, Ret->GUIDPreservedSymbols,
deadIsPrevailing, /* ImportEnabled = */ true);
deadIsPrevailing, /* ImportEnabled = */ false);
#else
computeDeadSymbols(Ret->Index, Ret->GUIDPreservedSymbols, deadIsPrevailing);
#endif