[PATCH] D46034: Support for distributed ThinLTO options

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 2 11:00:13 PDT 2018


pcc added inline comments.


================
Comment at: lld/ELF/InputFiles.h:262
   InputFile *fetch();
+  bool addedToLink();
+  bool isFileBitcode();
----------------
pcc wrote:
> Instead of adding this function, can you give `Seen` a clearer name and make it public?
Rename to `AddedToLink` to match local style.


================
Comment at: lld/ELF/InputFiles.h:47
 
+using llvm::file_magic;
 using llvm::object::Archive;
----------------
Remove this line and qualify with `llvm::` below.


================
Comment at: lld/ELF/InputFiles.h:356
+inline bool isBitcode(MemoryBufferRef MB) {
+  using namespace llvm::sys::fs;
+  return identify_magic(MB.getBuffer()) == file_magic::bitcode;
----------------
Do you need this line? Both `identify_magic` and `file_magic` are in the `llvm` namespace.


================
Comment at: lld/ELF/LTO.cpp:259-260
+  // If LazyObjFile has not been added to link, emit empty index files
+  if (Config->ThinLTOIndexOnly) {
+    for (LazyObjFile *F : LazyObjFiles) {
+      if (!F->addedToLink && isBitcode(F->MB))
----------------
Remove braces


================
Comment at: lld/ELF/LTO.cpp:262
+      if (!F->addedToLink && isBitcode(F->MB))
+        this->addLazyObjFile(F);
+    }
----------------
Remove `this->`


================
Comment at: lld/test/ELF/lto/thinlto_prefix_replace.ll:9
+; RUN: rm -f %t/newpath/thinlto_prefix_replace.o.thinlto.bc
+; RUN: ld.lld --plugin-opt=thinlto-index-only --plugin-opt=thinlto-prefix-replace="%t/oldpath/;%t/newpath/" -shared %t/oldpath/thinlto_prefix_replace.o -o %t/thinlto_prefix_replace
+; RUN: ls %t/newpath/thinlto_prefix_replace.o.thinlto.bc
----------------
I would also test that the index file is still created if the file is wrapped in `--start-lib`..`--end-lib`, or if `-module-summary` is not passed to `opt`.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D46034





More information about the llvm-commits mailing list