aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/LTO/LTOBackend.cpp
diff options
context:
space:
mode:
authorMircea Trofin <mtrofin@google.com>2020-10-28 12:08:26 -0700
committerMircea Trofin <mtrofin@google.com>2020-10-28 12:33:39 -0700
commit6fa35541a0af9d5493e288f574896ee33a8eae92 (patch)
tree13c974e50c763e8c03f4c6ce6bc10fa7ed00be9e /llvm/lib/LTO/LTOBackend.cpp
parentbed83940478449b7ee08d43e5b74995912bf8206 (diff)
downloadllvm-6fa35541a0af9d5493e288f574896ee33a8eae92.zip
llvm-6fa35541a0af9d5493e288f574896ee33a8eae92.tar.gz
llvm-6fa35541a0af9d5493e288f574896ee33a8eae92.tar.bz2
[NFC][ThinLTO] Change command line passing to EmbedBitcodeInModule
Changing to pass by ref - less null checks to worry about. Differential Revision: https://reviews.llvm.org/D90330
Diffstat (limited to 'llvm/lib/LTO/LTOBackend.cpp')
-rw-r--r--llvm/lib/LTO/LTOBackend.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index fc39c1a..f4da6d8 100644
--- a/llvm/lib/LTO/LTOBackend.cpp
+++ b/llvm/lib/LTO/LTOBackend.cpp
@@ -358,7 +358,7 @@ static void runOldPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM,
bool opt(const Config &Conf, TargetMachine *TM, unsigned Task, Module &Mod,
bool IsThinLTO, ModuleSummaryIndex *ExportSummary,
const ModuleSummaryIndex *ImportSummary,
- const std::vector<uint8_t> *CmdArgs = nullptr) {
+ const std::vector<uint8_t> &CmdArgs) {
if (EmbedBitcode == LTOBitcodeEmbedding::EmbedPostMergePreOptimized) {
// FIXME: the motivation for capturing post-merge bitcode and command line
// is replicating the compilation environment from bitcode, without needing
@@ -368,13 +368,14 @@ bool opt(const Config &Conf, TargetMachine *TM, unsigned Task, Module &Mod,
// It's not very clear how the above motivation would map in the
// linker-based case, so we currently don't plumb the command line args in
// that case.
- if (CmdArgs == nullptr)
+ if (CmdArgs.empty())
LLVM_DEBUG(
dbgs() << "Post-(Thin)LTO merge bitcode embedding was requested, but "
"command line arguments are not available");
llvm::EmbedBitcodeInModule(Mod, llvm::MemoryBufferRef(),
/*EmbedBitcode*/ true,
- /*EmbedMarker*/ false, CmdArgs);
+ /*EmbedMarker*/ false,
+ /*Cmdline*/ CmdArgs);
}
// FIXME: Plumb the combined index into the new pass manager.
if (!Conf.OptPipeline.empty())
@@ -397,7 +398,8 @@ void codegen(const Config &Conf, TargetMachine *TM, AddStreamFn AddStream,
if (EmbedBitcode == LTOBitcodeEmbedding::EmbedOptimized)
llvm::EmbedBitcodeInModule(Mod, llvm::MemoryBufferRef(),
/*EmbedBitcode*/ true,
- /*EmbedMarker*/ false, /*CmdArgs*/ nullptr);
+ /*EmbedMarker*/ false,
+ /*CmdArgs*/ std::vector<uint8_t>());
std::unique_ptr<ToolOutputFile> DwoOut;
SmallString<1024> DwoFile(Conf.SplitDwarfOutput);
@@ -522,7 +524,8 @@ Error lto::backend(const Config &C, AddStreamFn AddStream,
if (!C.CodeGenOnly) {
if (!opt(C, TM.get(), 0, *Mod, /*IsThinLTO=*/false,
- /*ExportSummary=*/&CombinedIndex, /*ImportSummary=*/nullptr))
+ /*ExportSummary=*/&CombinedIndex, /*ImportSummary=*/nullptr,
+ /*CmdArgs*/ std::vector<uint8_t>()))
return Error::success();
}
@@ -561,7 +564,7 @@ Error lto::thinBackend(const Config &Conf, unsigned Task, AddStreamFn AddStream,
const FunctionImporter::ImportMapTy &ImportList,
const GVSummaryMapTy &DefinedGlobals,
MapVector<StringRef, BitcodeModule> &ModuleMap,
- const std::vector<uint8_t> *CmdArgs) {
+ const std::vector<uint8_t> &CmdArgs) {
Expected<const Target *> TOrErr = initAndLookupTarget(Conf, Mod);
if (!TOrErr)
return TOrErr.takeError();