LLVM 18.0.0git
LTOBackend.cpp
Go to the documentation of this file.
1//===-LTOBackend.cpp - LLVM Link Time Optimizer Backend -------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file implements the "backend" phase of LTO, i.e. it performs
10// optimization and code generation on a loaded module. It is generally used
11// internally by the LTO class but can also be used independently, for example
12// to implement a standalone ThinLTO backend.
13//
14//===----------------------------------------------------------------------===//
15
16#include "llvm/LTO/LTOBackend.h"
25#include "llvm/IR/PassManager.h"
26#include "llvm/IR/Verifier.h"
27#include "llvm/LTO/LTO.h"
33#include "llvm/Support/Error.h"
36#include "llvm/Support/Path.h"
48#include <optional>
49
50using namespace llvm;
51using namespace lto;
52
53#define DEBUG_TYPE "lto-backend"
54
56 DoNotEmbed = 0,
59};
60
62 "lto-embed-bitcode", cl::init(LTOBitcodeEmbedding::DoNotEmbed),
64 "Do not embed"),
66 "Embed after all optimization passes"),
68 "post-merge-pre-opt",
69 "Embed post merge, but before optimizations")),
70 cl::desc("Embed LLVM bitcode in object files produced by LTO"));
71
73 "thinlto-assume-merged", cl::init(false),
74 cl::desc("Assume the input has already undergone ThinLTO function "
75 "importing and the other pre-optimization pipeline changes."));
76
77namespace llvm {
79}
80
81[[noreturn]] static void reportOpenError(StringRef Path, Twine Msg) {
82 errs() << "failed to open " << Path << ": " << Msg << '\n';
83 errs().flush();
84 exit(1);
85}
86
87Error Config::addSaveTemps(std::string OutputFileName, bool UseInputModulePath,
88 const DenseSet<StringRef> &SaveTempsArgs) {
90
91 std::error_code EC;
92 if (SaveTempsArgs.empty() || SaveTempsArgs.contains("resolution")) {
94 std::make_unique<raw_fd_ostream>(OutputFileName + "resolution.txt", EC,
96 if (EC) {
97 ResolutionFile.reset();
98 return errorCodeToError(EC);
99 }
100 }
101
102 auto setHook = [&](std::string PathSuffix, ModuleHookFn &Hook) {
103 // Keep track of the hook provided by the linker, which also needs to run.
104 ModuleHookFn LinkerHook = Hook;
105 Hook = [=](unsigned Task, const Module &M) {
106 // If the linker's hook returned false, we need to pass that result
107 // through.
108 if (LinkerHook && !LinkerHook(Task, M))
109 return false;
110
111 std::string PathPrefix;
112 // If this is the combined module (not a ThinLTO backend compile) or the
113 // user hasn't requested using the input module's path, emit to a file
114 // named from the provided OutputFileName with the Task ID appended.
115 if (M.getModuleIdentifier() == "ld-temp.o" || !UseInputModulePath) {
116 PathPrefix = OutputFileName;
117 if (Task != (unsigned)-1)
118 PathPrefix += utostr(Task) + ".";
119 } else
120 PathPrefix = M.getModuleIdentifier() + ".";
121 std::string Path = PathPrefix + PathSuffix + ".bc";
122 std::error_code EC;
124 // Because -save-temps is a debugging feature, we report the error
125 // directly and exit.
126 if (EC)
127 reportOpenError(Path, EC.message());
128 WriteBitcodeToFile(M, OS, /*ShouldPreserveUseListOrder=*/false);
129 return true;
130 };
131 };
132
133 auto SaveCombinedIndex =
134 [=](const ModuleSummaryIndex &Index,
135 const DenseSet<GlobalValue::GUID> &GUIDPreservedSymbols) {
136 std::string Path = OutputFileName + "index.bc";
137 std::error_code EC;
139 // Because -save-temps is a debugging feature, we report the error
140 // directly and exit.
141 if (EC)
142 reportOpenError(Path, EC.message());
144
145 Path = OutputFileName + "index.dot";
147 if (EC)
148 reportOpenError(Path, EC.message());
149 Index.exportToDot(OSDot, GUIDPreservedSymbols);
150 return true;
151 };
152
153 if (SaveTempsArgs.empty()) {
154 setHook("0.preopt", PreOptModuleHook);
155 setHook("1.promote", PostPromoteModuleHook);
156 setHook("2.internalize", PostInternalizeModuleHook);
157 setHook("3.import", PostImportModuleHook);
158 setHook("4.opt", PostOptModuleHook);
159 setHook("5.precodegen", PreCodeGenModuleHook);
160 CombinedIndexHook = SaveCombinedIndex;
161 } else {
162 if (SaveTempsArgs.contains("preopt"))
163 setHook("0.preopt", PreOptModuleHook);
164 if (SaveTempsArgs.contains("promote"))
165 setHook("1.promote", PostPromoteModuleHook);
166 if (SaveTempsArgs.contains("internalize"))
167 setHook("2.internalize", PostInternalizeModuleHook);
168 if (SaveTempsArgs.contains("import"))
169 setHook("3.import", PostImportModuleHook);
170 if (SaveTempsArgs.contains("opt"))
171 setHook("4.opt", PostOptModuleHook);
172 if (SaveTempsArgs.contains("precodegen"))
173 setHook("5.precodegen", PreCodeGenModuleHook);
174 if (SaveTempsArgs.contains("combinedindex"))
175 CombinedIndexHook = SaveCombinedIndex;
176 }
177
178 return Error::success();
179}
180
181#define HANDLE_EXTENSION(Ext) \
182 llvm::PassPluginLibraryInfo get##Ext##PluginInfo();
183#include "llvm/Support/Extension.def"
184
186 PassBuilder &PB) {
187#define HANDLE_EXTENSION(Ext) \
188 get##Ext##PluginInfo().RegisterPassBuilderCallbacks(PB);
189#include "llvm/Support/Extension.def"
190
191 // Load requested pass plugins and let them register pass builder callbacks
192 for (auto &PluginFN : PassPlugins) {
193 auto PassPlugin = PassPlugin::Load(PluginFN);
194 if (!PassPlugin) {
195 errs() << "Failed to load passes from '" << PluginFN
196 << "'. Request ignored.\n";
197 continue;
198 }
199
201 }
202}
203
204static std::unique_ptr<TargetMachine>
205createTargetMachine(const Config &Conf, const Target *TheTarget, Module &M) {
206 StringRef TheTriple = M.getTargetTriple();
207 SubtargetFeatures Features;
208 Features.getDefaultSubtargetFeatures(Triple(TheTriple));
209 for (const std::string &A : Conf.MAttrs)
210 Features.AddFeature(A);
211
212 std::optional<Reloc::Model> RelocModel;
213 if (Conf.RelocModel)
214 RelocModel = *Conf.RelocModel;
215 else if (M.getModuleFlag("PIC Level"))
216 RelocModel =
217 M.getPICLevel() == PICLevel::NotPIC ? Reloc::Static : Reloc::PIC_;
218
219 std::optional<CodeModel::Model> CodeModel;
220 if (Conf.CodeModel)
221 CodeModel = *Conf.CodeModel;
222 else
223 CodeModel = M.getCodeModel();
224
225 std::unique_ptr<TargetMachine> TM(TheTarget->createTargetMachine(
226 TheTriple, Conf.CPU, Features.getString(), Conf.Options, RelocModel,
227 CodeModel, Conf.CGOptLevel));
228
229 assert(TM && "Failed to create target machine");
230
231 if (std::optional<uint64_t> LargeDataThreshold = M.getLargeDataThreshold())
232 TM->setLargeDataThreshold(*LargeDataThreshold);
233
234 return TM;
235}
236
237static void runNewPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM,
238 unsigned OptLevel, bool IsThinLTO,
239 ModuleSummaryIndex *ExportSummary,
240 const ModuleSummaryIndex *ImportSummary) {
241 auto FS = vfs::getRealFileSystem();
242 std::optional<PGOOptions> PGOOpt;
243 if (!Conf.SampleProfile.empty())
244 PGOOpt = PGOOptions(Conf.SampleProfile, "", Conf.ProfileRemapping,
245 /*MemoryProfile=*/"", FS, PGOOptions::SampleUse,
247 else if (Conf.RunCSIRInstr) {
248 PGOOpt = PGOOptions("", Conf.CSIRProfile, Conf.ProfileRemapping,
249 /*MemoryProfile=*/"", FS, PGOOptions::IRUse,
251 } else if (!Conf.CSIRProfile.empty()) {
252 PGOOpt = PGOOptions(Conf.CSIRProfile, "", Conf.ProfileRemapping,
253 /*MemoryProfile=*/"", FS, PGOOptions::IRUse,
256 } else if (Conf.AddFSDiscriminator) {
257 PGOOpt = PGOOptions("", "", "", /*MemoryProfile=*/"", nullptr,
259 }
260 TM->setPGOOption(PGOOpt);
261
266
268 StandardInstrumentations SI(Mod.getContext(), Conf.DebugPassManager,
269 Conf.VerifyEach);
270 SI.registerCallbacks(PIC, &MAM);
271 PassBuilder PB(TM, Conf.PTO, PGOOpt, &PIC);
272
274
275 std::unique_ptr<TargetLibraryInfoImpl> TLII(
276 new TargetLibraryInfoImpl(Triple(TM->getTargetTriple())));
277 if (Conf.Freestanding)
278 TLII->disableAllFunctions();
279 FAM.registerPass([&] { return TargetLibraryAnalysis(*TLII); });
280
281 // Parse a custom AA pipeline if asked to.
282 if (!Conf.AAPipeline.empty()) {
283 AAManager AA;
284 if (auto Err = PB.parseAAPipeline(AA, Conf.AAPipeline)) {
285 report_fatal_error(Twine("unable to parse AA pipeline description '") +
286 Conf.AAPipeline + "': " + toString(std::move(Err)));
287 }
288 // Register the AA manager first so that our version is the one used.
289 FAM.registerPass([&] { return std::move(AA); });
290 }
291
292 // Register all the basic analyses with the managers.
298
300
301 if (!Conf.DisableVerify)
303
305
306 switch (OptLevel) {
307 default:
308 llvm_unreachable("Invalid optimization level");
309 case 0:
311 break;
312 case 1:
314 break;
315 case 2:
317 break;
318 case 3:
320 break;
321 }
322
323 // Parse a custom pipeline if asked to.
324 if (!Conf.OptPipeline.empty()) {
325 if (auto Err = PB.parsePassPipeline(MPM, Conf.OptPipeline)) {
326 report_fatal_error(Twine("unable to parse pass pipeline description '") +
327 Conf.OptPipeline + "': " + toString(std::move(Err)));
328 }
329 } else if (Conf.UseDefaultPipeline) {
331 } else if (IsThinLTO) {
332 MPM.addPass(PB.buildThinLTODefaultPipeline(OL, ImportSummary));
333 } else {
334 MPM.addPass(PB.buildLTODefaultPipeline(OL, ExportSummary));
335 }
336
337 if (!Conf.DisableVerify)
339
340 MPM.run(Mod, MAM);
341}
342
343bool lto::opt(const Config &Conf, TargetMachine *TM, unsigned Task, Module &Mod,
344 bool IsThinLTO, ModuleSummaryIndex *ExportSummary,
345 const ModuleSummaryIndex *ImportSummary,
346 const std::vector<uint8_t> &CmdArgs) {
347 if (EmbedBitcode == LTOBitcodeEmbedding::EmbedPostMergePreOptimized) {
348 // FIXME: the motivation for capturing post-merge bitcode and command line
349 // is replicating the compilation environment from bitcode, without needing
350 // to understand the dependencies (the functions to be imported). This
351 // assumes a clang - based invocation, case in which we have the command
352 // line.
353 // It's not very clear how the above motivation would map in the
354 // linker-based case, so we currently don't plumb the command line args in
355 // that case.
356 if (CmdArgs.empty())
358 dbgs() << "Post-(Thin)LTO merge bitcode embedding was requested, but "
359 "command line arguments are not available");
361 /*EmbedBitcode*/ true, /*EmbedCmdline*/ true,
362 /*Cmdline*/ CmdArgs);
363 }
364 // FIXME: Plumb the combined index into the new pass manager.
365 runNewPMPasses(Conf, Mod, TM, Conf.OptLevel, IsThinLTO, ExportSummary,
366 ImportSummary);
367 return !Conf.PostOptModuleHook || Conf.PostOptModuleHook(Task, Mod);
368}
369
370static void codegen(const Config &Conf, TargetMachine *TM,
371 AddStreamFn AddStream, unsigned Task, Module &Mod,
372 const ModuleSummaryIndex &CombinedIndex) {
373 if (Conf.PreCodeGenModuleHook && !Conf.PreCodeGenModuleHook(Task, Mod))
374 return;
375
376 if (EmbedBitcode == LTOBitcodeEmbedding::EmbedOptimized)
378 /*EmbedBitcode*/ true,
379 /*EmbedCmdline*/ false,
380 /*CmdArgs*/ std::vector<uint8_t>());
381
382 std::unique_ptr<ToolOutputFile> DwoOut;
384 if (!Conf.DwoDir.empty()) {
385 std::error_code EC;
386 if (auto EC = llvm::sys::fs::create_directories(Conf.DwoDir))
387 report_fatal_error(Twine("Failed to create directory ") + Conf.DwoDir +
388 ": " + EC.message());
389
390 DwoFile = Conf.DwoDir;
391 sys::path::append(DwoFile, std::to_string(Task) + ".dwo");
392 TM->Options.MCOptions.SplitDwarfFile = std::string(DwoFile);
393 } else
394 TM->Options.MCOptions.SplitDwarfFile = Conf.SplitDwarfFile;
395
396 if (!DwoFile.empty()) {
397 std::error_code EC;
398 DwoOut = std::make_unique<ToolOutputFile>(DwoFile, EC, sys::fs::OF_None);
399 if (EC)
400 report_fatal_error(Twine("Failed to open ") + DwoFile + ": " +
401 EC.message());
402 }
403
405 AddStream(Task, Mod.getModuleIdentifier());
406 if (Error Err = StreamOrErr.takeError())
407 report_fatal_error(std::move(Err));
408 std::unique_ptr<CachedFileStream> &Stream = *StreamOrErr;
409 TM->Options.ObjectFilenameForDebug = Stream->ObjectPathName;
410
411 legacy::PassManager CodeGenPasses;
412 TargetLibraryInfoImpl TLII(Triple(Mod.getTargetTriple()));
413 CodeGenPasses.add(new TargetLibraryInfoWrapperPass(TLII));
414 CodeGenPasses.add(
416 if (Conf.PreCodeGenPassesHook)
417 Conf.PreCodeGenPassesHook(CodeGenPasses);
418 if (TM->addPassesToEmitFile(CodeGenPasses, *Stream->OS,
419 DwoOut ? &DwoOut->os() : nullptr,
420 Conf.CGFileType))
421 report_fatal_error("Failed to setup codegen");
422 CodeGenPasses.run(Mod);
423
424 if (DwoOut)
425 DwoOut->keep();
426}
427
428static void splitCodeGen(const Config &C, TargetMachine *TM,
429 AddStreamFn AddStream,
430 unsigned ParallelCodeGenParallelismLevel, Module &Mod,
431 const ModuleSummaryIndex &CombinedIndex) {
432 ThreadPool CodegenThreadPool(
433 heavyweight_hardware_concurrency(ParallelCodeGenParallelismLevel));
434 unsigned ThreadCount = 0;
435 const Target *T = &TM->getTarget();
436
438 Mod, ParallelCodeGenParallelismLevel,
439 [&](std::unique_ptr<Module> MPart) {
440 // We want to clone the module in a new context to multi-thread the
441 // codegen. We do it by serializing partition modules to bitcode
442 // (while still on the main thread, in order to avoid data races) and
443 // spinning up new threads which deserialize the partitions into
444 // separate contexts.
445 // FIXME: Provide a more direct way to do this in LLVM.
447 raw_svector_ostream BCOS(BC);
448 WriteBitcodeToFile(*MPart, BCOS);
449
450 // Enqueue the task
451 CodegenThreadPool.async(
452 [&](const SmallString<0> &BC, unsigned ThreadId) {
453 LTOLLVMContext Ctx(C);
455 MemoryBufferRef(StringRef(BC.data(), BC.size()), "ld-temp.o"),
456 Ctx);
457 if (!MOrErr)
458 report_fatal_error("Failed to read bitcode");
459 std::unique_ptr<Module> MPartInCtx = std::move(MOrErr.get());
460
461 std::unique_ptr<TargetMachine> TM =
462 createTargetMachine(C, T, *MPartInCtx);
463
464 codegen(C, TM.get(), AddStream, ThreadId, *MPartInCtx,
465 CombinedIndex);
466 },
467 // Pass BC using std::move to ensure that it get moved rather than
468 // copied into the thread's context.
469 std::move(BC), ThreadCount++);
470 },
471 false);
472
473 // Because the inner lambda (which runs in a worker thread) captures our local
474 // variables, we need to wait for the worker threads to terminate before we
475 // can leave the function scope.
476 CodegenThreadPool.wait();
477}
478
480 Module &Mod) {
481 if (!C.OverrideTriple.empty())
482 Mod.setTargetTriple(C.OverrideTriple);
483 else if (Mod.getTargetTriple().empty())
484 Mod.setTargetTriple(C.DefaultTriple);
485
486 std::string Msg;
487 const Target *T = TargetRegistry::lookupTarget(Mod.getTargetTriple(), Msg);
488 if (!T)
489 return make_error<StringError>(Msg, inconvertibleErrorCode());
490 return T;
491}
492
494 std::unique_ptr<ToolOutputFile> DiagOutputFile) {
495 // Make sure we flush the diagnostic remarks file in case the linker doesn't
496 // call the global destructors before exiting.
497 if (!DiagOutputFile)
498 return Error::success();
499 DiagOutputFile->keep();
500 DiagOutputFile->os().flush();
501 return Error::success();
502}
503
505 unsigned ParallelCodeGenParallelismLevel, Module &Mod,
506 ModuleSummaryIndex &CombinedIndex) {
508 if (!TOrErr)
509 return TOrErr.takeError();
510
511 std::unique_ptr<TargetMachine> TM = createTargetMachine(C, *TOrErr, Mod);
512
513 LLVM_DEBUG(dbgs() << "Running regular LTO\n");
514 if (!C.CodeGenOnly) {
515 if (!opt(C, TM.get(), 0, Mod, /*IsThinLTO=*/false,
516 /*ExportSummary=*/&CombinedIndex, /*ImportSummary=*/nullptr,
517 /*CmdArgs*/ std::vector<uint8_t>()))
518 return Error::success();
519 }
520
521 if (ParallelCodeGenParallelismLevel == 1) {
522 codegen(C, TM.get(), AddStream, 0, Mod, CombinedIndex);
523 } else {
524 splitCodeGen(C, TM.get(), AddStream, ParallelCodeGenParallelismLevel, Mod,
525 CombinedIndex);
526 }
527 return Error::success();
528}
529
530static void dropDeadSymbols(Module &Mod, const GVSummaryMapTy &DefinedGlobals,
531 const ModuleSummaryIndex &Index) {
532 std::vector<GlobalValue*> DeadGVs;
533 for (auto &GV : Mod.global_values())
534 if (GlobalValueSummary *GVS = DefinedGlobals.lookup(GV.getGUID()))
535 if (!Index.isGlobalValueLive(GVS)) {
536 DeadGVs.push_back(&GV);
538 }
539
540 // Now that all dead bodies have been dropped, delete the actual objects
541 // themselves when possible.
542 for (GlobalValue *GV : DeadGVs) {
543 GV->removeDeadConstantUsers();
544 // Might reference something defined in native object (i.e. dropped a
545 // non-prevailing IR def, but we need to keep the declaration).
546 if (GV->use_empty())
547 GV->eraseFromParent();
548 }
549}
550
551Error lto::thinBackend(const Config &Conf, unsigned Task, AddStreamFn AddStream,
552 Module &Mod, const ModuleSummaryIndex &CombinedIndex,
553 const FunctionImporter::ImportMapTy &ImportList,
554 const GVSummaryMapTy &DefinedGlobals,
556 const std::vector<uint8_t> &CmdArgs) {
558 if (!TOrErr)
559 return TOrErr.takeError();
560
561 std::unique_ptr<TargetMachine> TM = createTargetMachine(Conf, *TOrErr, Mod);
562
563 // Setup optimization remarks.
564 auto DiagFileOrErr = lto::setupLLVMOptimizationRemarks(
565 Mod.getContext(), Conf.RemarksFilename, Conf.RemarksPasses,
567 Task);
568 if (!DiagFileOrErr)
569 return DiagFileOrErr.takeError();
570 auto DiagnosticOutputFile = std::move(*DiagFileOrErr);
571
572 // Set the partial sample profile ratio in the profile summary module flag of
573 // the module, if applicable.
574 Mod.setPartialSampleProfileRatio(CombinedIndex);
575
576 LLVM_DEBUG(dbgs() << "Running ThinLTO\n");
577 if (Conf.CodeGenOnly) {
578 codegen(Conf, TM.get(), AddStream, Task, Mod, CombinedIndex);
579 return finalizeOptimizationRemarks(std::move(DiagnosticOutputFile));
580 }
581
582 if (Conf.PreOptModuleHook && !Conf.PreOptModuleHook(Task, Mod))
583 return finalizeOptimizationRemarks(std::move(DiagnosticOutputFile));
584
585 auto OptimizeAndCodegen =
586 [&](Module &Mod, TargetMachine *TM,
587 std::unique_ptr<ToolOutputFile> DiagnosticOutputFile) {
588 if (!opt(Conf, TM, Task, Mod, /*IsThinLTO=*/true,
589 /*ExportSummary=*/nullptr, /*ImportSummary=*/&CombinedIndex,
590 CmdArgs))
591 return finalizeOptimizationRemarks(std::move(DiagnosticOutputFile));
592
593 codegen(Conf, TM, AddStream, Task, Mod, CombinedIndex);
594 return finalizeOptimizationRemarks(std::move(DiagnosticOutputFile));
595 };
596
598 return OptimizeAndCodegen(Mod, TM.get(), std::move(DiagnosticOutputFile));
599
600 // When linking an ELF shared object, dso_local should be dropped. We
601 // conservatively do this for -fpic.
602 bool ClearDSOLocalOnDeclarations =
603 TM->getTargetTriple().isOSBinFormatELF() &&
604 TM->getRelocationModel() != Reloc::Static &&
605 Mod.getPIELevel() == PIELevel::Default;
606 renameModuleForThinLTO(Mod, CombinedIndex, ClearDSOLocalOnDeclarations);
607
608 dropDeadSymbols(Mod, DefinedGlobals, CombinedIndex);
609
610 thinLTOFinalizeInModule(Mod, DefinedGlobals, /*PropagateAttrs=*/true);
611
612 if (Conf.PostPromoteModuleHook && !Conf.PostPromoteModuleHook(Task, Mod))
613 return finalizeOptimizationRemarks(std::move(DiagnosticOutputFile));
614
615 if (!DefinedGlobals.empty())
616 thinLTOInternalizeModule(Mod, DefinedGlobals);
617
618 if (Conf.PostInternalizeModuleHook &&
619 !Conf.PostInternalizeModuleHook(Task, Mod))
620 return finalizeOptimizationRemarks(std::move(DiagnosticOutputFile));
621
622 auto ModuleLoader = [&](StringRef Identifier) {
623 assert(Mod.getContext().isODRUniquingDebugTypes() &&
624 "ODR Type uniquing should be enabled on the context");
625 if (ModuleMap) {
626 auto I = ModuleMap->find(Identifier);
627 assert(I != ModuleMap->end());
628 return I->second.getLazyModule(Mod.getContext(),
629 /*ShouldLazyLoadMetadata=*/true,
630 /*IsImporting*/ true);
631 }
632
634 llvm::MemoryBuffer::getFile(Identifier);
635 if (!MBOrErr)
636 return Expected<std::unique_ptr<llvm::Module>>(make_error<StringError>(
637 Twine("Error loading imported file ") + Identifier + " : ",
638 MBOrErr.getError()));
639
640 Expected<BitcodeModule> BMOrErr = findThinLTOModule(**MBOrErr);
641 if (!BMOrErr)
642 return Expected<std::unique_ptr<llvm::Module>>(make_error<StringError>(
643 Twine("Error loading imported file ") + Identifier + " : " +
644 toString(BMOrErr.takeError()),
646
648 BMOrErr->getLazyModule(Mod.getContext(),
649 /*ShouldLazyLoadMetadata=*/true,
650 /*IsImporting*/ true);
651 if (MOrErr)
652 (*MOrErr)->setOwnedMemoryBuffer(std::move(*MBOrErr));
653 return MOrErr;
654 };
655
656 FunctionImporter Importer(CombinedIndex, ModuleLoader,
657 ClearDSOLocalOnDeclarations);
658 if (Error Err = Importer.importFunctions(Mod, ImportList).takeError())
659 return Err;
660
661 // Do this after any importing so that imported code is updated.
662 updateMemProfAttributes(Mod, CombinedIndex);
664
665 if (Conf.PostImportModuleHook && !Conf.PostImportModuleHook(Task, Mod))
666 return finalizeOptimizationRemarks(std::move(DiagnosticOutputFile));
667
668 return OptimizeAndCodegen(Mod, TM.get(), std::move(DiagnosticOutputFile));
669}
670
672 if (ThinLTOAssumeMerged && BMs.size() == 1)
673 return BMs.begin();
674
675 for (BitcodeModule &BM : BMs) {
676 Expected<BitcodeLTOInfo> LTOInfo = BM.getLTOInfo();
677 if (LTOInfo && LTOInfo->IsThinLTO)
678 return &BM;
679 }
680 return nullptr;
681}
682
685 if (!BMsOrErr)
686 return BMsOrErr.takeError();
687
688 // The bitcode file may contain multiple modules, we want the one that is
689 // marked as being the ThinLTO module.
690 if (const BitcodeModule *Bm = lto::findThinLTOModule(*BMsOrErr))
691 return *Bm;
692
693 return make_error<StringError>("Could not find module summary",
695}
696
698 const ModuleSummaryIndex &CombinedIndex,
699 FunctionImporter::ImportMapTy &ImportList) {
701 return true;
702 // We can simply import the values mentioned in the combined index, since
703 // we should only invoke this using the individual indexes written out
704 // via a WriteIndexesThinBackend.
705 for (const auto &GlobalList : CombinedIndex) {
706 // Ignore entries for undefined references.
707 if (GlobalList.second.SummaryList.empty())
708 continue;
709
710 auto GUID = GlobalList.first;
711 for (const auto &Summary : GlobalList.second.SummaryList) {
712 // Skip the summaries for the importing module. These are included to
713 // e.g. record required linkage changes.
714 if (Summary->modulePath() == M.getModuleIdentifier())
715 continue;
716 // Add an entry to provoke importing by thinBackend.
717 ImportList[Summary->modulePath()].insert(GUID);
718 }
719 }
720 return true;
721}
arm prera ldst opt
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
This header provides classes for managing passes over SCCs of the call graph.
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
Definition: CommandLine.h:680
#define LLVM_DEBUG(X)
Definition: Debug.h:101
static cl::opt< bool > ThinLTOAssumeMerged("thinlto-assume-merged", cl::init(false), cl::desc("Assume the input has already undergone ThinLTO function " "importing and the other pre-optimization pipeline changes."))
static void reportOpenError(StringRef Path, Twine Msg)
Definition: LTOBackend.cpp:81
LTOBitcodeEmbedding
Definition: LTOBackend.cpp:55
static cl::opt< LTOBitcodeEmbedding > EmbedBitcode("lto-embed-bitcode", cl::init(LTOBitcodeEmbedding::DoNotEmbed), cl::values(clEnumValN(LTOBitcodeEmbedding::DoNotEmbed, "none", "Do not embed"), clEnumValN(LTOBitcodeEmbedding::EmbedOptimized, "optimized", "Embed after all optimization passes"), clEnumValN(LTOBitcodeEmbedding::EmbedPostMergePreOptimized, "post-merge-pre-opt", "Embed post merge, but before optimizations")), cl::desc("Embed LLVM bitcode in object files produced by LTO"))
static void dropDeadSymbols(Module &Mod, const GVSummaryMapTy &DefinedGlobals, const ModuleSummaryIndex &Index)
Definition: LTOBackend.cpp:530
static Expected< const Target * > initAndLookupTarget(const Config &C, Module &Mod)
Definition: LTOBackend.cpp:479
static void codegen(const Config &Conf, TargetMachine *TM, AddStreamFn AddStream, unsigned Task, Module &Mod, const ModuleSummaryIndex &CombinedIndex)
Definition: LTOBackend.cpp:370
static void RegisterPassPlugins(ArrayRef< std::string > PassPlugins, PassBuilder &PB)
Definition: LTOBackend.cpp:185
static void runNewPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM, unsigned OptLevel, bool IsThinLTO, ModuleSummaryIndex *ExportSummary, const ModuleSummaryIndex *ImportSummary)
Definition: LTOBackend.cpp:237
This header provides classes for managing a pipeline of passes over loops in LLVM IR.
#define I(x, y, z)
Definition: MD5.cpp:58
This is the interface to build a ModuleSummaryIndex for a module.
static std::unique_ptr< TargetMachine > createTargetMachine(Function *F, CodeGenOptLevel OptLevel)
Create the TargetMachine object to query the backend for optimization preferences.
CGSCCAnalysisManager CGAM
ModulePassManager MPM
LoopAnalysisManager LAM
FunctionAnalysisManager FAM
ModuleAnalysisManager MAM
const char LLVMTargetMachineRef TM
PassInstrumentationCallbacks PIC
PassBuilder PB(Machine, PassOpts->PTO, std::nullopt, &PIC)
This header defines various interfaces for pass management in LLVM.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
raw_pwrite_stream & OS
This header defines a class that provides bookkeeping for all standard (i.e in-tree) pass instrumenta...
Defines the virtual file system interface vfs::FileSystem.
A manager for alias analyses.
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:620
bool registerPass(PassBuilderT &&PassBuilder)
Register an analysis pass with the manager.
Definition: PassManager.h:836
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:165
Represents a module in a bitcode file.
ValueT lookup(const_arg_type_t< KeyT > Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
Definition: DenseMap.h:202
bool empty() const
Definition: DenseMap.h:98
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
Definition: DenseMap.h:220
Implements a dense probed hash-table based set.
Definition: DenseSet.h:271
Represents either an error or a value T.
Definition: ErrorOr.h:56
std::error_code getError() const
Definition: ErrorOr.h:152
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
static ErrorSuccess success()
Create a success value.
Definition: Error.h:334
Tagged union holding either a T or a Error.
Definition: Error.h:474
Error takeError()
Take ownership of the stored error.
Definition: Error.h:601
reference get()
Returns a reference to the stored T value.
Definition: Error.h:571
The function importer is automatically importing function from other modules based on the provided su...
Expected< bool > importFunctions(Module &M, const ImportMapTy &ImportList)
Import functions in Module M based on the supplied import list.
Function and variable summary information to aid decisions and implementation of importing.
This class implements a map that also provides access to all stored values in a deterministic order.
Definition: MapVector.h:36
iterator end()
Definition: MapVector.h:71
iterator find(const KeyT &Key)
Definition: MapVector.h:146
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFile(const Twine &Filename, bool IsText=false, bool RequiresNullTerminator=true, bool IsVolatile=false, std::optional< Align > Alignment=std::nullopt)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful,...
Class to hold module path string table and global value map, and encapsulate methods for operating on...
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Definition: ArrayRef.h:307
iterator begin() const
Definition: ArrayRef.h:356
static const OptimizationLevel O3
Optimize for fast execution as much as possible.
static const OptimizationLevel O0
Disable as many optimizations as possible.
static const OptimizationLevel O2
Optimize for fast execution as much as possible without triggering significant incremental compile ti...
static const OptimizationLevel O1
Optimize quickly without destroying debuggability.
This class provides access to building LLVM's passes.
Definition: PassBuilder.h:103
Error parseAAPipeline(AAManager &AA, StringRef PipelineText)
Parse a textual alias analysis pipeline into the provided AA manager.
void registerLoopAnalyses(LoopAnalysisManager &LAM)
Registers all available loop analysis passes.
void crossRegisterProxies(LoopAnalysisManager &LAM, FunctionAnalysisManager &FAM, CGSCCAnalysisManager &CGAM, ModuleAnalysisManager &MAM)
Cross register the analysis managers through their proxies.
ModulePassManager buildPerModuleDefaultPipeline(OptimizationLevel Level, bool LTOPreLink=false)
Build a per-module default optimization pipeline.
Error parsePassPipeline(ModulePassManager &MPM, StringRef PipelineText)
Parse a textual pass pipeline description into a ModulePassManager.
ModulePassManager buildLTODefaultPipeline(OptimizationLevel Level, ModuleSummaryIndex *ExportSummary)
Build an LTO default optimization pipeline to a pass manager.
ModulePassManager buildThinLTODefaultPipeline(OptimizationLevel Level, const ModuleSummaryIndex *ImportSummary)
Build an ThinLTO default optimization pipeline to a pass manager.
void registerModuleAnalyses(ModuleAnalysisManager &MAM)
Registers all available module analysis passes.
void registerCGSCCAnalyses(CGSCCAnalysisManager &CGAM)
Registers all available CGSCC analysis passes.
void registerFunctionAnalyses(FunctionAnalysisManager &FAM)
Registers all available function analysis passes.
This class manages callbacks registration, as well as provides a way for PassInstrumentation to pass ...
LLVM_ATTRIBUTE_MINSIZE std::enable_if_t<!std::is_same< PassT, PassManager >::value > addPass(PassT &&Pass)
Definition: PassManager.h:544
PreservedAnalyses run(IRUnitT &IR, AnalysisManagerT &AM, ExtraArgTs... ExtraArgs)
Run all of the passes in this manager over the given unit of IR.
Definition: PassManager.h:498
A loaded pass plugin.
Definition: PassPlugin.h:60
static Expected< PassPlugin > Load(const std::string &Filename)
Attempts to load a pass plugin from a given file.
Definition: PassPlugin.cpp:16
void registerPassBuilderCallbacks(PassBuilder &PB) const
Invoke the PassBuilder callback registration.
Definition: PassPlugin.h:82
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition: SmallString.h:26
bool empty() const
Definition: SmallVector.h:94
size_t size() const
Definition: SmallVector.h:91
pointer data()
Return a pointer to the vector's buffer, even if empty().
Definition: SmallVector.h:289
This class provides an interface to register all the standard pass instrumentations and manages their...
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Manages the enabling and disabling of subtarget specific features.
void getDefaultSubtargetFeatures(const Triple &Triple)
Adds the default features for the specified target triple.
std::string getString() const
Returns features as a string.
void AddFeature(StringRef String, bool Enable=true)
Adds Features.
Analysis pass providing the TargetLibraryInfo.
Implementation of the target library information.
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:78
Target - Wrapper for Target specific information.
TargetMachine * createTargetMachine(StringRef TT, StringRef CPU, StringRef Features, const TargetOptions &Options, std::optional< Reloc::Model > RM, std::optional< CodeModel::Model > CM=std::nullopt, CodeGenOptLevel OL=CodeGenOptLevel::Default, bool JIT=false) const
createTargetMachine - Create a target specific machine implementation for the specified Triple.
A ThreadPool for asynchronous parallel execution on a defined number of threads.
Definition: ThreadPool.h:52
void wait()
Blocking wait for all the threads to complete and the queue to be empty.
Definition: ThreadPool.cpp:202
auto async(Function &&F, Args &&...ArgList)
Asynchronous submission of a task to the pool.
Definition: ThreadPool.h:66
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
Create a verifier pass.
Definition: Verifier.h:132
bool contains(const_arg_type_t< ValueT > V) const
Check if the set contains the given element.
Definition: DenseSet.h:185
PassManager manages ModulePassManagers.
void add(Pass *P) override
Add a pass to the queue of passes to run.
bool run(Module &M)
run - Execute all of the passes scheduled for execution.
A raw_ostream that writes to a file descriptor.
Definition: raw_ostream.h:454
A raw_ostream that writes to an SmallVector or SmallString.
Definition: raw_ostream.h:672
Interfaces for registering analysis passes, producing common pass manager configurations,...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
Definition: CommandLine.h:705
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:445
std::optional< const char * > toString(const std::optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract a string value from it.
Error thinBackend(const Config &C, unsigned Task, AddStreamFn AddStream, Module &M, const ModuleSummaryIndex &CombinedIndex, const FunctionImporter::ImportMapTy &ImportList, const GVSummaryMapTy &DefinedGlobals, MapVector< StringRef, BitcodeModule > *ModuleMap, const std::vector< uint8_t > &CmdArgs=std::vector< uint8_t >())
Runs a ThinLTO backend.
Definition: LTOBackend.cpp:551
BitcodeModule * findThinLTOModule(MutableArrayRef< BitcodeModule > BMs)
Returns the BitcodeModule that is ThinLTO.
Definition: LTOBackend.cpp:671
Error backend(const Config &C, AddStreamFn AddStream, unsigned ParallelCodeGenParallelismLevel, Module &M, ModuleSummaryIndex &CombinedIndex)
Runs a regular LTO backend.
Definition: LTOBackend.cpp:504
Error finalizeOptimizationRemarks(std::unique_ptr< ToolOutputFile > DiagOutputFile)
Definition: LTOBackend.cpp:493
bool initImportList(const Module &M, const ModuleSummaryIndex &CombinedIndex, FunctionImporter::ImportMapTy &ImportList)
Distributed ThinLTO: collect the referenced modules based on module summary and initialize ImportList...
Definition: LTOBackend.cpp:697
Expected< std::unique_ptr< ToolOutputFile > > setupLLVMOptimizationRemarks(LLVMContext &Context, StringRef RemarksFilename, StringRef RemarksPasses, StringRef RemarksFormat, bool RemarksWithHotness, std::optional< uint64_t > RemarksHotnessThreshold=0, int Count=-1)
Setup optimization remarks.
Definition: LTO.cpp:1850
bool opt(const Config &Conf, TargetMachine *TM, unsigned Task, Module &Mod, bool IsThinLTO, ModuleSummaryIndex *ExportSummary, const ModuleSummaryIndex *ImportSummary, const std::vector< uint8_t > &CmdArgs)
Runs middle-end LTO optimizations on Mod.
Definition: LTOBackend.cpp:343
void updateMemProfAttributes(Module &Mod, const ModuleSummaryIndex &Index)
Updates MemProf attributes (and metadata) based on whether the index has recorded that we are linking...
Definition: LTO.cpp:1186
@ OF_TextWithCRLF
The file should be opened in text mode and use a carriage linefeed '\r '.
Definition: FileSystem.h:768
std::error_code create_directories(const Twine &path, bool IgnoreExisting=true, perms Perms=owner_all|group_all)
Create all the non-existent directories in path.
Definition: Path.cpp:969
void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
Definition: Path.cpp:458
IntrusiveRefCntPtr< FileSystem > getRealFileSystem()
Gets an vfs::FileSystem for the 'real' file system, as seen by the operating system.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
ThreadPoolStrategy heavyweight_hardware_concurrency(unsigned ThreadCount=0)
Returns a thread strategy for tasks requiring significant memory or other resources.
Definition: Threading.h:162
Expected< std::unique_ptr< Module > > parseBitcodeFile(MemoryBufferRef Buffer, LLVMContext &Context, ParserCallbacks Callbacks={})
Read the specified bitcode file, returning the module.
void WriteBitcodeToFile(const Module &M, raw_ostream &Out, bool ShouldPreserveUseListOrder=false, const ModuleSummaryIndex *Index=nullptr, bool GenerateHash=false, ModuleHash *ModHash=nullptr)
Write the specified module to the specified raw output stream.
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
Definition: Error.cpp:90
void writeIndexToFile(const ModuleSummaryIndex &Index, raw_ostream &Out, const std::map< std::string, GVSummaryMapTy > *ModuleToSummariesForIndex=nullptr)
Write the specified module summary index to the given raw output stream, where it will be written in ...
std::function< Expected< std::unique_ptr< CachedFileStream > >(unsigned Task, const Twine &ModuleName)> AddStreamFn
This type defines the callback to add a file that is generated on the fly.
Definition: Caching.h:42
bool convertToDeclaration(GlobalValue &GV)
Converts value GV to declaration, or replaces with a declaration if it is an alias.
bool renameModuleForThinLTO(Module &M, const ModuleSummaryIndex &Index, bool ClearDSOLocalOnDeclarations, SetVector< GlobalValue * > *GlobalsToImport=nullptr)
Perform in-place global value handling on the given Module for exported local functions renamed and p...
void embedBitcodeInModule(Module &M, MemoryBufferRef Buf, bool EmbedBitcode, bool EmbedCmdline, const std::vector< uint8_t > &CmdArgs)
If EmbedBitcode is set, save a copy of the llvm IR as data in the __LLVM,__bitcode section (....
void updatePublicTypeTestCalls(Module &M, bool WholeProgramVisibilityEnabledInLTO)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:156
Expected< std::vector< BitcodeModule > > getBitcodeModuleList(MemoryBufferRef Buffer)
Returns a list of modules in the specified bitcode buffer.
cl::opt< bool > NoPGOWarnMismatch
Definition: MemProfiler.cpp:55
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
@ Mod
The access may modify the value stored in memory.
void thinLTOInternalizeModule(Module &TheModule, const GVSummaryMapTy &DefinedGlobals)
Internalize TheModule based on the information recorded in the summaries during global summary-based ...
ImmutablePass * createImmutableModuleSummaryIndexWrapperPass(const ModuleSummaryIndex *Index)
void SplitModule(Module &M, unsigned N, function_ref< void(std::unique_ptr< Module > MPart)> ModuleCallback, bool PreserveLocals=false)
Splits the module M into N linkable partitions.
Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
Definition: Error.cpp:103
void splitCodeGen(Module &M, ArrayRef< raw_pwrite_stream * > OSs, ArrayRef< llvm::raw_pwrite_stream * > BCOSs, const std::function< std::unique_ptr< TargetMachine >()> &TMFactory, CodeGenFileType FileType=CodeGenFileType::ObjectFile, bool PreserveLocals=false)
Split M into OSs.size() partitions, and generate code for each.
Definition: ParallelCG.cpp:38
void thinLTOFinalizeInModule(Module &TheModule, const GVSummaryMapTy &DefinedGlobals, bool PropagateAttrs)
Based on the information recorded in the summaries during global summary-based analysis:
A struct capturing PGO tunables.
Definition: PGOOptions.h:27
static const Target * lookupTarget(StringRef Triple, std::string &Error)
lookupTarget - Lookup a target based on a target triple.
LTO configuration.
Definition: Config.h:41
std::function< bool(unsigned Task, const Module &)> ModuleHookFn
The following callbacks deal with tasks, which normally represent the entire optimization and code ge...
Definition: Config.h:222
bool DebugPassManager
Whether to emit the pass manager debuggging informations.
Definition: Config.h:169
bool AddFSDiscriminator
Add FSAFDO discriminators.
Definition: Config.h:187
std::optional< uint64_t > RemarksHotnessThreshold
The minimum hotness value a diagnostic needs in order to be included in optimization diagnostics.
Definition: Config.h:163
Error addSaveTemps(std::string OutputFileName, bool UseInputModulePath=false, const DenseSet< StringRef > &SaveTempsArgs={})
This is a convenience function that configures this Config object to write temporary files named afte...
Definition: LTOBackend.cpp:87
ModuleHookFn PreOptModuleHook
This module hook is called after linking (regular LTO) or loading (ThinLTO) the module,...
Definition: Config.h:226
CombinedIndexHookFn CombinedIndexHook
Definition: Config.h:258
std::optional< CodeModel::Model > CodeModel
Definition: Config.h:56
std::string AAPipeline
Definition: Config.h:108
std::function< void(legacy::PassManager &)> PreCodeGenPassesHook
For adding passes that run right before codegen.
Definition: Config.h:54
bool CodeGenOnly
Disable entirely the optimizer, including importing for ThinLTO.
Definition: Config.h:71
bool DisableVerify
Definition: Config.h:61
std::vector< std::string > MAttrs
Definition: Config.h:50
bool VerifyEach
Definition: Config.h:60
CodeGenOptLevel CGOptLevel
Definition: Config.h:57
PipelineTuningOptions PTO
Tunable parameters for passes in the default pipelines.
Definition: Config.h:196
std::unique_ptr< raw_ostream > ResolutionFile
If this field is set, LTO will write input file paths and symbol resolutions here in llvm-lto2 comman...
Definition: Config.h:193
std::string CPU
Definition: Config.h:48
std::string DwoDir
The directory to store .dwo files.
Definition: Config.h:128
std::string RemarksFilename
Optimization remarks file path.
Definition: Config.h:142
bool UseDefaultPipeline
Use the standard optimization pipeline.
Definition: Config.h:64
ModuleHookFn PostPromoteModuleHook
This hook is called after promoting any internal functions (ThinLTO-specific).
Definition: Config.h:230
std::string ProfileRemapping
Name remapping file for profile data.
Definition: Config.h:125
TargetOptions Options
Definition: Config.h:49
std::string SplitDwarfFile
The name for the split debug info file used for the DW_AT_[GNU_]dwo_name attribute in the skeleton CU...
Definition: Config.h:134
std::string SplitDwarfOutput
The path to write a .dwo file to.
Definition: Config.h:139
ModuleHookFn PostOptModuleHook
This module hook is called after optimization is complete.
Definition: Config.h:239
std::string RemarksPasses
Optimization remarks pass filter.
Definition: Config.h:145
std::string OptPipeline
If this field is set, the set of passes run in the middle-end optimizer will be the one specified by ...
Definition: Config.h:103
bool RunCSIRInstr
Run PGO context sensitive IR instrumentation.
Definition: Config.h:74
ModuleHookFn PostInternalizeModuleHook
This hook is called after internalizing the module.
Definition: Config.h:233
unsigned OptLevel
Definition: Config.h:59
ModuleHookFn PostImportModuleHook
This hook is called after importing from other modules (ThinLTO-specific).
Definition: Config.h:236
bool RemarksWithHotness
Whether to emit optimization remarks with hotness informations.
Definition: Config.h:148
std::vector< std::string > PassPlugins
Definition: Config.h:52
std::string CSIRProfile
Context Sensitive PGO profile path.
Definition: Config.h:119
ModuleHookFn PreCodeGenModuleHook
This module hook is called before code generation.
Definition: Config.h:244
std::optional< Reloc::Model > RelocModel
Definition: Config.h:55
bool ShouldDiscardValueNames
Definition: Config.h:183
bool PGOWarnMismatch
Turn on/off the warning about a hash mismatch in the PGO profile data.
Definition: Config.h:77
CodeGenFileType CGFileType
Definition: Config.h:58
bool Freestanding
Flag to indicate that the optimizer should not assume builtins are present on the target.
Definition: Config.h:68
std::string SampleProfile
Sample PGO profile path.
Definition: Config.h:122
std::string RemarksFormat
The format used for serializing remarks (default: YAML).
Definition: Config.h:166
A derived class of LLVMContext that initializes itself according to a given Config object.
Definition: Config.h:297