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

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 21 14:38:57 PDT 2020


hoyFB created this revision.
Herald added subscribers: llvm-commits, dexonsmith, steven_wu, MaskRay, hiraditya, arichardson, inglorion, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: MaskRay.
Herald added a project: LLVM.
hoyFB edited the summary of this revision.
hoyFB added reviewers: tejohnson, wenlei.
hoyFB updated this revision to Diff 265603.
hoyFB added a comment.

Updating D80406 <https://reviews.llvm.org/D80406>: [LLD][ThinLTO] A switch to allow compilation of only one module.


This change introduces an LLD switch --thinlto-single-module to allow compiling only one module out of multiple inputs. This is specifically enables:

1. Fast investigating/debugging a module of interest without spending time on compiling unrelated modules.
2. Compiler debug dump with -mllvm -debug-only= for a single module.

It will be useful for large applications which has 1K+ input modules for thinLTO.

The switch can be combined with `--lto-obj-path=` or `--lto-emit-asm` to obtain intermediate object files or assembly files. So far the module name matching is implemented as a fuzzy name lookup where the modules with name containing the switch value are compiled.

E.g,
Command:

  ld.lld main.o thin.a --thinlto-single-module=thin.a --lto-obj-path=single.o

log:

  [ThinLTO] Selecting thin.a(thin1.o at 168) to compile
  [ThinLTO] Selecting thin.a(thin2.o at 228) to compile

Command:

  ld.lld main.o thin.a --thinlto-single-module=thin1.o --lto-obj-path=single.o

log:

  [ThinLTO] Selecting thin.a(thin1.o at 168) to compile


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80406

Files:
  lld/ELF/Config.h
  lld/ELF/Driver.cpp
  lld/ELF/LTO.cpp
  lld/ELF/Options.td
  lld/test/ELF/lto/thinlto-single-module.ll
  llvm/include/llvm/LTO/Config.h
  llvm/include/llvm/LTO/LTO.h
  llvm/lib/LTO/LTO.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80406.265603.patch
Type: text/x-patch
Size: 8780 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200521/c6f76699/attachment.bin>


More information about the llvm-commits mailing list