[PATCH] D94487: [LTO] Use lto::backend for code generation (WIP).

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 12 08:28:13 PST 2021


tejohnson added a comment.

Haven't looked at the detailed changes yet, but a couple of high level comments/questions below.



================
Comment at: llvm/lib/LTO/LTOCodeGenerator.cpp:270
+  if (Error Err =
+          backend(Conf, AddStream, 1, std::move(MergedModule), CombinedIndex))
+    genResult = false;
----------------
Note that backend() when not called in CodeGenOnly mode will pretty much just call opt() and codegen(). With some more restructuring you wouldn't need separate calls to opt() from optimize() and backend with CodeGenOnly=1 here, but rather a single call to backend. Maybe just add a FIXME or other note to that effect here? Because it seems like longer term some of this could be cleaned up.


================
Comment at: llvm/lib/LTO/LTOCodeGenerator.cpp:286
 
-  bool genResult = compileOptimized(&objFile.os());
   objFile.os().close();
----------------
Looks like there is a remaining call to this compileOptimized from llvm-lto.cpp. Should that be switched and compileOptimized removed? Without it left in llvm-lto.cpp, I'm wondering if the removal of initializeLTOPasses above will be an issue since llvm-lto.cpp is still invoking the old PM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94487



More information about the llvm-commits mailing list