diff --git a/llvm/include/llvm/Analysis/InlineCost.h b/llvm/include/llvm/Analysis/InlineCost.h index 7e567895215a1..57f452853d2d6 100644 --- a/llvm/include/llvm/Analysis/InlineCost.h +++ b/llvm/include/llvm/Analysis/InlineCost.h @@ -102,7 +102,7 @@ class InlineCost { const char *Reason = nullptr; /// The cost-benefit pair computed by cost-benefit analysis. - std::optional CostBenefit = std::nullopt; + std::optional CostBenefit; // Trivial constructor, interesting logic in the factory functions below. InlineCost(int Cost, int Threshold, int StaticBonusApplied, diff --git a/llvm/include/llvm/DWP/DWP.h b/llvm/include/llvm/DWP/DWP.h index ff2614000fe10..543354d86bbb5 100644 --- a/llvm/include/llvm/DWP/DWP.h +++ b/llvm/include/llvm/DWP/DWP.h @@ -44,7 +44,7 @@ struct InfoSectionUnitHeader { // dwo_id field. This resides in the header only if Version >= 5. // In earlier versions, it is read from DW_AT_GNU_dwo_id. - std::optional Signature = std::nullopt; + std::optional Signature; // Derived from the length of Length field. dwarf::DwarfFormat Format = dwarf::DwarfFormat::DWARF32; diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h index 1ba544dd5143a..3177cfe0a6a01 100644 --- a/llvm/include/llvm/IR/Instructions.h +++ b/llvm/include/llvm/IR/Instructions.h @@ -3612,7 +3612,7 @@ class SwitchInst : public Instruction { /// their prof branch_weights metadata. class SwitchInstProfUpdateWrapper { SwitchInst &SI; - std::optional> Weights = std::nullopt; + std::optional> Weights; bool Changed = false; protected: diff --git a/llvm/include/llvm/LTO/Config.h b/llvm/include/llvm/LTO/Config.h index 2dbe284ff449b..4c793697da022 100644 --- a/llvm/include/llvm/LTO/Config.h +++ b/llvm/include/llvm/LTO/Config.h @@ -53,7 +53,7 @@ struct Config { /// For adding passes that run right before codegen. std::function PreCodeGenPassesHook; std::optional RelocModel = Reloc::PIC_; - std::optional CodeModel = std::nullopt; + std::optional CodeModel; CodeGenOpt::Level CGOptLevel = CodeGenOpt::Default; CodeGenFileType CGFileType = CGFT_ObjectFile; unsigned OptLevel = 2; diff --git a/llvm/include/llvm/Object/ELF.h b/llvm/include/llvm/Object/ELF.h index ed2afc6042245..9f90ab2e702aa 100644 --- a/llvm/include/llvm/Object/ELF.h +++ b/llvm/include/llvm/Object/ELF.h @@ -120,7 +120,7 @@ template struct DataRegion { } const T *First; - std::optional Size = std::nullopt; + std::optional Size; const uint8_t *BufEnd = nullptr; }; diff --git a/llvm/include/llvm/Target/TargetMachine.h b/llvm/include/llvm/Target/TargetMachine.h index 2dd1c81995130..57365d2c74d69 100644 --- a/llvm/include/llvm/Target/TargetMachine.h +++ b/llvm/include/llvm/Target/TargetMachine.h @@ -110,7 +110,7 @@ class TargetMachine { unsigned O0WantsFastISel : 1; // PGO related tunables. - std::optional PGOOption = std::nullopt; + std::optional PGOOption; public: const TargetOptions DefaultOptions; diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h index 59a0d2ae6f882..1d813cb8b3385 100644 --- a/llvm/include/llvm/Transforms/IPO/Attributor.h +++ b/llvm/include/llvm/Transforms/IPO/Attributor.h @@ -1385,7 +1385,7 @@ struct AttributorConfig { DenseSet *Allowed = nullptr; /// Maximum number of iterations to run until fixpoint. - std::optional MaxFixpointIterations = std::nullopt; + std::optional MaxFixpointIterations; /// A callback function that returns an ORE object from a Function pointer. ///{ diff --git a/llvm/include/llvm/Transforms/Scalar/GVN.h b/llvm/include/llvm/Transforms/Scalar/GVN.h index 888a537ba2596..b043cfb2c258c 100644 --- a/llvm/include/llvm/Transforms/Scalar/GVN.h +++ b/llvm/include/llvm/Transforms/Scalar/GVN.h @@ -72,11 +72,11 @@ class GVNLegacyPass; /// Intended use is to create a default object, modify parameters with /// additional setters and then pass it to GVN. struct GVNOptions { - std::optional AllowPRE = std::nullopt; - std::optional AllowLoadPRE = std::nullopt; - std::optional AllowLoadInLoopPRE = std::nullopt; - std::optional AllowLoadPRESplitBackedge = std::nullopt; - std::optional AllowMemDep = std::nullopt; + std::optional AllowPRE; + std::optional AllowLoadPRE; + std::optional AllowLoadInLoopPRE; + std::optional AllowLoadPRESplitBackedge; + std::optional AllowMemDep; GVNOptions() = default; diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp index e39940ed6a9b5..309da995e5f3b 100644 --- a/llvm/lib/Analysis/InlineCost.cpp +++ b/llvm/lib/Analysis/InlineCost.cpp @@ -584,7 +584,7 @@ class InlineCostCallAnalyzer final : public CallAnalyzer { bool DecidedByCostBenefit = false; // The cost-benefit pair computed by cost-benefit analysis. - std::optional CostBenefit = std::nullopt; + std::optional CostBenefit; bool SingleBB = true; diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp index 0e6a12261e23a..fec7a0fd35795 100644 --- a/llvm/lib/Analysis/MemorySSA.cpp +++ b/llvm/lib/Analysis/MemorySSA.cpp @@ -719,7 +719,7 @@ class ClobberWalker { T &curNode() const { return W->Paths[*N]; } Walker *W = nullptr; - std::optional N = std::nullopt; + std::optional N; }; using def_path_iterator = generic_def_path_iterator; diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index 2a6f9b9673a36..94e1ad211eeab 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -1830,7 +1830,7 @@ void at::trackAssignments(Function::iterator Start, Function::iterator End, for (auto BBI = Start; BBI != End; ++BBI) { for (Instruction &I : *BBI) { - std::optional Info = std::nullopt; + std::optional Info; Value *ValueComponent = nullptr; Value *DestComponent = nullptr; if (auto *AI = dyn_cast(&I)) { diff --git a/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp b/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp index 1859195de86ef..afea2b2f5f754 100644 --- a/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp +++ b/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp @@ -99,7 +99,7 @@ using LdStPairFlags = struct LdStPairFlags { // If not none, RenameReg can be used to rename the result register of the // first store in a pair. Currently this only works when merging stores // forward. - std::optional RenameReg = std::nullopt; + std::optional RenameReg; LdStPairFlags() = default; diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index 48dcce72ee45c..5baa7e78a58f6 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -1697,7 +1697,7 @@ class BoUpSLP { // Sometimes we have more than one option (e.g., Opcode and Undefs), so we // are using the score to differentiate between the two. struct BestOpData { - std::optional Idx = std::nullopt; + std::optional Idx; unsigned Score = 0; } BestOp; BestOp.Score = diff --git a/llvm/unittests/IR/DebugInfoTest.cpp b/llvm/unittests/IR/DebugInfoTest.cpp index 1930ecdd8cc9f..8a5157f292bbb 100644 --- a/llvm/unittests/IR/DebugInfoTest.cpp +++ b/llvm/unittests/IR/DebugInfoTest.cpp @@ -198,8 +198,8 @@ TEST(DIBuiler, CreateFile) { DIFile *F = DIB.createFile("main.c", "/"); EXPECT_EQ(std::nullopt, F->getSource()); - std::optional> Checksum = std::nullopt; - std::optional Source = std::nullopt; + std::optional> Checksum; + std::optional Source; F = DIB.createFile("main.c", "/", Checksum, Source); EXPECT_EQ(Source, F->getSource()); diff --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp index 05f1cc17dfdf3..926490f6b0b05 100644 --- a/llvm/unittests/IR/MetadataTest.cpp +++ b/llvm/unittests/IR/MetadataTest.cpp @@ -2219,8 +2219,8 @@ TEST_F(DIFileTest, EmptySource) { DIFile *N = DIFile::get(Context, "file", "dir"); EXPECT_EQ(std::nullopt, N->getSource()); - std::optional> Checksum = std::nullopt; - std::optional Source = std::nullopt; + std::optional> Checksum; + std::optional Source; N = DIFile::get(Context, "file", "dir", Checksum, Source); EXPECT_EQ(Source, N->getSource());