[PATCH] D24492: [LTO] Switch to the new resolution-based API.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 28 12:12:08 PDT 2016


ruiu added inline comments.

================
Comment at: lld/ELF/InputFiles.cpp:653
@@ -658,19 +652,3 @@
 
-  uint8_t Type = STT_NOTYPE;
-  uint8_t Visibility;
-  bool CanOmitFromDynSym = false;
-  bool HasUnnamedAddr = false;
-
-  // FIXME: Expose a thread-local flag for module asm symbols.
-  if (GV) {
-    if (GV->isThreadLocal())
-      Type = STT_TLS;
-    CanOmitFromDynSym = canBeOmittedFromSymbolTable(GV);
-    Visibility = getGvVisibility(GV);
-    HasUnnamedAddr =
-        GV->getUnnamedAddr() == llvm::GlobalValue::UnnamedAddr::Global;
-  } else {
-    // FIXME: Set SF_Hidden flag correctly for module asm symbols, and expose
-    // protected visibility.
-    Visibility = STV_DEFAULT;
-  }
+  uint8_t Type = (ObjSym.isTLS()) ? STT_TLS : STT_NOTYPE;
+  uint8_t Visibility = mapVisibility(ObjSym.getVisibility());
----------------
Remove ().

================
Comment at: lld/ELF/LTO.cpp:85-88
@@ -138,7 +84,6 @@
 
-static bool shouldInternalize(const SmallPtrSet<GlobalValue *, 8> &Used,
-                              Symbol *S, GlobalValue *GV) {
-  if (S->IsUsedInRegularObj || Used.count(GV))
-    return false;
-  return !S->includeInDynsym();
+  return HasError
+             ? nullptr
+             : llvm::make_unique<lto::LTO>(std::move(Conf), Backend,
+                                           Config->LtoJobs);
 }
----------------
Remove `llvm::`.

I don't think your code is prepared to see LtoObj being null. Maybe you want to return a new instance regardless of HasError value?

================
Comment at: lld/ELF/LTO.cpp:101-102
@@ -169,6 +100,4 @@
 void BitcodeCompiler::add(BitcodeFile &F) {
-  std::unique_ptr<IRObjectFile> Obj = std::move(F.Obj);
-  std::vector<GlobalValue *> Keep;
-  unsigned BodyIndex = 0;
-  ArrayRef<Symbol *> Syms = F.getSymbols();
+  if (HasError)
+    return;
 
----------------
Why do you want to return here immediately if there was an error before this function?


https://reviews.llvm.org/D24492





More information about the llvm-commits mailing list