aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/LTO/LTOBackend.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2023-02-11 12:38:04 +0000
committerDimitry Andric <dim@FreeBSD.org>2023-02-11 12:38:11 +0000
commite3b557809604d036af6e00c60f012c2025b59a5e (patch)
tree8a11ba2269a3b669601e2fd41145b174008f4da8 /llvm/lib/LTO/LTOBackend.cpp
parent08e8dd7b9db7bb4a9de26d44c1cbfd24e869c014 (diff)
Diffstat (limited to 'llvm/lib/LTO/LTOBackend.cpp')
-rw-r--r--llvm/lib/LTO/LTOBackend.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index 2e32469b4926..1c2ca253af35 100644
--- a/llvm/lib/LTO/LTOBackend.cpp
+++ b/llvm/lib/LTO/LTOBackend.cpp
@@ -44,6 +44,7 @@
#include "llvm/Transforms/Scalar/LoopPassManager.h"
#include "llvm/Transforms/Utils/FunctionImportUtils.h"
#include "llvm/Transforms/Utils/SplitModule.h"
+#include <optional>
using namespace llvm;
using namespace lto;
@@ -207,14 +208,14 @@ createTargetMachine(const Config &Conf, const Target *TheTarget, Module &M) {
for (const std::string &A : Conf.MAttrs)
Features.AddFeature(A);
- Optional<Reloc::Model> RelocModel = None;
+ std::optional<Reloc::Model> RelocModel;
if (Conf.RelocModel)
RelocModel = *Conf.RelocModel;
else if (M.getModuleFlag("PIC Level"))
RelocModel =
M.getPICLevel() == PICLevel::NotPIC ? Reloc::Static : Reloc::PIC_;
- Optional<CodeModel::Model> CodeModel;
+ std::optional<CodeModel::Model> CodeModel;
if (Conf.CodeModel)
CodeModel = *Conf.CodeModel;
else
@@ -231,7 +232,7 @@ static void runNewPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM,
unsigned OptLevel, bool IsThinLTO,
ModuleSummaryIndex *ExportSummary,
const ModuleSummaryIndex *ImportSummary) {
- Optional<PGOOptions> PGOOpt;
+ std::optional<PGOOptions> PGOOpt;
if (!Conf.SampleProfile.empty())
PGOOpt = PGOOptions(Conf.SampleProfile, "", Conf.ProfileRemapping,
PGOOptions::SampleUse, PGOOptions::NoCSAction, true);
@@ -256,7 +257,7 @@ static void runNewPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM,
ModuleAnalysisManager MAM;
PassInstrumentationCallbacks PIC;
- StandardInstrumentations SI(Conf.DebugPassManager);
+ StandardInstrumentations SI(Mod.getContext(), Conf.DebugPassManager);
SI.registerCallbacks(PIC, &FAM);
PassBuilder PB(TM, Conf.PTO, PGOOpt, &PIC);
@@ -391,7 +392,8 @@ static void codegen(const Config &Conf, TargetMachine *TM,
EC.message());
}
- Expected<std::unique_ptr<CachedFileStream>> StreamOrErr = AddStream(Task);
+ Expected<std::unique_ptr<CachedFileStream>> StreamOrErr =
+ AddStream(Task, Mod.getModuleIdentifier());
if (Error Err = StreamOrErr.takeError())
report_fatal_error(std::move(Err));
std::unique_ptr<CachedFileStream> &Stream = *StreamOrErr;