]> granicus.if.org Git - llvm/commitdiff
LTOCodeGenerator: handle correctly "unnamed" symbol
authorMehdi Amini <mehdi.amini@apple.com>
Thu, 5 May 2016 18:14:55 +0000 (18:14 +0000)
committerMehdi Amini <mehdi.amini@apple.com>
Thu, 5 May 2016 18:14:55 +0000 (18:14 +0000)
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

lib/LTO/LTOCodeGenerator.cpp

index cad5d8eda51cf02af9277b17d8af91fba26656cb..1980965b1691735d6a7114d98cf7b1b91e92d125 100644 (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;