[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
Tue May 26 09:11:44 PDT 2020


hoyFB marked an inline comment as done.
hoyFB added inline comments.


================
Comment at: llvm/include/llvm/LTO/Config.h:134
+  /// A single thinLTO module to compile.
+  std::string ThinLTOSingleModule;
+
----------------
MaskRay wrote:
> 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.
That's a good point. So far it's unclear to me what compiling a single module means in mono LTO mode. E.g, should cross-module inlining be allowed which would end up generating object code for other modules? If so, figuring out what inlinees should be compiled need additional work. I'd like to see a strong need first before addressing that, since thinLTO is currently our primary scenario. On the other hand, single module is naturally well-defined in thinLTO mode, and with this new switch we'll end up having exactly same code generated for a module as we would get with a full compilation.

Allowing multiple modules to be compiled with this switch is an interesting idea!


================
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});
----------------
MaskRay wrote:
> The substring matching is not tested
It's tested by the `--thinlto-single-module=thin.a` line in the added test. The modules with name `thin.a(thin1.o at ...)` and `thin.a(thin2.o at ...)` are matched.


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