[PATCH] D80406: [LLD][ThinLTO] A switch to allow compilation of only one module.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 25 12:51:57 PDT 2020


MaskRay added inline comments.


================
Comment at: lld/test/ELF/lto/thinlto-single-module.ll:8
+; RUN: ld.lld main.o thin.a --thinlto-single-module=main.o --lto-obj-path=single1.o
+; RUN: llvm-readobj --symbols single1.o | FileCheck %s -check-prefix=CHECK-DEFAULT
+; RUN: llvm-readobj --symbols single1.o1 | FileCheck %s -check-prefix=CHECK-MAIN
----------------
`llvm-readelf -S`

See `linkerscript/sizeof.s` for an example

Check prefixes do not necessarily start with `CHECK-`


================
Comment at: llvm/include/llvm/LTO/Config.h:134
+  /// A single thinLTO module to compile.
+  std::string ThinLTOSingleModule;
+
----------------
If this can be extended to regular LTO, `ThinLTO*` is not appropriate.

`std::vector<std::string> ModulesToCompile;`

Needs a test specifying the option multiple times.


================
Comment at: llvm/lib/LTO/LTO.cpp:858
+    // the specified switch value are goint to be compiled.
+    if (BM.getModuleIdentifier().contains(Conf.ThinLTOSingleModule)) {
+      ThinLTO.ModulesToCompile->insert({BM.getModuleIdentifier(), BM});
----------------
The substring matching is not tested


================
Comment at: llvm/lib/LTO/LTO.cpp:860
+      ThinLTO.ModulesToCompile->insert({BM.getModuleIdentifier(), BM});
+      llvm::errs() << "warning: [ThinLTO] Selecting "
+                   << BM.getModuleIdentifier() << " to compile\n";
----------------
This is an informational message. `warning: ` is not suitable


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80406/new/

https://reviews.llvm.org/D80406





More information about the llvm-commits mailing list