From e3b557809604d036af6e00c60f012c2025b59a5e Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 11 Feb 2023 13:38:04 +0100 Subject: Vendor import of llvm-project main llvmorg-16-init-18548-gb0daacf58f41, the last commit before the upstream release/17.x branch was created. --- llvm/lib/LTO/LTOBackend.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'llvm/lib/LTO/LTOBackend.cpp') 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 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 RelocModel = None; + std::optional RelocModel; if (Conf.RelocModel) RelocModel = *Conf.RelocModel; else if (M.getModuleFlag("PIC Level")) RelocModel = M.getPICLevel() == PICLevel::NotPIC ? Reloc::Static : Reloc::PIC_; - Optional CodeModel; + std::optional 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 PGOOpt; + std::optional 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> StreamOrErr = AddStream(Task); + Expected> StreamOrErr = + AddStream(Task, Mod.getModuleIdentifier()); if (Error Err = StreamOrErr.takeError()) report_fatal_error(std::move(Err)); std::unique_ptr &Stream = *StreamOrErr; -- cgit v1.2.3