LTOCodeGenerator: handle correctly "unnamed" symbol

This should fix the assertions in a clang LTO bootstrap we're seeing.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 268658
This commit is contained in:
Mehdi Amini 2016-05-05 18:14:55 +00:00
parent 45444fa103
commit bcc2b51dd7

View File

@ -364,7 +364,7 @@ static void preserveDiscardableGVs(
}
llvm::Type *i8PTy = llvm::Type::getInt8PtrTy(TheModule.getContext());
auto mayPreserveGlobal = [&](GlobalValue &GV) {
if (!GV.isDiscardableIfUnused() || GV.isDeclaration())
if (!GV.isDiscardableIfUnused() || GV.isDeclaration() || !GV.hasName())
return;
if (!mustPreserveGV(GV))
return;