diff options
Diffstat (limited to 'llvm/lib/LTO/LTOBackend.cpp')
| -rw-r--r-- | llvm/lib/LTO/LTOBackend.cpp | 12 |
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; |
