/// compilation.
///
/// If threshold option is not specified, it is disabled by default.
- Optional<uint64_t> DiagnosticsHotnessThreshold = 0;
+ std::optional<uint64_t> DiagnosticsHotnessThreshold = 0;
/// The maximum percentage profiling weights can deviate from the expected
/// values in order to be included in misexpect diagnostics.
llvm::StringRef mapFile;
llvm::StringRef outputFile;
llvm::StringRef optRemarksFilename;
- llvm::Optional<uint64_t> optRemarksHotnessThreshold = 0;
+ std::optional<uint64_t> optRemarksHotnessThreshold = 0;
llvm::StringRef optRemarksPasses;
llvm::StringRef optRemarksFormat;
llvm::StringRef optStatsFilename;
/// Set the minimum hotness value a diagnostic needs in order to be
/// included in optimization diagnostics.
- void setDiagnosticsHotnessThreshold(Optional<uint64_t> Threshold);
+ void setDiagnosticsHotnessThreshold(std::optional<uint64_t> Threshold);
/// Return if hotness threshold is requested from PSI.
bool isDiagnosticsHotnessThresholdSetFromPSI() const;
#include "llvm/Remarks/Remark.h"
#include "llvm/Support/Error.h"
#include <memory>
+#include <optional>
#include <string>
namespace llvm {
setupLLVMOptimizationRemarks(LLVMContext &Context, StringRef RemarksFilename,
StringRef RemarksPasses, StringRef RemarksFormat,
bool RemarksWithHotness,
- Optional<uint64_t> RemarksHotnessThreshold = 0);
+ std::optional<uint64_t> RemarksHotnessThreshold = 0);
/// Setup optimization remarks that output directly to a raw_ostream.
/// \p OS is managed by the caller and should be open for writing as long as \p
Error setupLLVMOptimizationRemarks(
LLVMContext &Context, raw_ostream &OS, StringRef RemarksPasses,
StringRef RemarksFormat, bool RemarksWithHotness,
- Optional<uint64_t> RemarksHotnessThreshold = 0);
+ std::optional<uint64_t> RemarksHotnessThreshold = 0);
} // end namespace llvm
/// compilation.
///
/// If threshold option is not specified, it is disabled by default.
- llvm::Optional<uint64_t> RemarksHotnessThreshold = 0;
+ std::optional<uint64_t> RemarksHotnessThreshold = 0;
/// The format used for serializing remarks (default: YAML).
std::string RemarksFormat;
Expected<std::unique_ptr<ToolOutputFile>> setupLLVMOptimizationRemarks(
LLVMContext &Context, StringRef RemarksFilename, StringRef RemarksPasses,
StringRef RemarksFormat, bool RemarksWithHotness,
- Optional<uint64_t> RemarksHotnessThreshold = 0, int Count = -1);
+ std::optional<uint64_t> RemarksHotnessThreshold = 0, int Count = -1);
/// Setups the output file for saving statistics.
Expected<std::unique_ptr<ToolOutputFile>>
// The full set of bitcode modules in input order.
ModuleMapType ModuleMap;
// The bitcode modules to compile, if specified by the LTO Config.
- Optional<ModuleMapType> ModulesToCompile;
+ std::optional<ModuleMapType> ModulesToCompile;
DenseMap<GlobalValue::GUID, StringRef> PrevailingModuleForGUID;
} ThinLTO;
mutable bool CalledGetMaxTasks = false;
// Use Optional to distinguish false from not yet initialized.
- Optional<bool> EnableSplitLTOUnit;
+ std::optional<bool> EnableSplitLTOUnit;
// Identify symbols exported dynamically, and that therefore could be
// referenced by a shared library not visible to the linker.
#ifndef LLVM_REMARKS_HOTNESSTHRESHOLDPARSER_H
#define LLVM_REMARKS_HOTNESSTHRESHOLDPARSER_H
-#include "llvm/ADT/Optional.h"
#include "llvm/Support/CommandLine.h"
+#include <optional>
namespace llvm {
namespace remarks {
//
// Return None Optional if 'auto' is specified, indicating the value will
// be filled later during PSI.
-inline Expected<Optional<uint64_t>> parseHotnessThresholdOption(StringRef Arg) {
+inline Expected<std::optional<uint64_t>> parseHotnessThresholdOption(StringRef Arg) {
if (Arg == "auto")
return std::nullopt;
}
// A simple CL parser for '*-remarks-hotness-threshold='
-class HotnessThresholdParser : public cl::parser<Optional<uint64_t>> {
+class HotnessThresholdParser : public cl::parser<std::optional<uint64_t>> {
public:
- HotnessThresholdParser(cl::Option &O) : cl::parser<Optional<uint64_t>>(O) {}
+ HotnessThresholdParser(cl::Option &O) : cl::parser<std::optional<uint64_t>>(O) {}
bool parse(cl::Option &O, StringRef ArgName, StringRef Arg,
- Optional<uint64_t> &V) {
+ std::optional<uint64_t> &V) {
auto ResultOrErr = parseHotnessThresholdOption(Arg);
if (!ResultOrErr)
return O.error("Invalid argument '" + Arg +
return pImpl->DiagnosticsHotnessRequested;
}
-void LLVMContext::setDiagnosticsHotnessThreshold(Optional<uint64_t> Threshold) {
+void LLVMContext::setDiagnosticsHotnessThreshold(std::optional<uint64_t> Threshold) {
pImpl->DiagnosticsHotnessThreshold = Threshold;
}
void LLVMContext::setMisExpectWarningRequested(bool Requested) {
/// constant.
///
/// If threshold option is not specified, it is disabled (0) by default.
- Optional<uint64_t> DiagnosticsHotnessThreshold = 0;
+ std::optional<uint64_t> DiagnosticsHotnessThreshold = 0;
/// The percentage of difference between profiling branch weights and
/// llvm.expect branch weights to tolerate when emiting MisExpect diagnostics
Expected<std::unique_ptr<ToolOutputFile>> llvm::setupLLVMOptimizationRemarks(
LLVMContext &Context, StringRef RemarksFilename, StringRef RemarksPasses,
StringRef RemarksFormat, bool RemarksWithHotness,
- Optional<uint64_t> RemarksHotnessThreshold) {
+ std::optional<uint64_t> RemarksHotnessThreshold) {
if (RemarksWithHotness)
Context.setDiagnosticsHotnessRequested(true);
Error llvm::setupLLVMOptimizationRemarks(
LLVMContext &Context, raw_ostream &OS, StringRef RemarksPasses,
StringRef RemarksFormat, bool RemarksWithHotness,
- Optional<uint64_t> RemarksHotnessThreshold) {
+ std::optional<uint64_t> RemarksHotnessThreshold) {
if (RemarksWithHotness)
Context.setDiagnosticsHotnessRequested(true);
Expected<std::unique_ptr<ToolOutputFile>> lto::setupLLVMOptimizationRemarks(
LLVMContext &Context, StringRef RemarksFilename, StringRef RemarksPasses,
StringRef RemarksFormat, bool RemarksWithHotness,
- Optional<uint64_t> RemarksHotnessThreshold, int Count) {
+ std::optional<uint64_t> RemarksHotnessThreshold, int Count) {
std::string Filename = std::string(RemarksFilename);
// For ThinLTO, file.opt.<format> becomes
// file.opt.<format>.thin.<num>.<format>.
cl::desc("With PGO, include profile count in optimization remarks"),
cl::Hidden);
-cl::opt<Optional<uint64_t>, false, remarks::HotnessThresholdParser>
+cl::opt<std::optional<uint64_t>, false, remarks::HotnessThresholdParser>
RemarksHotnessThreshold(
"lto-pass-remarks-hotness-threshold",
cl::desc("Minimum profile count required for an "
extern cl::opt<std::string> RemarksFilename;
extern cl::opt<std::string> RemarksPasses;
extern cl::opt<bool> RemarksWithHotness;
-extern cl::opt<Optional<uint64_t>, false, remarks::HotnessThresholdParser>
+extern cl::opt<std::optional<uint64_t>, false, remarks::HotnessThresholdParser>
RemarksHotnessThreshold;
extern cl::opt<std::string> RemarksFormat;
}
static std::string RemarksFilename;
static std::string RemarksPasses;
static bool RemarksWithHotness = false;
- static Optional<uint64_t> RemarksHotnessThreshold = 0;
+ static std::optional<uint64_t> RemarksHotnessThreshold = 0;
static std::string RemarksFormat;
// Context sensitive PGO options.
cl::desc("With PGO, include profile count in optimization remarks"),
cl::Hidden);
-static cl::opt<Optional<uint64_t>, false, remarks::HotnessThresholdParser>
+static cl::opt<std::optional<uint64_t>, false, remarks::HotnessThresholdParser>
RemarksHotnessThreshold(
"pass-remarks-hotness-threshold",
cl::desc("Minimum profile count required for "
cl::desc("With PGO, include profile count in optimization remarks"),
cl::Hidden);
-cl::opt<Optional<uint64_t>, false, remarks::HotnessThresholdParser>
+cl::opt<std::optional<uint64_t>, false, remarks::HotnessThresholdParser>
RemarksHotnessThreshold(
"pass-remarks-hotness-threshold",
cl::desc("Minimum profile count required for an "
cl::desc("With PGO, include profile count in optimization remarks"),
cl::Hidden);
-static cl::opt<Optional<uint64_t>, false, remarks::HotnessThresholdParser>
+static cl::opt<std::optional<uint64_t>, false, remarks::HotnessThresholdParser>
RemarksHotnessThreshold(
"pass-remarks-hotness-threshold",
cl::desc("Minimum profile count required for "
"an optimization remark to be output. "
- "Use 'auto' to apply the threshold from profile summary."),
+ "Use 'auto' to apply the threshold from profile summary"),
cl::value_desc("N or 'auto'"), cl::init(0), cl::Hidden);
static cl::opt<std::string>