[PATCH] D137768: [opt][clang] Enable using -module-summary with -S / -emit-llvm

Teresa Johnson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 12 07:45:55 PST 2022


tejohnson added inline comments.


================
Comment at: clang/lib/CodeGen/BackendUtil.cpp:1016
   case Backend_EmitLL:
-    MPM.addPass(PrintModulePass(*OS, "", CodeGenOpts.EmitLLVMUseLists));
+    if (CodeGenOpts.PrepareForThinLTO && !CodeGenOpts.DisableLLVMPasses) {
+      if (!TheModule->getModuleFlag("EnableSplitLTOUnit"))
----------------
Thanks for adding this too! I'm wondering if the code should be restructured slightly to reduce the code duplication. The simplest way might be to handle both cases (EmitBC and EmitLL) together, and then check the Action type to guard whether calling a *BitcodeWriter pass (optionally setting up the additional output file in the ThinLTO BC case) vs PrintModulePass.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137768



More information about the cfe-commits mailing list