[PATCH] D87336: [NFC][ThinLTO] EmbedBitcodeSection doesn't need the Configuration

Mircea Trofin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 16:44:19 PDT 2020


mtrofin created this revision.
mtrofin added reviewers: tejohnson, zapster.
Herald added subscribers: llvm-commits, dexonsmith, steven_wu, hiraditya, inglorion.
Herald added a project: LLVM.
mtrofin requested review of this revision.

Instead, passing in the command line options, initialized to nullptr. In
an upcoming patch, we can then use the parameter to pass actual command
line options.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87336

Files:
  llvm/lib/LTO/LTOBackend.cpp


Index: llvm/lib/LTO/LTOBackend.cpp
===================================================================
--- llvm/lib/LTO/LTOBackend.cpp
+++ llvm/lib/LTO/LTOBackend.cpp
@@ -350,7 +350,9 @@
     "lto-embed-bitcode", cl::init(false),
     cl::desc("Embed LLVM bitcode in object files produced by LTO"));
 
-static void EmitBitcodeSection(Module &M, const Config &Conf) {
+static void
+EmitBitcodeSection(Module &M,
+                   const std::vector<uint8_t> *CmdLineOpts = nullptr) {
   if (!EmbedBitcode)
     return;
   SmallVector<char, 0> Buffer;
@@ -359,8 +361,8 @@
 
   std::unique_ptr<MemoryBuffer> Buf(
       new SmallVectorMemoryBuffer(std::move(Buffer)));
-  llvm::EmbedBitcodeInModule(M, Buf->getMemBufferRef(), /*EmbedBitcode*/ true,
-                             /*EmbedMarker*/ false, /*CmdArgs*/ nullptr);
+  llvm::EmbedBitcodeInModule(M, llvm::MemoryBufferRef(), /*EmbedBitcode*/ true,
+                             /*EmbedMarker*/ false, /*CmdArgs*/ CmdLineOpts);
 }
 
 void codegen(const Config &Conf, TargetMachine *TM, AddStreamFn AddStream,
@@ -369,7 +371,7 @@
   if (Conf.PreCodeGenModuleHook && !Conf.PreCodeGenModuleHook(Task, Mod))
     return;
 
-  EmitBitcodeSection(Mod, Conf);
+  EmitBitcodeSection(Mod);
 
   std::unique_ptr<ToolOutputFile> DwoOut;
   SmallString<1024> DwoFile(Conf.SplitDwarfOutput);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87336.290608.patch
Type: text/x-patch
Size: 1333 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200908/442ebdad/attachment.bin>


More information about the llvm-commits mailing list