[PATCH] D46480: Update ThinLTO Indexing logic

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 4 16:00:45 PDT 2018


pcc added a comment.

This seems fine for now, but instead of copying this behaviour into LLD, it really ought to be a feature of the LTO implementation.



================
Comment at: lld/ELF/LTO.cpp:262-269
+  if (Config->ThinLTOIndexOnly) {
+    std::string OldPrefix, NewPrefix;
+    std::tie(OldPrefix, NewPrefix) = Config->ThinLTOPrefixReplace.split(';');
+    for (auto &Identifier : ObjectToIndexFileState)
+      if (!Identifier.getValue())
+        writeEmptyDistributedBuildOutputs(Identifier.getKey(), OldPrefix,
+                                          NewPrefix, /* SkipModule */ false);
----------------
I think this needs to be moved after the call to `LTO::run`.


================
Comment at: lld/ELF/LTO.cpp:300
+    if (Config->SaveTemps)
+      saveBuffer(Buff[0], Config->OutputFile + ".lto.o");
+    exit(0);
----------------
tejohnson wrote:
> There won't always be a regular LTO file created via splitting for ThinLTO builds, so Buff[0] should be empty some of the time. Do you have a test for this case?
> 
> The other thing being done by the loop below is a call to createObjectFile, does that need to be done for Buff[0] if non-empty too?
Buff[0] should always be non-empty, see D41267.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D46480





More information about the llvm-commits mailing list