This should fix the assertions in a clang LTO bootstrap we're seeing.
From: Mehdi Amini <mehdi.amini@apple.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268658
91177308-0d34-0410-b5e6-
96231b3b80d8
}
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;