[Passes] llvm::Optional => std::optional
This commit is contained in:
parent
f3b6dbfda8
commit
4e62072ca1
|
@ -773,7 +773,7 @@ static void addSanitizers(const Triple &TargetTriple,
|
|||
void EmitAssemblyHelper::RunOptimizationPipeline(
|
||||
BackendAction Action, std::unique_ptr<raw_pwrite_stream> &OS,
|
||||
std::unique_ptr<llvm::ToolOutputFile> &ThinLinkOS) {
|
||||
Optional<PGOOptions> PGOOpt;
|
||||
std::optional<PGOOptions> PGOOpt;
|
||||
|
||||
if (CodeGenOpts.hasProfileIRInstr())
|
||||
// -fprofile-generate.
|
||||
|
|
|
@ -97,7 +97,7 @@ public:
|
|||
class PassBuilder {
|
||||
TargetMachine *TM;
|
||||
PipelineTuningOptions PTO;
|
||||
Optional<PGOOptions> PGOOpt;
|
||||
std::optional<PGOOptions> PGOOpt;
|
||||
PassInstrumentationCallbacks *PIC;
|
||||
|
||||
public:
|
||||
|
@ -116,7 +116,7 @@ public:
|
|||
|
||||
explicit PassBuilder(TargetMachine *TM = nullptr,
|
||||
PipelineTuningOptions PTO = PipelineTuningOptions(),
|
||||
Optional<PGOOptions> PGOOpt = std::nullopt,
|
||||
std::optional<PGOOptions> PGOOpt = std::nullopt,
|
||||
PassInstrumentationCallbacks *PIC = nullptr);
|
||||
|
||||
/// Cross register the analysis managers through their proxies.
|
||||
|
@ -587,7 +587,7 @@ private:
|
|||
void addVectorPasses(OptimizationLevel Level, FunctionPassManager &FPM,
|
||||
bool IsFullLTO);
|
||||
|
||||
static Optional<std::vector<PipelineElement>>
|
||||
static std::optional<std::vector<PipelineElement>>
|
||||
parsePipelineText(StringRef Text);
|
||||
|
||||
Error parseModulePass(ModulePassManager &MPM, const PipelineElement &E);
|
||||
|
|
|
@ -127,7 +127,7 @@ public:
|
|||
// in the Graph (BBGuard). That is if any of the block is deleted or RAUWed
|
||||
// then the CFG is treated poisoned and no block pointer of the Graph is used.
|
||||
struct CFG {
|
||||
Optional<DenseMap<intptr_t, BBGuard>> BBGuards;
|
||||
std::optional<DenseMap<intptr_t, BBGuard>> BBGuards;
|
||||
DenseMap<const BasicBlock *, DenseMap<const BasicBlock *, unsigned>> Graph;
|
||||
|
||||
CFG(const Function *F, bool TrackBBLifetime);
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#ifndef LLVM_TARGET_TARGETMACHINE_H
|
||||
#define LLVM_TARGET_TARGETMACHINE_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
|
@ -111,7 +110,7 @@ protected: // Can only create subclasses.
|
|||
unsigned O0WantsFastISel : 1;
|
||||
|
||||
// PGO related tunables.
|
||||
Optional<PGOOptions> PGOOption = std::nullopt;
|
||||
std::optional<PGOOptions> PGOOption = std::nullopt;
|
||||
|
||||
public:
|
||||
const TargetOptions DefaultOptions;
|
||||
|
@ -311,8 +310,8 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
void setPGOOption(Optional<PGOOptions> PGOOpt) { PGOOption = PGOOpt; }
|
||||
const Optional<PGOOptions> &getPGOOption() const { return PGOOption; }
|
||||
void setPGOOption(std::optional<PGOOptions> PGOOpt) { PGOOption = PGOOpt; }
|
||||
const std::optional<PGOOptions> &getPGOOption() const { return PGOOption; }
|
||||
|
||||
/// If the specified generic pointer could be assumed as a pointer to a
|
||||
/// specific address space, return that address space.
|
||||
|
|
|
@ -340,7 +340,7 @@ static IdentifyingPassPtr overridePass(AnalysisID StandardID,
|
|||
static std::string getFSProfileFile(const TargetMachine *TM) {
|
||||
if (!FSProfileFile.empty())
|
||||
return FSProfileFile.getValue();
|
||||
const Optional<PGOOptions> &PGOOpt = TM->getPGOOption();
|
||||
const std::optional<PGOOptions> &PGOOpt = TM->getPGOOption();
|
||||
if (PGOOpt == std::nullopt || PGOOpt->Action != PGOOptions::SampleUse)
|
||||
return std::string();
|
||||
return PGOOpt->ProfileFile;
|
||||
|
@ -351,7 +351,7 @@ static std::string getFSProfileFile(const TargetMachine *TM) {
|
|||
static std::string getFSRemappingFile(const TargetMachine *TM) {
|
||||
if (!FSRemappingFile.empty())
|
||||
return FSRemappingFile.getValue();
|
||||
const Optional<PGOOptions> &PGOOpt = TM->getPGOOption();
|
||||
const std::optional<PGOOptions> &PGOOpt = TM->getPGOOption();
|
||||
if (PGOOpt == std::nullopt || PGOOpt->Action != PGOOptions::SampleUse)
|
||||
return std::string();
|
||||
return PGOOpt->ProfileRemappingFile;
|
||||
|
|
|
@ -232,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);
|
||||
|
|
|
@ -237,7 +237,7 @@ crossImportIntoModule(Module &TheModule, const ModuleSummaryIndex &Index,
|
|||
static void optimizeModule(Module &TheModule, TargetMachine &TM,
|
||||
unsigned OptLevel, bool Freestanding,
|
||||
bool DebugPassManager, ModuleSummaryIndex *Index) {
|
||||
Optional<PGOOptions> PGOOpt;
|
||||
std::optional<PGOOptions> PGOOpt;
|
||||
LoopAnalysisManager LAM;
|
||||
FunctionAnalysisManager FAM;
|
||||
CGSCCAnalysisManager CGAM;
|
||||
|
|
|
@ -395,7 +395,7 @@ public:
|
|||
} // namespace
|
||||
|
||||
PassBuilder::PassBuilder(TargetMachine *TM, PipelineTuningOptions PTO,
|
||||
Optional<PGOOptions> PGOOpt,
|
||||
std::optional<PGOOptions> PGOOpt,
|
||||
PassInstrumentationCallbacks *PIC)
|
||||
: TM(TM), PTO(PTO), PGOOpt(PGOOpt), PIC(PIC) {
|
||||
if (TM)
|
||||
|
@ -1027,7 +1027,7 @@ static bool isLoopPassName(StringRef Name, CallbacksT &Callbacks,
|
|||
return callbacksAcceptPassName<LoopPassManager>(Name, Callbacks);
|
||||
}
|
||||
|
||||
Optional<std::vector<PassBuilder::PipelineElement>>
|
||||
std::optional<std::vector<PassBuilder::PipelineElement>>
|
||||
PassBuilder::parsePipelineText(StringRef Text) {
|
||||
std::vector<PipelineElement> ResultPipeline;
|
||||
|
||||
|
|
|
@ -333,7 +333,7 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
|
|||
bool EnableDebugify, bool VerifyDIPreserve) {
|
||||
bool VerifyEachPass = VK == VK_VerifyEachPass;
|
||||
|
||||
Optional<PGOOptions> P;
|
||||
std::optional<PGOOptions> P;
|
||||
switch (PGOKindFlag) {
|
||||
case InstrGen:
|
||||
P = PGOOptions(ProfileFile, "", "", PGOOptions::IRInstr);
|
||||
|
|
Loading…
Reference in New Issue