[llvm] b6a01ca - [llvm/unittests] Use std::nullopt instead of None (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 2 22:10:44 PST 2022


Author: Kazu Hirata
Date: 2022-12-02T22:10:37-08:00
New Revision: b6a01caa64aaac2e5db8d7953a81cbe1a139b81f

URL: https://github.com/llvm/llvm-project/commit/b6a01caa64aaac2e5db8d7953a81cbe1a139b81f
DIFF: https://github.com/llvm/llvm-project/commit/b6a01caa64aaac2e5db8d7953a81cbe1a139b81f.diff

LOG: [llvm/unittests] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

Added: 
    

Modified: 
    llvm/include/llvm/Testing/Support/Error.h
    llvm/lib/Testing/Support/Annotations.cpp
    llvm/unittests/ADT/APIntTest.cpp
    llvm/unittests/ADT/IteratorTest.cpp
    llvm/unittests/ADT/OptionalTest.cpp
    llvm/unittests/Analysis/AliasAnalysisTest.cpp
    llvm/unittests/Analysis/LoopInfoTest.cpp
    llvm/unittests/Analysis/MemoryBuiltinsTest.cpp
    llvm/unittests/Analysis/ScalarEvolutionTest.cpp
    llvm/unittests/Analysis/ValueTrackingTest.cpp
    llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp
    llvm/unittests/CodeGen/AMDGPUMetadataTest.cpp
    llvm/unittests/CodeGen/GlobalISel/GISelMITest.cpp
    llvm/unittests/CodeGen/InstrRefLDVTest.cpp
    llvm/unittests/CodeGen/LexicalScopesTest.cpp
    llvm/unittests/CodeGen/MFCommon.inc
    llvm/unittests/CodeGen/MachineInstrTest.cpp
    llvm/unittests/CodeGen/PassManagerTest.cpp
    llvm/unittests/CodeGen/SelectionDAGAddressAnalysisTest.cpp
    llvm/unittests/CodeGen/TargetOptionsTest.cpp
    llvm/unittests/CodeGen/TestAsmPrinter.cpp
    llvm/unittests/DebugInfo/DWARF/DWARFDebugFrameTest.cpp
    llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
    llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp
    llvm/unittests/DebugInfo/DWARF/DWARFLocationExpressionTest.cpp
    llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
    llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
    llvm/unittests/DebugInfo/Symbolizer/MarkupTest.cpp
    llvm/unittests/ExecutionEngine/JITLink/LinkGraphTests.cpp
    llvm/unittests/ExecutionEngine/Orc/JITTargetMachineBuilderTest.cpp
    llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
    llvm/unittests/IR/AttributesTest.cpp
    llvm/unittests/IR/CFGBuilder.cpp
    llvm/unittests/IR/ConstantRangeTest.cpp
    llvm/unittests/IR/ConstantsTest.cpp
    llvm/unittests/IR/IRBuilderTest.cpp
    llvm/unittests/IR/InstructionsTest.cpp
    llvm/unittests/IR/MetadataTest.cpp
    llvm/unittests/IR/PassBuilderCallbacksTest.cpp
    llvm/unittests/IR/VerifierTest.cpp
    llvm/unittests/MC/AMDGPU/DwarfRegMappings.cpp
    llvm/unittests/MC/DwarfLineTableHeaders.cpp
    llvm/unittests/MC/MCDisassemblerTest.cpp
    llvm/unittests/MI/LiveIntervalTest.cpp
    llvm/unittests/MIR/MachineMetadata.cpp
    llvm/unittests/Object/ELFObjectFileTest.cpp
    llvm/unittests/Object/MinidumpTest.cpp
    llvm/unittests/Remarks/BitstreamRemarksSerializerTest.cpp
    llvm/unittests/Remarks/YAMLRemarksParsingTest.cpp
    llvm/unittests/Remarks/YAMLRemarksSerializerTest.cpp
    llvm/unittests/Support/CheckedArithmeticTest.cpp
    llvm/unittests/Support/ConvertUTFTest.cpp
    llvm/unittests/Support/ErrorTest.cpp
    llvm/unittests/Support/Host.cpp
    llvm/unittests/Support/InstructionCostTest.cpp
    llvm/unittests/Support/JSONTest.cpp
    llvm/unittests/Support/MatchersTest.cpp
    llvm/unittests/Support/NativeFormatTests.cpp
    llvm/unittests/Support/Path.cpp
    llvm/unittests/Support/ProgramTest.cpp
    llvm/unittests/Support/SourceMgrTest.cpp
    llvm/unittests/Support/VirtualFileSystemTest.cpp
    llvm/unittests/Support/raw_ostream_test.cpp
    llvm/unittests/Target/AArch64/InstSizes.cpp
    llvm/unittests/Target/AArch64/MatrixRegisterAliasing.cpp
    llvm/unittests/Target/AMDGPU/DwarfRegMappings.cpp
    llvm/unittests/Target/ARM/InstSizes.cpp
    llvm/unittests/Target/ARM/MachineInstrTest.cpp
    llvm/unittests/Target/PowerPC/AIXRelocModelTest.cpp
    llvm/unittests/Target/WebAssembly/WebAssemblyExceptionInfoTest.cpp
    llvm/unittests/Target/X86/MachineSizeOptsTest.cpp
    llvm/unittests/Testing/Support/TempPathTest.cpp
    llvm/unittests/Transforms/Utils/CloningTest.cpp
    llvm/unittests/Transforms/Utils/ValueMapperTest.cpp
    llvm/unittests/tools/llvm-mca/MCATestBase.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Testing/Support/Error.h b/llvm/include/llvm/Testing/Support/Error.h
index c1ca92f5e4a2a..41abc718a6135 100644
--- a/llvm/include/llvm/Testing/Support/Error.h
+++ b/llvm/include/llvm/Testing/Support/Error.h
@@ -196,7 +196,7 @@ MATCHER(Failed, "") { return !arg.Success(); }
 
 template <typename InfoT>
 testing::Matcher<const detail::ErrorHolder &> Failed() {
-  return MakeMatcher(new detail::ErrorMatchesMono<InfoT>(None));
+  return MakeMatcher(new detail::ErrorMatchesMono<InfoT>(std::nullopt));
 }
 
 template <typename InfoT, typename M>

diff  --git a/llvm/lib/Testing/Support/Annotations.cpp b/llvm/lib/Testing/Support/Annotations.cpp
index fdb1bf94b3bff..0f9fcfef681d8 100644
--- a/llvm/lib/Testing/Support/Annotations.cpp
+++ b/llvm/lib/Testing/Support/Annotations.cpp
@@ -37,15 +37,15 @@ Annotations::Annotations(llvm::StringRef Text) {
       All.push_back(
           {Code.size(), size_t(-1), Name.value_or(""), Payload.value_or("")});
       Points[Name.value_or("")].push_back(All.size() - 1);
-      Name = llvm::None;
-      Payload = llvm::None;
+      Name = std::nullopt;
+      Payload = std::nullopt;
       continue;
     }
     if (Text.consume_front("[[")) {
       OpenRanges.push_back(
           {Code.size(), size_t(-1), Name.value_or(""), Payload.value_or("")});
-      Name = llvm::None;
-      Payload = llvm::None;
+      Name = std::nullopt;
+      Payload = std::nullopt;
       continue;
     }
     Require(!Name, "$name should be followed by ^ or [[");

diff  --git a/llvm/unittests/ADT/APIntTest.cpp b/llvm/unittests/ADT/APIntTest.cpp
index 3dba0fa0fded9..c5a9859d4d714 100644
--- a/llvm/unittests/ADT/APIntTest.cpp
+++ b/llvm/unittests/ADT/APIntTest.cpp
@@ -2932,10 +2932,10 @@ TEST(APIntTest, MultiplicativeInverseExaustive) {
 
 TEST(APIntTest, GetMostSignificantDifferentBit) {
   EXPECT_EQ(APIntOps::GetMostSignificantDifferentBit(APInt(8, 0), APInt(8, 0)),
-            llvm::None);
+            std::nullopt);
   EXPECT_EQ(
       APIntOps::GetMostSignificantDifferentBit(APInt(8, 42), APInt(8, 42)),
-      llvm::None);
+      std::nullopt);
   EXPECT_EQ(*APIntOps::GetMostSignificantDifferentBit(APInt(8, 0), APInt(8, 1)),
             0u);
   EXPECT_EQ(*APIntOps::GetMostSignificantDifferentBit(APInt(8, 0), APInt(8, 2)),
@@ -2945,7 +2945,7 @@ TEST(APIntTest, GetMostSignificantDifferentBit) {
   EXPECT_EQ(*APIntOps::GetMostSignificantDifferentBit(APInt(8, 1), APInt(8, 0)),
             0u);
   EXPECT_EQ(APIntOps::GetMostSignificantDifferentBit(APInt(8, 1), APInt(8, 1)),
-            llvm::None);
+            std::nullopt);
   EXPECT_EQ(*APIntOps::GetMostSignificantDifferentBit(APInt(8, 1), APInt(8, 2)),
             1u);
   EXPECT_EQ(*APIntOps::GetMostSignificantDifferentBit(APInt(8, 1), APInt(8, 3)),
@@ -2960,7 +2960,7 @@ TEST(APIntTest, GetMostSignificantDifferentBitExaustive) {
       [](const APInt &V0, const APInt &V1) -> llvm::Optional<unsigned> {
     assert(V0.getBitWidth() == V1.getBitWidth() && "Must have same bitwidth");
     if (V0 == V1)
-      return llvm::None; // Bitwise identical.
+      return std::nullopt; // Bitwise identical.
     // There is a mismatch. Let's find the most significant 
diff erent bit.
     for (int Bit = V0.getBitWidth() - 1; Bit >= 0; --Bit) {
       if (V0[Bit] == V1[Bit])

diff  --git a/llvm/unittests/ADT/IteratorTest.cpp b/llvm/unittests/ADT/IteratorTest.cpp
index 14fbcd5cf84c0..69cfadb6aa178 100644
--- a/llvm/unittests/ADT/IteratorTest.cpp
+++ b/llvm/unittests/ADT/IteratorTest.cpp
@@ -481,7 +481,7 @@ TEST(ZipIteratorTest, ZipLongestBasic) {
     const vector<tuple<Optional<unsigned>, Optional<StringRef>>> expected{
         make_tuple(3, StringRef("2")), make_tuple(1, StringRef("7")),
         make_tuple(4, StringRef("1")), make_tuple(1, StringRef("8")),
-        make_tuple(5, None),           make_tuple(9, None)};
+        make_tuple(5, std::nullopt),   make_tuple(9, std::nullopt)};
     size_t iters = 0;
     for (auto tup : zip_longest(pi, e)) {
       EXPECT_EQ(tup, expected[iters]);
@@ -495,7 +495,7 @@ TEST(ZipIteratorTest, ZipLongestBasic) {
     const vector<tuple<Optional<StringRef>, Optional<unsigned>>> expected{
         make_tuple(StringRef("2"), 3), make_tuple(StringRef("7"), 1),
         make_tuple(StringRef("1"), 4), make_tuple(StringRef("8"), 1),
-        make_tuple(None, 5),           make_tuple(None, 9)};
+        make_tuple(std::nullopt, 5),   make_tuple(std::nullopt, 9)};
     size_t iters = 0;
     for (auto tup : zip_longest(e, pi)) {
       EXPECT_EQ(tup, expected[iters]);

diff  --git a/llvm/unittests/ADT/OptionalTest.cpp b/llvm/unittests/ADT/OptionalTest.cpp
index 5f1f88d107399..76e99bbf323bb 100644
--- a/llvm/unittests/ADT/OptionalTest.cpp
+++ b/llvm/unittests/ADT/OptionalTest.cpp
@@ -680,12 +680,12 @@ void CheckRelation(const Optional<T> &Lhs, const Optional<T> &Rhs,
   if (Lhs)
     EXPECT_EQ(Expected, OperatorT::apply(*Lhs, Rhs));
   else
-    EXPECT_EQ(Expected, OperatorT::apply(None, Rhs));
+    EXPECT_EQ(Expected, OperatorT::apply(std::nullopt, Rhs));
 
   if (Rhs)
     EXPECT_EQ(Expected, OperatorT::apply(Lhs, *Rhs));
   else
-    EXPECT_EQ(Expected, OperatorT::apply(Lhs, None));
+    EXPECT_EQ(Expected, OperatorT::apply(Lhs, std::nullopt));
 }
 
 struct EqualityMock {};
@@ -800,7 +800,7 @@ TEST(OptionalTest, StreamOperator) {
   };
   EXPECT_EQ("ComparableAndStreamable",
             to_string(ComparableAndStreamable::get()));
-  EXPECT_EQ("None", to_string(None));
+  EXPECT_EQ("None", to_string(std::nullopt));
 }
 
 struct Comparable {

diff  --git a/llvm/unittests/Analysis/AliasAnalysisTest.cpp b/llvm/unittests/Analysis/AliasAnalysisTest.cpp
index 6156b8a2c8bac..96569fe07019c 100644
--- a/llvm/unittests/Analysis/AliasAnalysisTest.cpp
+++ b/llvm/unittests/Analysis/AliasAnalysisTest.cpp
@@ -192,17 +192,17 @@ TEST_F(AliasAnalysisTest, getModRefInfo) {
 
   // Check basic results
   EXPECT_EQ(AA.getModRefInfo(Store1, MemoryLocation()), ModRefInfo::Mod);
-  EXPECT_EQ(AA.getModRefInfo(Store1, None), ModRefInfo::Mod);
+  EXPECT_EQ(AA.getModRefInfo(Store1, std::nullopt), ModRefInfo::Mod);
   EXPECT_EQ(AA.getModRefInfo(Load1, MemoryLocation()), ModRefInfo::Ref);
-  EXPECT_EQ(AA.getModRefInfo(Load1, None), ModRefInfo::Ref);
+  EXPECT_EQ(AA.getModRefInfo(Load1, std::nullopt), ModRefInfo::Ref);
   EXPECT_EQ(AA.getModRefInfo(Add1, MemoryLocation()), ModRefInfo::NoModRef);
-  EXPECT_EQ(AA.getModRefInfo(Add1, None), ModRefInfo::NoModRef);
+  EXPECT_EQ(AA.getModRefInfo(Add1, std::nullopt), ModRefInfo::NoModRef);
   EXPECT_EQ(AA.getModRefInfo(VAArg1, MemoryLocation()), ModRefInfo::ModRef);
-  EXPECT_EQ(AA.getModRefInfo(VAArg1, None), ModRefInfo::ModRef);
+  EXPECT_EQ(AA.getModRefInfo(VAArg1, std::nullopt), ModRefInfo::ModRef);
   EXPECT_EQ(AA.getModRefInfo(CmpXChg1, MemoryLocation()), ModRefInfo::ModRef);
-  EXPECT_EQ(AA.getModRefInfo(CmpXChg1, None), ModRefInfo::ModRef);
+  EXPECT_EQ(AA.getModRefInfo(CmpXChg1, std::nullopt), ModRefInfo::ModRef);
   EXPECT_EQ(AA.getModRefInfo(AtomicRMW, MemoryLocation()), ModRefInfo::ModRef);
-  EXPECT_EQ(AA.getModRefInfo(AtomicRMW, None), ModRefInfo::ModRef);
+  EXPECT_EQ(AA.getModRefInfo(AtomicRMW, std::nullopt), ModRefInfo::ModRef);
 }
 
 static Instruction *getInstructionByName(Function &F, StringRef Name) {

diff  --git a/llvm/unittests/Analysis/LoopInfoTest.cpp b/llvm/unittests/Analysis/LoopInfoTest.cpp
index 6e4e2ca3456b3..c7b69ead72033 100644
--- a/llvm/unittests/Analysis/LoopInfoTest.cpp
+++ b/llvm/unittests/Analysis/LoopInfoTest.cpp
@@ -271,7 +271,7 @@ TEST(LoopInfoTest, CanonicalLoop) {
         EXPECT_NE(L, nullptr);
 
         Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
-        EXPECT_NE(Bounds, None);
+        EXPECT_NE(Bounds, std::nullopt);
         ConstantInt *InitialIVValue =
             dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
         EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
@@ -330,7 +330,7 @@ TEST(LoopInfoTest, LoopWithInverseGuardSuccs) {
         EXPECT_NE(L, nullptr);
 
         Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
-        EXPECT_NE(Bounds, None);
+        EXPECT_NE(Bounds, std::nullopt);
         ConstantInt *InitialIVValue =
             dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
         EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
@@ -389,7 +389,7 @@ TEST(LoopInfoTest, LoopWithSwappedGuardCmp) {
         EXPECT_NE(L, nullptr);
 
         Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
-        EXPECT_NE(Bounds, None);
+        EXPECT_NE(Bounds, std::nullopt);
         ConstantInt *InitialIVValue =
             dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
         EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
@@ -448,7 +448,7 @@ TEST(LoopInfoTest, LoopWithInverseLatchSuccs) {
         EXPECT_NE(L, nullptr);
 
         Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
-        EXPECT_NE(Bounds, None);
+        EXPECT_NE(Bounds, std::nullopt);
         ConstantInt *InitialIVValue =
             dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
         EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
@@ -507,7 +507,7 @@ TEST(LoopInfoTest, LoopWithLatchCmpNE) {
         EXPECT_NE(L, nullptr);
 
         Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
-        EXPECT_NE(Bounds, None);
+        EXPECT_NE(Bounds, std::nullopt);
         ConstantInt *InitialIVValue =
             dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
         EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
@@ -567,7 +567,7 @@ TEST(LoopInfoTest, LoopWithGuardCmpSLE) {
         EXPECT_NE(L, nullptr);
 
         Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
-        EXPECT_NE(Bounds, None);
+        EXPECT_NE(Bounds, std::nullopt);
         ConstantInt *InitialIVValue =
             dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
         EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
@@ -626,7 +626,7 @@ TEST(LoopInfoTest, LoopNonConstantStep) {
         EXPECT_NE(L, nullptr);
 
         Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
-        EXPECT_NE(Bounds, None);
+        EXPECT_NE(Bounds, std::nullopt);
         ConstantInt *InitialIVValue =
             dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
         EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
@@ -682,7 +682,7 @@ TEST(LoopInfoTest, LoopUnsignedBounds) {
         EXPECT_NE(L, nullptr);
 
         Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
-        EXPECT_NE(Bounds, None);
+        EXPECT_NE(Bounds, std::nullopt);
         ConstantInt *InitialIVValue =
             dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
         EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
@@ -741,7 +741,7 @@ TEST(LoopInfoTest, DecreasingLoop) {
         EXPECT_NE(L, nullptr);
 
         Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
-        EXPECT_NE(Bounds, None);
+        EXPECT_NE(Bounds, std::nullopt);
         EXPECT_EQ(Bounds->getInitialIVValue().getName(), "ub");
         EXPECT_EQ(Bounds->getStepInst().getName(), "inc");
         ConstantInt *StepValue =
@@ -801,7 +801,7 @@ TEST(LoopInfoTest, CannotFindDirection) {
         EXPECT_NE(L, nullptr);
 
         Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
-        EXPECT_NE(Bounds, None);
+        EXPECT_NE(Bounds, std::nullopt);
         ConstantInt *InitialIVValue =
             dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
         EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
@@ -861,7 +861,7 @@ TEST(LoopInfoTest, ZextIndVar) {
         EXPECT_NE(L, nullptr);
 
         Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
-        EXPECT_NE(Bounds, None);
+        EXPECT_NE(Bounds, std::nullopt);
         ConstantInt *InitialIVValue =
             dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
         EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
@@ -922,7 +922,7 @@ TEST(LoopInfoTest, MultiExitingLoop) {
         EXPECT_NE(L, nullptr);
 
         Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
-        EXPECT_NE(Bounds, None);
+        EXPECT_NE(Bounds, std::nullopt);
         ConstantInt *InitialIVValue =
             dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
         EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
@@ -982,7 +982,7 @@ TEST(LoopInfoTest, MultiExitLoop) {
         EXPECT_NE(L, nullptr);
 
         Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
-        EXPECT_NE(Bounds, None);
+        EXPECT_NE(Bounds, std::nullopt);
         ConstantInt *InitialIVValue =
             dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
         EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
@@ -1034,7 +1034,7 @@ TEST(LoopInfoTest, UnguardedLoop) {
         EXPECT_NE(L, nullptr);
 
         Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
-        EXPECT_NE(Bounds, None);
+        EXPECT_NE(Bounds, std::nullopt);
         ConstantInt *InitialIVValue =
             dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
         EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
@@ -1092,7 +1092,7 @@ TEST(LoopInfoTest, UnguardedLoopWithControlFlow) {
         EXPECT_NE(L, nullptr);
 
         Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
-        EXPECT_NE(Bounds, None);
+        EXPECT_NE(Bounds, std::nullopt);
         ConstantInt *InitialIVValue =
             dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
         EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
@@ -1163,7 +1163,7 @@ TEST(LoopInfoTest, LoopNest) {
         EXPECT_NE(L, nullptr);
 
         Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
-        EXPECT_NE(Bounds, None);
+        EXPECT_NE(Bounds, std::nullopt);
         ConstantInt *InitialIVValue =
             dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
         EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
@@ -1189,7 +1189,7 @@ TEST(LoopInfoTest, LoopNest) {
         EXPECT_NE(L, nullptr);
 
         Optional<Loop::LoopBounds> InnerBounds = L->getBounds(SE);
-        EXPECT_NE(InnerBounds, None);
+        EXPECT_NE(InnerBounds, std::nullopt);
         InitialIVValue =
             dyn_cast<ConstantInt>(&InnerBounds->getInitialIVValue());
         EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
@@ -1256,7 +1256,7 @@ TEST(LoopInfoTest, AuxiliaryIV) {
         EXPECT_NE(L, nullptr);
 
         Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
-        EXPECT_NE(Bounds, None);
+        EXPECT_NE(Bounds, std::nullopt);
         ConstantInt *InitialIVValue =
             dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
         EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());

diff  --git a/llvm/unittests/Analysis/MemoryBuiltinsTest.cpp b/llvm/unittests/Analysis/MemoryBuiltinsTest.cpp
index 7e22686471782..7fa54a6ce23e1 100644
--- a/llvm/unittests/Analysis/MemoryBuiltinsTest.cpp
+++ b/llvm/unittests/Analysis/MemoryBuiltinsTest.cpp
@@ -29,7 +29,8 @@ TEST(AllocSize, AllocationBuiltinsTest) {
       FunctionType::get(Type::getInt8PtrTy(Context), {ArgTy}, false),
       GlobalValue::ExternalLinkage, "F", &M);
 
-  AllocSizeFn->addFnAttr(Attribute::getWithAllocSizeArgs(Context, 1, None));
+  AllocSizeFn->addFnAttr(
+      Attribute::getWithAllocSizeArgs(Context, 1, std::nullopt));
 
   // 100 is arbitrary.
   std::unique_ptr<CallInst> Caller(

diff  --git a/llvm/unittests/Analysis/ScalarEvolutionTest.cpp b/llvm/unittests/Analysis/ScalarEvolutionTest.cpp
index 3e02fc7126e9b..1470822babc75 100644
--- a/llvm/unittests/Analysis/ScalarEvolutionTest.cpp
+++ b/llvm/unittests/Analysis/ScalarEvolutionTest.cpp
@@ -1151,7 +1151,7 @@ TEST_F(ScalarEvolutionsTest, SCEVComputeConstantDifference) {
     auto 
diff  = [&SE](const SCEV *LHS, const SCEV *RHS) -> Optional<int> {
       auto ConstantDiffOrNone = computeConstantDifference(SE, LHS, RHS);
       if (!ConstantDiffOrNone)
-        return None;
+        return std::nullopt;
 
       auto ExtDiff = ConstantDiffOrNone->getSExtValue();
       int Diff = ExtDiff;
@@ -1170,9 +1170,9 @@ TEST_F(ScalarEvolutionsTest, SCEVComputeConstantDifference) {
     EXPECT_EQ(
diff (ScevIV, ScevIVNext), -1);
     EXPECT_EQ(
diff (ScevIVNext, ScevIV), 1);
     EXPECT_EQ(
diff (ScevIVNext, ScevIVNext), 0);
-    EXPECT_EQ(
diff (ScevV0, ScevIV), None);
-    EXPECT_EQ(
diff (ScevIVNext, ScevV3), None);
-    EXPECT_EQ(
diff (ScevYY, ScevV3), None);
+    EXPECT_EQ(
diff (ScevV0, ScevIV), std::nullopt);
+    EXPECT_EQ(
diff (ScevIVNext, ScevV3), std::nullopt);
+    EXPECT_EQ(
diff (ScevYY, ScevV3), std::nullopt);
   });
 }
 

diff  --git a/llvm/unittests/Analysis/ValueTrackingTest.cpp b/llvm/unittests/Analysis/ValueTrackingTest.cpp
index 05e6a099c3a5b..9bf925980ca2e 100644
--- a/llvm/unittests/Analysis/ValueTrackingTest.cpp
+++ b/llvm/unittests/Analysis/ValueTrackingTest.cpp
@@ -1323,7 +1323,7 @@ TEST_F(ValueTrackingTest, IsImpliedConditionAnd) {
   const DataLayout &DL = M->getDataLayout();
   EXPECT_EQ(isImpliedCondition(A, A2, DL), true);
   EXPECT_EQ(isImpliedCondition(A, A3, DL), false);
-  EXPECT_EQ(isImpliedCondition(A, A4, DL), None);
+  EXPECT_EQ(isImpliedCondition(A, A4, DL), std::nullopt);
 }
 
 TEST_F(ValueTrackingTest, IsImpliedConditionAnd2) {
@@ -1342,7 +1342,7 @@ TEST_F(ValueTrackingTest, IsImpliedConditionAnd2) {
   const DataLayout &DL = M->getDataLayout();
   EXPECT_EQ(isImpliedCondition(A, A2, DL), true);
   EXPECT_EQ(isImpliedCondition(A, A3, DL), false);
-  EXPECT_EQ(isImpliedCondition(A, A4, DL), None);
+  EXPECT_EQ(isImpliedCondition(A, A4, DL), std::nullopt);
 }
 
 TEST_F(ValueTrackingTest, IsImpliedConditionAndVec) {
@@ -1373,7 +1373,7 @@ TEST_F(ValueTrackingTest, IsImpliedConditionOr) {
   const DataLayout &DL = M->getDataLayout();
   EXPECT_EQ(isImpliedCondition(A, A2, DL, false), false);
   EXPECT_EQ(isImpliedCondition(A, A3, DL, false), true);
-  EXPECT_EQ(isImpliedCondition(A, A4, DL, false), None);
+  EXPECT_EQ(isImpliedCondition(A, A4, DL, false), std::nullopt);
 }
 
 TEST_F(ValueTrackingTest, IsImpliedConditionOr2) {
@@ -1392,7 +1392,7 @@ TEST_F(ValueTrackingTest, IsImpliedConditionOr2) {
   const DataLayout &DL = M->getDataLayout();
   EXPECT_EQ(isImpliedCondition(A, A2, DL, false), false);
   EXPECT_EQ(isImpliedCondition(A, A3, DL, false), true);
-  EXPECT_EQ(isImpliedCondition(A, A4, DL, false), None);
+  EXPECT_EQ(isImpliedCondition(A, A4, DL, false), std::nullopt);
 }
 
 TEST_F(ComputeKnownBitsTest, KnownNonZeroShift) {

diff  --git a/llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp b/llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp
index 4b4195707407f..67ea38b06ef57 100644
--- a/llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp
+++ b/llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp
@@ -41,8 +41,8 @@ class AArch64SelectionDAGTest : public testing::Test {
 
     TargetOptions Options;
     TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
-        T->createTargetMachine("AArch64", "", "+sve", Options, None, None,
-                               CodeGenOpt::Aggressive)));
+        T->createTargetMachine("AArch64", "", "+sve", Options, std::nullopt,
+                               std::nullopt, CodeGenOpt::Aggressive)));
     if (!TM)
       GTEST_SKIP();
 
@@ -594,7 +594,7 @@ TEST_F(AArch64SelectionDAGTest, ReplaceAllUsesWith) {
   EXPECT_FALSE(DAG->getHeapAllocSite(N2.getNode()));
   EXPECT_FALSE(DAG->getNoMergeSiteInfo(N2.getNode()));
   EXPECT_FALSE(DAG->getPCSections(N2.getNode()));
-  MDNode *MD = MDNode::get(Context, None);
+  MDNode *MD = MDNode::get(Context, std::nullopt);
   DAG->addHeapAllocSite(N2.getNode(), MD);
   DAG->addNoMergeSiteInfo(N2.getNode(), true);
   DAG->addPCSections(N2.getNode(), MD);

diff  --git a/llvm/unittests/CodeGen/AMDGPUMetadataTest.cpp b/llvm/unittests/CodeGen/AMDGPUMetadataTest.cpp
index e14a234cd9ea7..ed2aa552822a0 100644
--- a/llvm/unittests/CodeGen/AMDGPUMetadataTest.cpp
+++ b/llvm/unittests/CodeGen/AMDGPUMetadataTest.cpp
@@ -58,7 +58,7 @@ class AMDGPUSelectionDAGTest : public testing::Test {
     TargetOptions Options;
     TM = std::unique_ptr<LLVMTargetMachine>(
         static_cast<LLVMTargetMachine *>(T->createTargetMachine(
-            "amdgcn--amdpal", "gfx1010", "", Options, None)));
+            "amdgcn--amdpal", "gfx1010", "", Options, std::nullopt)));
     if (!TM)
       GTEST_SKIP();
 

diff  --git a/llvm/unittests/CodeGen/GlobalISel/GISelMITest.cpp b/llvm/unittests/CodeGen/GlobalISel/GISelMITest.cpp
index ef50a0f281f00..602ecc71221b6 100644
--- a/llvm/unittests/CodeGen/GlobalISel/GISelMITest.cpp
+++ b/llvm/unittests/CodeGen/GlobalISel/GISelMITest.cpp
@@ -38,9 +38,9 @@ AArch64GISelMITest::createTargetMachine() const {
     return nullptr;
 
   TargetOptions Options;
-  return std::unique_ptr<LLVMTargetMachine>(
-      static_cast<LLVMTargetMachine *>(T->createTargetMachine(
-          "AArch64", "", "", Options, None, None, CodeGenOpt::Aggressive)));
+  return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+      T->createTargetMachine("AArch64", "", "", Options, std::nullopt,
+                             std::nullopt, CodeGenOpt::Aggressive)));
 }
 
 void AArch64GISelMITest::getTargetTestModuleString(SmallString<512> &S,
@@ -76,10 +76,10 @@ AMDGPUGISelMITest::createTargetMachine() const {
     return nullptr;
 
   TargetOptions Options;
-  return std::unique_ptr<LLVMTargetMachine>(
-      static_cast<LLVMTargetMachine *>(T->createTargetMachine(
-          "amdgcn-amd-amdhsa", "gfx900", "", Options, None, None,
-          CodeGenOpt::Aggressive)));
+  return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+      T->createTargetMachine("amdgcn-amd-amdhsa", "gfx900", "", Options,
+                             std::nullopt, std::nullopt,
+                             CodeGenOpt::Aggressive)));
 }
 
 void AMDGPUGISelMITest::getTargetTestModuleString(

diff  --git a/llvm/unittests/CodeGen/InstrRefLDVTest.cpp b/llvm/unittests/CodeGen/InstrRefLDVTest.cpp
index ccabc2d62dcd5..76464f783d92f 100644
--- a/llvm/unittests/CodeGen/InstrRefLDVTest.cpp
+++ b/llvm/unittests/CodeGen/InstrRefLDVTest.cpp
@@ -79,9 +79,9 @@ class InstrRefLDVTest : public testing::Test {
       GTEST_SKIP();
 
     TargetOptions Options;
-    Machine = std::unique_ptr<TargetMachine>(
-        T->createTargetMachine(Triple::normalize("x86_64--"), "", "", Options,
-                               None, None, CodeGenOpt::Aggressive));
+    Machine = std::unique_ptr<TargetMachine>(T->createTargetMachine(
+        Triple::normalize("x86_64--"), "", "", Options, std::nullopt,
+        std::nullopt, CodeGenOpt::Aggressive));
 
     auto Type = FunctionType::get(Type::getVoidTy(Ctx), false);
     auto F =
@@ -100,7 +100,8 @@ class InstrRefLDVTest : public testing::Test {
     OurFile = DIB.createFile("xyzzy.c", "/cave");
     OurCU =
         DIB.createCompileUnit(dwarf::DW_LANG_C99, OurFile, "nou", false, "", 0);
-    auto OurSubT = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
+    auto OurSubT =
+        DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
     OurFunc =
         DIB.createFunction(OurCU, "bees", "", OurFile, 1, OurSubT, 1,
                            DINode::FlagZero, DISubprogram::SPFlagDefinition);
@@ -1814,7 +1815,7 @@ TEST_F(InstrRefLDVTest, pickVPHILocDiamond) {
   DbgOpID RaxPHIInBlk3ID = addValueDbgOp(RaxPHIInBlk3);
   DbgOpID ConstZeroID = addConstDbgOp(MachineOperand::CreateImm(0));
 
-  DebugVariable Var(FuncVariable, None, nullptr);
+  DebugVariable Var(FuncVariable, std::nullopt, nullptr);
   DbgValueProperties EmptyProps(EmptyExpr, false, false);
   DIExpression *TwoOpExpr =
       DIExpression::get(Ctx, {dwarf::DW_OP_LLVM_arg, 0, dwarf::DW_OP_LLVM_arg,
@@ -2008,7 +2009,7 @@ TEST_F(InstrRefLDVTest, pickVPHILocLoops) {
   DbgOpID RspPHIInBlk1ID = addValueDbgOp(RspPHIInBlk1);
   DbgOpID RaxPHIInBlk1ID = addValueDbgOp(RaxPHIInBlk1);
 
-  DebugVariable Var(FuncVariable, None, nullptr);
+  DebugVariable Var(FuncVariable, std::nullopt, nullptr);
   DbgValueProperties EmptyProps(EmptyExpr, false, false);
   DIExpression *TwoOpExpr =
       DIExpression::get(Ctx, {dwarf::DW_OP_LLVM_arg, 0, dwarf::DW_OP_LLVM_arg,
@@ -2143,7 +2144,7 @@ TEST_F(InstrRefLDVTest, pickVPHILocBadlyNestedLoops) {
   addValueDbgOp(RaxPHIInBlk1);
   DbgOpID RbxPHIInBlk1ID = addValueDbgOp(RbxPHIInBlk1);
 
-  DebugVariable Var(FuncVariable, None, nullptr);
+  DebugVariable Var(FuncVariable, std::nullopt, nullptr);
   DbgValueProperties EmptyProps(EmptyExpr, false, false);
   SmallVector<DbgValue, 32> VLiveOuts;
   VLiveOuts.resize(5, DbgValue(EmptyProps, DbgValue::Undef));
@@ -2277,7 +2278,7 @@ TEST_F(InstrRefLDVTest, vlocJoinDiamond) {
   DbgOpID LiveInRspID = DbgOpID(false, 0);
   DbgOpID LiveInRaxID = DbgOpID(false, 1);
 
-  DebugVariable Var(FuncVariable, None, nullptr);
+  DebugVariable Var(FuncVariable, std::nullopt, nullptr);
   DbgValueProperties EmptyProps(EmptyExpr, false, false);
   SmallVector<DbgValue, 32> VLiveOuts;
   VLiveOuts.resize(4, DbgValue(EmptyProps, DbgValue::Undef));
@@ -2461,7 +2462,7 @@ TEST_F(InstrRefLDVTest, vlocJoinLoops) {
   DbgOpID LiveInRspID = DbgOpID(false, 0);
   DbgOpID LiveInRaxID = DbgOpID(false, 1);
 
-  DebugVariable Var(FuncVariable, None, nullptr);
+  DebugVariable Var(FuncVariable, std::nullopt, nullptr);
   DbgValueProperties EmptyProps(EmptyExpr, false, false);
   SmallVector<DbgValue, 32> VLiveOuts;
   VLiveOuts.resize(3, DbgValue(EmptyProps, DbgValue::Undef));
@@ -2562,7 +2563,7 @@ TEST_F(InstrRefLDVTest, vlocJoinBadlyNestedLoops) {
   DbgOpID LiveInRaxID = DbgOpID(false, 1);
   DbgOpID LiveInRbxID = DbgOpID(false, 2);
 
-  DebugVariable Var(FuncVariable, None, nullptr);
+  DebugVariable Var(FuncVariable, std::nullopt, nullptr);
   DbgValueProperties EmptyProps(EmptyExpr, false, false);
   SmallVector<DbgValue, 32> VLiveOuts;
   VLiveOuts.resize(5, DbgValue(EmptyProps, DbgValue::Undef));
@@ -2648,7 +2649,7 @@ TEST_F(InstrRefLDVTest, VLocSingleBlock) {
   DbgOpID LiveInRspID = addValueDbgOp(LiveInRsp);
   MInLocs[0][0] = MOutLocs[0][0] = LiveInRsp;
 
-  DebugVariable Var(FuncVariable, None, nullptr);
+  DebugVariable Var(FuncVariable, std::nullopt, nullptr);
   DbgValueProperties EmptyProps(EmptyExpr, false, false);
 
   SmallSet<DebugVariable, 4> AllVars;
@@ -2711,7 +2712,7 @@ TEST_F(InstrRefLDVTest, VLocDiamondBlocks) {
   initValueArray(MInLocs, 4, 2);
   initValueArray(MOutLocs, 4, 2);
 
-  DebugVariable Var(FuncVariable, None, nullptr);
+  DebugVariable Var(FuncVariable, std::nullopt, nullptr);
   DbgValueProperties EmptyProps(EmptyExpr, false, false);
 
   SmallSet<DebugVariable, 4> AllVars;
@@ -2933,7 +2934,7 @@ TEST_F(InstrRefLDVTest, VLocSimpleLoop) {
   initValueArray(MInLocs, 3, 2);
   initValueArray(MOutLocs, 3, 2);
 
-  DebugVariable Var(FuncVariable, None, nullptr);
+  DebugVariable Var(FuncVariable, std::nullopt, nullptr);
   DbgValueProperties EmptyProps(EmptyExpr, false, false);
   DIExpression *TwoOpExpr =
       DIExpression::get(Ctx, {dwarf::DW_OP_LLVM_arg, 0, dwarf::DW_OP_LLVM_arg,
@@ -3212,7 +3213,7 @@ TEST_F(InstrRefLDVTest, VLocNestedLoop) {
   initValueArray(MInLocs, 5, 2);
   initValueArray(MOutLocs, 5, 2);
 
-  DebugVariable Var(FuncVariable, None, nullptr);
+  DebugVariable Var(FuncVariable, std::nullopt, nullptr);
   DbgValueProperties EmptyProps(EmptyExpr, false, false);
 
   SmallSet<DebugVariable, 4> AllVars;

diff  --git a/llvm/unittests/CodeGen/LexicalScopesTest.cpp b/llvm/unittests/CodeGen/LexicalScopesTest.cpp
index e1835b433f86a..a68db50808628 100644
--- a/llvm/unittests/CodeGen/LexicalScopesTest.cpp
+++ b/llvm/unittests/CodeGen/LexicalScopesTest.cpp
@@ -102,7 +102,8 @@ class LexicalScopesTest : public testing::Test {
     OurFile = DIB.createFile("xyzzy.c", "/cave");
     OurCU =
         DIB.createCompileUnit(dwarf::DW_LANG_C99, OurFile, "nou", false, "", 0);
-    auto OurSubT = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
+    auto OurSubT =
+        DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
     OurFunc =
         DIB.createFunction(OurCU, "bees", "", OurFile, 1, OurSubT, 1,
                            DINode::FlagZero, DISubprogram::SPFlagDefinition);

diff  --git a/llvm/unittests/CodeGen/MFCommon.inc b/llvm/unittests/CodeGen/MFCommon.inc
index a884f9ebeb54a..7239663c6b16d 100644
--- a/llvm/unittests/CodeGen/MFCommon.inc
+++ b/llvm/unittests/CodeGen/MFCommon.inc
@@ -32,8 +32,8 @@ public:
   getCalleeSavedRegs(const MachineFunction *MF) const override {
     return nullptr;
   }
-  ArrayRef<const uint32_t *> getRegMasks() const override { return None; }
-  ArrayRef<const char *> getRegMaskNames() const override { return None; }
+  ArrayRef<const uint32_t *> getRegMasks() const override { return std::nullopt; }
+  ArrayRef<const char *> getRegMaskNames() const override { return std::nullopt; }
   BitVector getReservedRegs(const MachineFunction &MF) const override {
     return BitVector();
   }

diff  --git a/llvm/unittests/CodeGen/MachineInstrTest.cpp b/llvm/unittests/CodeGen/MachineInstrTest.cpp
index 19e46075dbae4..9313bb699d4c4 100644
--- a/llvm/unittests/CodeGen/MachineInstrTest.cpp
+++ b/llvm/unittests/CodeGen/MachineInstrTest.cpp
@@ -271,8 +271,8 @@ TEST(MachineInstrExtraInfo, AddExtraInfo) {
   MMOs.push_back(MMO);
   MCSymbol *Sym1 = MC->createTempSymbol("pre_label", false);
   MCSymbol *Sym2 = MC->createTempSymbol("post_label", false);
-  MDNode *HAM = MDNode::getDistinct(Ctx, None);
-  MDNode *PCS = MDNode::getDistinct(Ctx, None);
+  MDNode *HAM = MDNode::getDistinct(Ctx, std::nullopt);
+  MDNode *PCS = MDNode::getDistinct(Ctx, std::nullopt);
 
   ASSERT_TRUE(MI->memoperands_empty());
   ASSERT_FALSE(MI->getPreInstrSymbol());
@@ -331,8 +331,8 @@ TEST(MachineInstrExtraInfo, ChangeExtraInfo) {
   MMOs.push_back(MMO);
   MCSymbol *Sym1 = MC->createTempSymbol("pre_label", false);
   MCSymbol *Sym2 = MC->createTempSymbol("post_label", false);
-  MDNode *HAM = MDNode::getDistinct(Ctx, None);
-  MDNode *PCS = MDNode::getDistinct(Ctx, None);
+  MDNode *HAM = MDNode::getDistinct(Ctx, std::nullopt);
+  MDNode *PCS = MDNode::getDistinct(Ctx, std::nullopt);
 
   MI->setMemRefs(*MF, MMOs);
   MI->setPreInstrSymbol(*MF, Sym1);
@@ -373,8 +373,8 @@ TEST(MachineInstrExtraInfo, RemoveExtraInfo) {
   MMOs.push_back(MMO);
   MCSymbol *Sym1 = MC->createTempSymbol("pre_label", false);
   MCSymbol *Sym2 = MC->createTempSymbol("post_label", false);
-  MDNode *HAM = MDNode::getDistinct(Ctx, None);
-  MDNode *PCS = MDNode::getDistinct(Ctx, None);
+  MDNode *HAM = MDNode::getDistinct(Ctx, std::nullopt);
+  MDNode *PCS = MDNode::getDistinct(Ctx, std::nullopt);
 
   MI->setMemRefs(*MF, MMOs);
   MI->setPreInstrSymbol(*MF, Sym1);
@@ -451,8 +451,8 @@ MATCHER_P(HasMIMetadata, MIMD, "") {
 
 TEST(MachineInstrBuilder, BuildMI) {
   LLVMContext Ctx;
-  MDNode *PCS = MDNode::getDistinct(Ctx, None);
-  MDNode *DI = MDNode::getDistinct(Ctx, None);
+  MDNode *PCS = MDNode::getDistinct(Ctx, std::nullopt);
+  MDNode *DI = MDNode::getDistinct(Ctx, std::nullopt);
   DebugLoc DL(DI);
   MIMetadata MIMD(DL, PCS);
   EXPECT_EQ(MIMD.getDL(), DL);

diff  --git a/llvm/unittests/CodeGen/PassManagerTest.cpp b/llvm/unittests/CodeGen/PassManagerTest.cpp
index 436d42e3ba6ae..33f6b2fa79b86 100644
--- a/llvm/unittests/CodeGen/PassManagerTest.cpp
+++ b/llvm/unittests/CodeGen/PassManagerTest.cpp
@@ -197,8 +197,8 @@ class PassManagerTest : public ::testing::Test {
       return;
 
     TargetOptions Options;
-    TM.reset(TheTarget->createTargetMachine(TripleName, "", "",
-                                            Options, None));
+    TM.reset(TheTarget->createTargetMachine(TripleName, "", "", Options,
+                                            std::nullopt));
   }
 };
 

diff  --git a/llvm/unittests/CodeGen/SelectionDAGAddressAnalysisTest.cpp b/llvm/unittests/CodeGen/SelectionDAGAddressAnalysisTest.cpp
index cebaeaa460b44..348389c8131a1 100644
--- a/llvm/unittests/CodeGen/SelectionDAGAddressAnalysisTest.cpp
+++ b/llvm/unittests/CodeGen/SelectionDAGAddressAnalysisTest.cpp
@@ -47,8 +47,8 @@ class SelectionDAGAddressAnalysisTest : public testing::Test {
 
     TargetOptions Options;
     TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
-        T->createTargetMachine("AArch64", "", "+sve", Options, None, None,
-                               CodeGenOpt::Aggressive)));
+        T->createTargetMachine("AArch64", "", "+sve", Options, std::nullopt,
+                               std::nullopt, CodeGenOpt::Aggressive)));
     if (!TM)
       GTEST_SKIP();
 

diff  --git a/llvm/unittests/CodeGen/TargetOptionsTest.cpp b/llvm/unittests/CodeGen/TargetOptionsTest.cpp
index b3d5e7522d02f..e9d8d9a653c2e 100644
--- a/llvm/unittests/CodeGen/TargetOptionsTest.cpp
+++ b/llvm/unittests/CodeGen/TargetOptionsTest.cpp
@@ -38,8 +38,9 @@ std::unique_ptr<TargetMachine> createTargetMachine(bool EnableIPRA) {
 
   TargetOptions Options;
   Options.EnableIPRA = EnableIPRA;
-  return std::unique_ptr<TargetMachine>(T->createTargetMachine(
-      "X86", "", "", Options, None, None, CodeGenOpt::Aggressive));
+  return std::unique_ptr<TargetMachine>(
+      T->createTargetMachine("X86", "", "", Options, std::nullopt, std::nullopt,
+                             CodeGenOpt::Aggressive));
 }
 
 typedef std::function<void(bool)> TargetOptionsTest;

diff  --git a/llvm/unittests/CodeGen/TestAsmPrinter.cpp b/llvm/unittests/CodeGen/TestAsmPrinter.cpp
index 63019e871ac09..b651fcfcb2dfd 100644
--- a/llvm/unittests/CodeGen/TestAsmPrinter.cpp
+++ b/llvm/unittests/CodeGen/TestAsmPrinter.cpp
@@ -50,7 +50,7 @@ llvm::Error TestAsmPrinter::init(const Target *TheTarget, StringRef TripleName,
                                  uint16_t DwarfVersion,
                                  dwarf::DwarfFormat DwarfFormat) {
   TM.reset(TheTarget->createTargetMachine(TripleName, "", "", TargetOptions(),
-                                          None));
+                                          std::nullopt));
   if (!TM)
     return make_error<StringError>("no target machine for target " + TripleName,
                                    inconvertibleErrorCode());

diff  --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugFrameTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugFrameTest.cpp
index dbc54e7bdb8ef..40eecfb36e7db 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugFrameTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugFrameTest.cpp
@@ -32,8 +32,8 @@ dwarf::CIE createCIE(bool IsDWARF64, uint64_t Offset, uint64_t Length) {
                     /*AugmentationData=*/StringRef(),
                     /*FDEPointerEncoding=*/dwarf::DW_EH_PE_absptr,
                     /*LSDAPointerEncoding=*/dwarf::DW_EH_PE_omit,
-                    /*Personality=*/None,
-                    /*PersonalityEnc=*/None,
+                    /*Personality=*/std::nullopt,
+                    /*PersonalityEnc=*/std::nullopt,
                     /*Arch=*/Triple::x86_64);
 }
 
@@ -98,7 +98,7 @@ TEST(DWARFDebugFrame, DumpDWARF64FDE) {
                      /*InitialLocation=*/0x5555abcdabcd,
                      /*AddressRange=*/0x111111111111,
                      /*Cie=*/&TestCIE,
-                     /*LSDAAddress=*/None,
+                     /*LSDAAddress=*/std::nullopt,
                      /*Arch=*/Triple::x86_64);
   expectDumpResult(TestFDE, /*IsEH=*/false,
                    "3333abcdabcd 00004444abcdabcd 00001111abcdabcd FDE "
@@ -116,7 +116,7 @@ TEST(DWARFDebugFrame, DumpEH64FDE) {
                      /*InitialLocation=*/0x4444abcdabcd,
                      /*AddressRange=*/0x111111111111,
                      /*Cie=*/&TestCIE,
-                     /*LSDAAddress=*/None,
+                     /*LSDAAddress=*/std::nullopt,
                      /*Arch=*/Triple::x86_64);
   expectDumpResult(TestFDE, /*IsEH=*/true,
                    "1111abcdabcd 00002222abcdabcd 0033abcd FDE "
@@ -124,7 +124,7 @@ TEST(DWARFDebugFrame, DumpEH64FDE) {
 }
 
 static Error parseCFI(dwarf::CIE &C, ArrayRef<uint8_t> Instructions,
-                      Optional<uint64_t> Size = None) {
+                      Optional<uint64_t> Size = std::nullopt) {
   DWARFDataExtractor Data(Instructions, /*IsLittleEndian=*/true,
                           /*AddressSize=*/8);
   uint64_t Offset = 0;
@@ -478,7 +478,7 @@ TEST(DWARFDebugFrame, UnwindTableEmptyRows) {
                      /*InitialLocation=*/0x1000,
                      /*AddressRange=*/0x1000,
                      /*Cie=*/&TestCIE,
-                     /*LSDAAddress=*/None,
+                     /*LSDAAddress=*/std::nullopt,
                      /*Arch=*/Triple::x86_64);
 
   // Having an empty instructions list is fine.
@@ -517,7 +517,7 @@ TEST(DWARFDebugFrame, UnwindTableEmptyRows_NOPs) {
                      /*InitialLocation=*/0x1000,
                      /*AddressRange=*/0x1000,
                      /*Cie=*/&TestCIE,
-                     /*LSDAAddress=*/None,
+                     /*LSDAAddress=*/std::nullopt,
                      /*Arch=*/Triple::x86_64);
 
   // Make an FDE that has only DW_CFA_nop instructions.
@@ -543,7 +543,7 @@ TEST(DWARFDebugFrame, UnwindTableErrorNonAscendingFDERows) {
                      /*InitialLocation=*/0x1000,
                      /*AddressRange=*/0x1000,
                      /*Cie=*/&TestCIE,
-                     /*LSDAAddress=*/None,
+                     /*LSDAAddress=*/std::nullopt,
                      /*Arch=*/Triple::x86_64);
 
   // Make a CIE that has a valid CFA definition.
@@ -585,7 +585,7 @@ TEST(DWARFDebugFrame, UnwindTableError_DW_CFA_restore_state) {
                      /*InitialLocation=*/0x1000,
                      /*AddressRange=*/0x1000,
                      /*Cie=*/&TestCIE,
-                     /*LSDAAddress=*/None,
+                     /*LSDAAddress=*/std::nullopt,
                      /*Arch=*/Triple::x86_64);
 
   // Make a CIE that has a valid CFA definition.
@@ -620,7 +620,7 @@ TEST(DWARFDebugFrame, UnwindTableError_DW_CFA_GNU_window_save) {
                      /*InitialLocation=*/0x1000,
                      /*AddressRange=*/0x1000,
                      /*Cie=*/&TestCIE,
-                     /*LSDAAddress=*/None,
+                     /*LSDAAddress=*/std::nullopt,
                      /*Arch=*/Triple::x86_64);
 
   // Make a CIE that has a valid CFA definition.
@@ -656,7 +656,7 @@ TEST(DWARFDebugFrame, UnwindTableError_DW_CFA_def_cfa_offset) {
                      /*InitialLocation=*/0x1000,
                      /*AddressRange=*/0x1000,
                      /*Cie=*/&TestCIE,
-                     /*LSDAAddress=*/None,
+                     /*LSDAAddress=*/std::nullopt,
                      /*Arch=*/Triple::x86_64);
 
   // Make a CIE that has an invalid CFA definition. We do this so we can try
@@ -691,7 +691,7 @@ TEST(DWARFDebugFrame, UnwindTableDefCFAOffsetSFCFAError) {
                      /*InitialLocation=*/0x1000,
                      /*AddressRange=*/0x1000,
                      /*Cie=*/&TestCIE,
-                     /*LSDAAddress=*/None,
+                     /*LSDAAddress=*/std::nullopt,
                      /*Arch=*/Triple::x86_64);
 
   // Make a CIE that has an invalid CFA definition. We do this so we can try
@@ -726,7 +726,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_def_cfa_register) {
                      /*InitialLocation=*/0x1000,
                      /*AddressRange=*/0x1000,
                      /*Cie=*/&TestCIE,
-                     /*LSDAAddress=*/None,
+                     /*LSDAAddress=*/std::nullopt,
                      /*Arch=*/Triple::x86_64);
 
   // Make a CIE that has only defines the CFA register with no offset. Some
@@ -766,7 +766,7 @@ TEST(DWARFDebugFrame, UnwindTableRowPushingOpcodes) {
                      /*InitialLocation=*/0x1000,
                      /*AddressRange=*/0x1000,
                      /*Cie=*/&TestCIE,
-                     /*LSDAAddress=*/None,
+                     /*LSDAAddress=*/std::nullopt,
                      /*Arch=*/Triple::x86_64);
 
   // Make a CIE that has a valid CFA definition and a single register unwind
@@ -854,7 +854,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_restore) {
                      /*InitialLocation=*/0x1000,
                      /*AddressRange=*/0x1000,
                      /*Cie=*/&TestCIE,
-                     /*LSDAAddress=*/None,
+                     /*LSDAAddress=*/std::nullopt,
                      /*Arch=*/Triple::x86_64);
 
   // Make a CIE that has a valid CFA definition and a single register unwind
@@ -917,7 +917,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_restore_extended) {
                      /*InitialLocation=*/0x1000,
                      /*AddressRange=*/0x1000,
                      /*Cie=*/&TestCIE,
-                     /*LSDAAddress=*/None,
+                     /*LSDAAddress=*/std::nullopt,
                      /*Arch=*/Triple::x86_64);
 
   // Make a CIE that has a valid CFA definition and a single register unwind
@@ -981,7 +981,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_offset) {
                      /*InitialLocation=*/0x1000,
                      /*AddressRange=*/0x1000,
                      /*Cie=*/&TestCIE,
-                     /*LSDAAddress=*/None,
+                     /*LSDAAddress=*/std::nullopt,
                      /*Arch=*/Triple::x86_64);
 
   // Make a CIE that has a valid CFA definition and a single register unwind
@@ -1037,7 +1037,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_val_offset) {
                      /*InitialLocation=*/0x1000,
                      /*AddressRange=*/0x1000,
                      /*Cie=*/&TestCIE,
-                     /*LSDAAddress=*/None,
+                     /*LSDAAddress=*/std::nullopt,
                      /*Arch=*/Triple::x86_64);
 
   // Make a CIE that has a valid CFA definition and a single register unwind
@@ -1088,7 +1088,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_nop) {
                      /*InitialLocation=*/0x1000,
                      /*AddressRange=*/0x1000,
                      /*Cie=*/&TestCIE,
-                     /*LSDAAddress=*/None,
+                     /*LSDAAddress=*/std::nullopt,
                      /*Arch=*/Triple::x86_64);
 
   // Make a CIE that has a valid CFA definition and a single register unwind
@@ -1134,7 +1134,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_remember_state) {
                      /*InitialLocation=*/0x1000,
                      /*AddressRange=*/0x1000,
                      /*Cie=*/&TestCIE,
-                     /*LSDAAddress=*/None,
+                     /*LSDAAddress=*/std::nullopt,
                      /*Arch=*/Triple::x86_64);
 
   // Make a CIE that has a valid CFA definition and a single register unwind
@@ -1231,7 +1231,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_undefined) {
                      /*InitialLocation=*/0x1000,
                      /*AddressRange=*/0x1000,
                      /*Cie=*/&TestCIE,
-                     /*LSDAAddress=*/None,
+                     /*LSDAAddress=*/std::nullopt,
                      /*Arch=*/Triple::x86_64);
 
   // Make a CIE that has a valid CFA definition and a single register unwind
@@ -1276,7 +1276,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_same_value) {
                      /*InitialLocation=*/0x1000,
                      /*AddressRange=*/0x1000,
                      /*Cie=*/&TestCIE,
-                     /*LSDAAddress=*/None,
+                     /*LSDAAddress=*/std::nullopt,
                      /*Arch=*/Triple::x86_64);
 
   // Make a CIE that has a valid CFA definition and a single register unwind
@@ -1320,7 +1320,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_register) {
                      /*InitialLocation=*/0x1000,
                      /*AddressRange=*/0x1000,
                      /*Cie=*/&TestCIE,
-                     /*LSDAAddress=*/None,
+                     /*LSDAAddress=*/std::nullopt,
                      /*Arch=*/Triple::x86_64);
 
   // Make a CIE that has a valid CFA definition and a single register unwind
@@ -1366,7 +1366,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_expression) {
                      /*InitialLocation=*/0x1000,
                      /*AddressRange=*/0x1000,
                      /*Cie=*/&TestCIE,
-                     /*LSDAAddress=*/None,
+                     /*LSDAAddress=*/std::nullopt,
                      /*Arch=*/Triple::x86_64);
 
   // Make a CIE that has a valid CFA definition and a single register unwind
@@ -1418,7 +1418,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_val_expression) {
                      /*InitialLocation=*/0x1000,
                      /*AddressRange=*/0x1000,
                      /*Cie=*/&TestCIE,
-                     /*LSDAAddress=*/None,
+                     /*LSDAAddress=*/std::nullopt,
                      /*Arch=*/Triple::x86_64);
 
   // Make a CIE that has a valid CFA definition and a single register unwind
@@ -1471,7 +1471,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_def_cfa) {
                      /*InitialLocation=*/0x1000,
                      /*AddressRange=*/0x1000,
                      /*Cie=*/&TestCIE,
-                     /*LSDAAddress=*/None,
+                     /*LSDAAddress=*/std::nullopt,
                      /*Arch=*/Triple::x86_64);
 
   // Make a CIE that has a valid CFA definition and a single register unwind
@@ -1567,7 +1567,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_LLVM_def_aspace_cfa) {
                      /*InitialLocation=*/0x1000,
                      /*AddressRange=*/0x1000,
                      /*Cie=*/&TestCIE,
-                     /*LSDAAddress=*/None,
+                     /*LSDAAddress=*/std::nullopt,
                      /*Arch=*/Triple::x86_64);
 
   // Make a CIE that has a valid CFA definition and a single register unwind

diff  --git a/llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
index 2754ba0afdf0c..7781061bcb404 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
@@ -80,9 +80,9 @@ TEST(DWARFDie, getLocations) {
                        HasValue(testing::ElementsAre(DWARFLocationExpression{
                            DWARFAddressRange{1, 3}, {}})));
 
-  EXPECT_THAT_EXPECTED(
-      Die.getLocations(DW_AT_data_member_location),
-      HasValue(testing::ElementsAre(DWARFLocationExpression{None, {0x47}})));
+  EXPECT_THAT_EXPECTED(Die.getLocations(DW_AT_data_member_location),
+                       HasValue(testing::ElementsAre(
+                           DWARFLocationExpression{std::nullopt, {0x47}})));
 
   EXPECT_THAT_EXPECTED(
       Die.getLocations(DW_AT_vtable_elem_location),

diff  --git a/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp
index 88facd7e20c22..d14b303fde868 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp
@@ -159,7 +159,7 @@ void DWARFExpressionCopyBytesTest::parseCFIsAndCheckExpression(
         return Instr;
       }
     }
-    return None;
+    return std::nullopt;
   };
 
   std::unique_ptr<DWARFContext> Ctx = DWARFContext::create(E);

diff  --git a/llvm/unittests/DebugInfo/DWARF/DWARFLocationExpressionTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFLocationExpressionTest.cpp
index fb1dc3bd280a9..5f253f647289c 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFLocationExpressionTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFLocationExpressionTest.cpp
@@ -14,8 +14,8 @@ using namespace llvm;
 using object::SectionedAddress;
 
 TEST(DWARFLocationExpression, Equality) {
-  EXPECT_EQ((DWARFLocationExpression{None, {}}),
-            (DWARFLocationExpression{None, {}}));
+  EXPECT_EQ((DWARFLocationExpression{std::nullopt, {}}),
+            (DWARFLocationExpression{std::nullopt, {}}));
   EXPECT_NE((DWARFLocationExpression{DWARFAddressRange{1, 47}, {}}),
             (DWARFLocationExpression{DWARFAddressRange{1, 48}, {}}));
   EXPECT_NE((DWARFLocationExpression{DWARFAddressRange{1, 47}, {}}),
@@ -23,7 +23,8 @@ TEST(DWARFLocationExpression, Equality) {
 }
 
 TEST(DWARFLocationExpression, StreamingOperator) {
-  EXPECT_EQ("None: 1, 2", to_string(DWARFLocationExpression{None, {1, 2}}));
+  EXPECT_EQ("None: 1, 2",
+            to_string(DWARFLocationExpression{std::nullopt, {1, 2}}));
   EXPECT_EQ(
       "[0x0000000000000042, 0x0000000000000047): 1",
       to_string(DWARFLocationExpression{DWARFAddressRange{0x42, 0x47}, {1}}));

diff  --git a/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp b/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
index cfc6301149de8..590c0b92ec51f 100644
--- a/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
@@ -454,7 +454,7 @@ llvm::Error dwarfgen::Generator::init(Triple TheTriple, uint16_t V) {
                                    inconvertibleErrorCode());
 
   TM.reset(TheTarget->createTargetMachine(TripleName, "", "", TargetOptions(),
-                                          None));
+                                          std::nullopt));
   if (!TM)
     return make_error<StringError>("no target machine for target " + TripleName,
                                    inconvertibleErrorCode());

diff  --git a/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp b/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
index bfe66f0cef1c2..366c6a5ff74db 100644
--- a/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
+++ b/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
@@ -980,7 +980,7 @@ TEST(GSYMTest, TestGsymCreatorEncodeErrors) {
   // Verify errors are propagated when we try to encoding an invalid inline
   // info.
   GC.forEachFunctionInfo([](FunctionInfo &FI) -> bool {
-    FI.OptLineTable = llvm::None;
+    FI.OptLineTable = std::nullopt;
     FI.Inline = InlineInfo(); // Invalid InlineInfo.
     return false; // Stop iterating
   });

diff  --git a/llvm/unittests/DebugInfo/Symbolizer/MarkupTest.cpp b/llvm/unittests/DebugInfo/Symbolizer/MarkupTest.cpp
index fc95840a57472..707969f97a15b 100644
--- a/llvm/unittests/DebugInfo/Symbolizer/MarkupTest.cpp
+++ b/llvm/unittests/DebugInfo/Symbolizer/MarkupTest.cpp
@@ -30,67 +30,69 @@ Matcher<MarkupNode> isNode(StringRef Text, StringRef Tag = "",
                Field("Fields", &MarkupNode::Fields, Fields));
 }
 
-TEST(SymbolizerMarkup, NoLines) { EXPECT_EQ(MarkupParser{}.nextNode(), None); }
+TEST(SymbolizerMarkup, NoLines) {
+  EXPECT_EQ(MarkupParser{}.nextNode(), std::nullopt);
+}
 
 TEST(SymbolizerMarkup, LinesWithoutMarkup) {
   MarkupParser Parser;
 
   Parser.parseLine("text");
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("text")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("discarded");
   Parser.parseLine("kept");
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("kept")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("text\n");
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("text\n")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("text\r\n");
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("text\r\n")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("{{{");
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("{{{}}");
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{}}")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("{{}}}");
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{}}}")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("{{{}}}");
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{}}}")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("{{{:field}}}");
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{:field}}}")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("{{{tag:");
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{tag:")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("{{{tag:field}}");
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{tag:field}}")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("a\033[2mb");
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("a\033[2mb")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("a\033[38mb");
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("a\033[38mb")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("a\033[4mb");
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("a\033[4mb")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 }
 
 TEST(SymbolizerMarkup, LinesWithMarkup) {
@@ -98,30 +100,30 @@ TEST(SymbolizerMarkup, LinesWithMarkup) {
 
   Parser.parseLine("{{{tag}}}");
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{tag}}}", "tag")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("{{{tag:f1:f2:f3}}}");
   EXPECT_THAT(Parser.nextNode(),
               testing::Optional(isNode("{{{tag:f1:f2:f3}}}", "tag",
                                        ElementsAre("f1", "f2", "f3"))));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("{{{tag:}}}");
   EXPECT_THAT(Parser.nextNode(),
               testing::Optional(isNode("{{{tag:}}}", "tag", ElementsAre(""))));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("{{{tag:}}");
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{tag:}}")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("{{{t2g}}}");
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{t2g}}}", "t2g")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("{{{tAg}}}");
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{tAg}}}", "tAg")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("a{{{b}}}c{{{d}}}e");
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("a")));
@@ -129,12 +131,12 @@ TEST(SymbolizerMarkup, LinesWithMarkup) {
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("c")));
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{d}}}", "d")));
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("e")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("{{{}}}{{{tag}}}");
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{}}}")));
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{tag}}}", "tag")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("\033[0mA\033[1mB\033[30mC\033[37m");
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("\033[0m")));
@@ -144,13 +146,13 @@ TEST(SymbolizerMarkup, LinesWithMarkup) {
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("\033[30m")));
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("C")));
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("\033[37m")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("{{{tag:\033[0m}}}");
   EXPECT_THAT(Parser.nextNode(),
               testing::Optional(
                   isNode("{{{tag:\033[0m}}}", "tag", ElementsAre("\033[0m"))));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 }
 
 TEST(SymbolizerMarkup, MultilineElements) {
@@ -158,64 +160,64 @@ TEST(SymbolizerMarkup, MultilineElements) {
 
   Parser.parseLine("{{{tag:");
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{tag:")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("{{{first:");
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
   Parser.parseLine("}}}{{{second:");
   EXPECT_THAT(
       Parser.nextNode(),
       testing::Optional(isNode("{{{first:}}}", "first", ElementsAre(""))));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
   Parser.parseLine("}}}");
   EXPECT_THAT(
       Parser.nextNode(),
       testing::Optional(isNode("{{{second:}}}", "second", ElementsAre(""))));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("{{{before{{{first:");
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{before")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
   Parser.parseLine("line");
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
   Parser.parseLine("}}}after");
   EXPECT_THAT(Parser.nextNode(),
               testing::Optional(
                   isNode("{{{first:line}}}", "first", ElementsAre("line"))));
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("after")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("{{{first:");
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
   Parser.flush();
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{first:")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("{{{first:\n");
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
   Parser.parseLine("}}}\n");
   EXPECT_THAT(
       Parser.nextNode(),
       testing::Optional(isNode("{{{first:\n}}}", "first", ElementsAre("\n"))));
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("\n")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("{{{first:\r\n");
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
   Parser.parseLine("}}}\r\n");
   EXPECT_THAT(Parser.nextNode(),
               testing::Optional(
                   isNode("{{{first:\r\n}}}", "first", ElementsAre("\r\n"))));
   EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("\r\n")));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 
   Parser.parseLine("{{{first:");
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
   Parser.parseLine("\033[0m}}}");
   EXPECT_THAT(Parser.nextNode(),
               testing::Optional(isNode("{{{first:\033[0m}}}", "first",
                                        ElementsAre("\033[0m"))));
-  EXPECT_THAT(Parser.nextNode(), None);
+  EXPECT_THAT(Parser.nextNode(), std::nullopt);
 }
 
 } // namespace

diff  --git a/llvm/unittests/ExecutionEngine/JITLink/LinkGraphTests.cpp b/llvm/unittests/ExecutionEngine/JITLink/LinkGraphTests.cpp
index c16757d7c55af..1eec27f229d04 100644
--- a/llvm/unittests/ExecutionEngine/JITLink/LinkGraphTests.cpp
+++ b/llvm/unittests/ExecutionEngine/JITLink/LinkGraphTests.cpp
@@ -438,7 +438,7 @@ TEST(LinkGraphTest, TransferDefinedSymbol) {
   EXPECT_EQ(S1.getSize(), 64U) << "Size was not updated";
 
   // Transfer with non-zero offset, implicit truncation.
-  G.transferDefinedSymbol(S1, B3, 16, None);
+  G.transferDefinedSymbol(S1, B3, 16, std::nullopt);
 
   EXPECT_EQ(&S1.getBlock(), &B3) << "Block was not updated";
   EXPECT_EQ(S1.getOffset(), 16U) << "Offset was not updated";

diff  --git a/llvm/unittests/ExecutionEngine/Orc/JITTargetMachineBuilderTest.cpp b/llvm/unittests/ExecutionEngine/Orc/JITTargetMachineBuilderTest.cpp
index 1f3626e8af131..40993b618eb5a 100644
--- a/llvm/unittests/ExecutionEngine/Orc/JITTargetMachineBuilderTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/JITTargetMachineBuilderTest.cpp
@@ -26,8 +26,8 @@ TEST(ExecutionUtilsTest, JITTargetMachineBuilder) {
 
   // Test API by performing a bunch of no-ops.
   JTMB.setCPU("");
-  JTMB.setRelocationModel(None);
-  JTMB.setCodeModel(None);
+  JTMB.setRelocationModel(std::nullopt);
+  JTMB.setCodeModel(std::nullopt);
   JTMB.setCodeGenOptLevel(CodeGenOpt::None);
   JTMB.addFeatures(std::vector<std::string>());
   SubtargetFeatures &STF = JTMB.getFeatures();

diff  --git a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
index 7a68a01880a21..64ff66277b043 100644
--- a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
+++ b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
@@ -169,11 +169,12 @@ class OpenMPIRBuilderTest : public testing::Test {
     BB = BasicBlock::Create(Ctx, "", F);
 
     DIBuilder DIB(*M);
-    auto File = DIB.createFile("test.dbg", "/src", llvm::None,
+    auto File = DIB.createFile("test.dbg", "/src", std::nullopt,
                                Optional<StringRef>("/src/test.dbg"));
     auto CU =
         DIB.createCompileUnit(dwarf::DW_LANG_C, File, "llvm-C", true, "", 0);
-    auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
+    auto Type =
+        DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
     auto SP = DIB.createFunction(
         CU, "foo", "", File, 1, Type, 1, DINode::FlagZero,
         DISubprogram::SPFlagDefinition | DISubprogram::SPFlagOptimized);
@@ -4127,7 +4128,7 @@ sumAtomicReduction(OpenMPIRBuilder::InsertPointTy IP, Type *Ty, Value *LHS,
                    Value *RHS) {
   IRBuilder<> Builder(IP.getBlock(), IP.getPoint());
   Value *Partial = Builder.CreateLoad(Ty, RHS, "red.partial");
-  Builder.CreateAtomicRMW(AtomicRMWInst::FAdd, LHS, Partial, None,
+  Builder.CreateAtomicRMW(AtomicRMWInst::FAdd, LHS, Partial, std::nullopt,
                           AtomicOrdering::Monotonic);
   return Builder.saveIP();
 }
@@ -4145,7 +4146,7 @@ xorAtomicReduction(OpenMPIRBuilder::InsertPointTy IP, Type *Ty, Value *LHS,
                    Value *RHS) {
   IRBuilder<> Builder(IP.getBlock(), IP.getPoint());
   Value *Partial = Builder.CreateLoad(Ty, RHS, "red.partial");
-  Builder.CreateAtomicRMW(AtomicRMWInst::Xor, LHS, Partial, None,
+  Builder.CreateAtomicRMW(AtomicRMWInst::Xor, LHS, Partial, std::nullopt,
                           AtomicOrdering::Monotonic);
   return Builder.saveIP();
 }

diff  --git a/llvm/unittests/IR/AttributesTest.cpp b/llvm/unittests/IR/AttributesTest.cpp
index eabaad424f9ec..832af6ef60056 100644
--- a/llvm/unittests/IR/AttributesTest.cpp
+++ b/llvm/unittests/IR/AttributesTest.cpp
@@ -97,7 +97,7 @@ TEST(Attributes, RemoveAlign) {
   EXPECT_TRUE(AS.hasAttribute(Attribute::ReadOnly));
   AS = AttributeSet::get(C, B_align_readonly);
   AS = AS.removeAttributes(C, B_align);
-  EXPECT_TRUE(AS.getAlignment() == None);
+  EXPECT_TRUE(AS.getAlignment() == std::nullopt);
   EXPECT_TRUE(AS.hasAttribute(Attribute::ReadOnly));
 
   AttributeList AL;

diff  --git a/llvm/unittests/IR/CFGBuilder.cpp b/llvm/unittests/IR/CFGBuilder.cpp
index cede196d250aa..fb05a9d5aa0a8 100644
--- a/llvm/unittests/IR/CFGBuilder.cpp
+++ b/llvm/unittests/IR/CFGBuilder.cpp
@@ -128,13 +128,13 @@ void CFGBuilder::buildCFG(const std::vector<Arc> &NewArcs) {
 
 Optional<CFGBuilder::Update> CFGBuilder::getNextUpdate() const {
   if (UpdateIdx == Updates.size())
-    return None;
+    return std::nullopt;
   return Updates[UpdateIdx];
 }
 
 Optional<CFGBuilder::Update> CFGBuilder::applyUpdate() {
   if (UpdateIdx == Updates.size())
-    return None;
+    return std::nullopt;
   Update NextUpdate = Updates[UpdateIdx++];
   if (NextUpdate.Action == ActionKind::Insert)
     connect(NextUpdate.Edge);

diff  --git a/llvm/unittests/IR/ConstantRangeTest.cpp b/llvm/unittests/IR/ConstantRangeTest.cpp
index 3ddd04a4d9423..ab55b7f0545d5 100644
--- a/llvm/unittests/IR/ConstantRangeTest.cpp
+++ b/llvm/unittests/IR/ConstantRangeTest.cpp
@@ -777,7 +777,7 @@ TEST_F(ConstantRangeTest, AddWithNoWrap) {
         bool IsOverflow;
         APInt Res = N1.sadd_ov(N2, IsOverflow);
         if (IsOverflow)
-          return None;
+          return std::nullopt;
         return Res;
       },
       PreferSmallest,
@@ -831,7 +831,7 @@ TEST_F(ConstantRangeTest, AddWithNoWrap) {
         bool IsOverflow;
         APInt Res = N1.uadd_ov(N2, IsOverflow);
         if (IsOverflow)
-          return None;
+          return std::nullopt;
         return Res;
       },
       PreferSmallest,
@@ -872,7 +872,7 @@ TEST_F(ConstantRangeTest, AddWithNoWrap) {
         APInt Res1 = N1.uadd_ov(N2, IsOverflow1);
         APInt Res2 = N1.sadd_ov(N2, IsOverflow2);
         if (IsOverflow1 || IsOverflow2)
-          return None;
+          return std::nullopt;
         assert(Res1 == Res2 && "Addition results 
diff er?");
         return Res1;
       },
@@ -920,7 +920,7 @@ TEST_F(ConstantRangeTest, SubWithNoWrap) {
         bool IsOverflow;
         APInt Res = N1.ssub_ov(N2, IsOverflow);
         if (IsOverflow)
-          return None;
+          return std::nullopt;
         return Res;
       },
       PreferSmallest,
@@ -933,7 +933,7 @@ TEST_F(ConstantRangeTest, SubWithNoWrap) {
         bool IsOverflow;
         APInt Res = N1.usub_ov(N2, IsOverflow);
         if (IsOverflow)
-          return None;
+          return std::nullopt;
         return Res;
       },
       PreferSmallest,
@@ -947,7 +947,7 @@ TEST_F(ConstantRangeTest, SubWithNoWrap) {
         APInt Res1 = N1.usub_ov(N2, IsOverflow1);
         APInt Res2 = N1.ssub_ov(N2, IsOverflow2);
         if (IsOverflow1 || IsOverflow2)
-          return None;
+          return std::nullopt;
         assert(Res1 == Res2 && "Subtraction results 
diff er?");
         return Res1;
       },
@@ -1248,7 +1248,7 @@ TEST_F(ConstantRangeTest, URem) {
       },
       [](const APInt &N1, const APInt &N2) -> Optional<APInt> {
         if (N2.isZero())
-          return None;
+          return std::nullopt;
         return N1.urem(N2);
       },
       PreferSmallest,
@@ -1324,7 +1324,7 @@ TEST_F(ConstantRangeTest, SRem) {
       },
       [](const APInt &N1, const APInt &N2) -> Optional<APInt> {
         if (N2.isZero())
-          return None;
+          return std::nullopt;
         return N1.srem(N2);
       },
       PreferSmallest,
@@ -1362,7 +1362,7 @@ TEST_F(ConstantRangeTest, Shl) {
       },
       [](const APInt &N1, const APInt &N2) -> Optional<APInt> {
         if (N2.uge(N2.getBitWidth()))
-          return None;
+          return std::nullopt;
         return N1.shl(N2);
       },
       PreferSmallestUnsigned,
@@ -2398,7 +2398,7 @@ TEST_F(ConstantRangeTest, Abs) {
       [](const ConstantRange &CR) { return CR.abs(/*IntMinIsPoison=*/true); },
       [](const APInt &N) -> Optional<APInt> {
         if (N.isMinSignedValue())
-          return None;
+          return std::nullopt;
         return N.abs();
       });
 }

diff  --git a/llvm/unittests/IR/ConstantsTest.cpp b/llvm/unittests/IR/ConstantsTest.cpp
index 5d1c167168078..71ff311e7693f 100644
--- a/llvm/unittests/IR/ConstantsTest.cpp
+++ b/llvm/unittests/IR/ConstantsTest.cpp
@@ -500,7 +500,7 @@ TEST(ConstantsTest, BitcastToGEP) {
 
 bool foldFuncPtrAndConstToNull(LLVMContext &Context, Module *TheModule,
                                uint64_t AndValue,
-                               MaybeAlign FunctionAlign = llvm::None) {
+                               MaybeAlign FunctionAlign = std::nullopt) {
   Type *VoidType(Type::getVoidTy(Context));
   FunctionType *FuncType(FunctionType::get(VoidType, false));
   Function *Func(

diff  --git a/llvm/unittests/IR/IRBuilderTest.cpp b/llvm/unittests/IR/IRBuilderTest.cpp
index 89eb51dbcca85..32e7b65d3ff6a 100644
--- a/llvm/unittests/IR/IRBuilderTest.cpp
+++ b/llvm/unittests/IR/IRBuilderTest.cpp
@@ -436,7 +436,7 @@ TEST_F(IRBuilderTest, ConstrainedFPFunctionCall) {
   // Now call the empty constrained FP function.
   Builder.setIsFPConstrained(true);
   Builder.setConstrainedFPFunctionAttr();
-  CallInst *FCall = Builder.CreateCall(Callee, None);
+  CallInst *FCall = Builder.CreateCall(Callee, std::nullopt);
 
   // Check the attributes to verify the strictfp attribute is on the call.
   EXPECT_TRUE(
@@ -696,24 +696,24 @@ TEST_F(IRBuilderTest, FastMathFlags) {
   auto Callee =
       Function::Create(CalleeTy, Function::ExternalLinkage, "", M.get());
 
-  FCall = Builder.CreateCall(Callee, None);
+  FCall = Builder.CreateCall(Callee, std::nullopt);
   EXPECT_FALSE(FCall->hasNoNaNs());
 
   Function *V =
       Function::Create(CalleeTy, Function::ExternalLinkage, "", M.get());
-  FCall = Builder.CreateCall(V, None);
+  FCall = Builder.CreateCall(V, std::nullopt);
   EXPECT_FALSE(FCall->hasNoNaNs());
 
   FMF.clear();
   FMF.setNoNaNs();
   Builder.setFastMathFlags(FMF);
 
-  FCall = Builder.CreateCall(Callee, None);
+  FCall = Builder.CreateCall(Callee, std::nullopt);
   EXPECT_TRUE(Builder.getFastMathFlags().any());
   EXPECT_TRUE(Builder.getFastMathFlags().NoNaNs);
   EXPECT_TRUE(FCall->hasNoNaNs());
 
-  FCall = Builder.CreateCall(V, None);
+  FCall = Builder.CreateCall(V, std::nullopt);
   EXPECT_TRUE(Builder.getFastMathFlags().any());
   EXPECT_TRUE(Builder.getFastMathFlags().NoNaNs);
   EXPECT_TRUE(FCall->hasNoNaNs());
@@ -825,7 +825,7 @@ TEST_F(IRBuilderTest, createFunction) {
   auto File = DIB.createFile("error.swift", "/");
   auto CU =
       DIB.createCompileUnit(dwarf::DW_LANG_Swift, File, "swiftc", true, "", 0);
-  auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
+  auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
   auto NoErr = DIB.createFunction(
       CU, "noerr", "", File, 1, Type, 1, DINode::FlagZero,
       DISubprogram::SPFlagDefinition | DISubprogram::SPFlagOptimized);
@@ -847,7 +847,7 @@ TEST_F(IRBuilderTest, DIBuilder) {
   auto CU = DIB.createCompileUnit(dwarf::DW_LANG_Cobol74,
                                   DIB.createFile("F.CBL", "/"), "llvm-cobol74",
                                   true, "", 0);
-  auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
+  auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
   auto SP = DIB.createFunction(
       CU, "foo", "", File, 1, Type, 1, DINode::FlagZero,
       DISubprogram::SPFlagDefinition | DISubprogram::SPFlagOptimized);
@@ -869,7 +869,7 @@ TEST_F(IRBuilderTest, createArtificialSubprogram) {
   auto CU = DIB.createCompileUnit(dwarf::DW_LANG_C, File, "clang",
                                   /*isOptimized=*/true, /*Flags=*/"",
                                   /*Runtime Version=*/0);
-  auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
+  auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
   auto SP = DIB.createFunction(
       CU, "foo", /*LinkageName=*/"", File,
       /*LineNo=*/1, Type, /*ScopeLine=*/2, DINode::FlagZero,
@@ -1038,7 +1038,8 @@ TEST_F(IRBuilderTest, DebugLoc) {
   auto CU = DIB.createCompileUnit(dwarf::DW_LANG_C_plus_plus_11,
                                   DIB.createFile("tmp.cpp", "/"), "", true, "",
                                   0);
-  auto SPType = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
+  auto SPType =
+      DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
   auto SP =
       DIB.createFunction(CU, "foo", "foo", File, 1, SPType, 1, DINode::FlagZero,
                          DISubprogram::SPFlagDefinition);
@@ -1052,13 +1053,13 @@ TEST_F(IRBuilderTest, DebugLoc) {
   IRBuilder<> Builder(Ctx);
   Builder.SetInsertPoint(Br);
   EXPECT_EQ(DL1, Builder.getCurrentDebugLocation());
-  auto Call1 = Builder.CreateCall(Callee, None);
+  auto Call1 = Builder.CreateCall(Callee, std::nullopt);
   EXPECT_EQ(DL1, Call1->getDebugLoc());
 
   Call1->setDebugLoc(DL2);
   Builder.SetInsertPoint(Call1->getParent(), Call1->getIterator());
   EXPECT_EQ(DL2, Builder.getCurrentDebugLocation());
-  auto Call2 = Builder.CreateCall(Callee, None);
+  auto Call2 = Builder.CreateCall(Callee, std::nullopt);
   EXPECT_EQ(DL2, Call2->getDebugLoc());
 
   DIB.finalize();
@@ -1071,7 +1072,7 @@ TEST_F(IRBuilderTest, DIImportedEntity) {
   auto CU = DIB.createCompileUnit(dwarf::DW_LANG_Cobol74,
                                   F, "llvm-cobol74",
                                   true, "", 0);
-  MDTuple *Elements = MDTuple::getDistinct(Ctx, None);
+  MDTuple *Elements = MDTuple::getDistinct(Ctx, std::nullopt);
 
   DIB.createImportedDeclaration(CU, nullptr, F, 1);
   DIB.createImportedDeclaration(CU, nullptr, F, 1);

diff  --git a/llvm/unittests/IR/InstructionsTest.cpp b/llvm/unittests/IR/InstructionsTest.cpp
index 26a513902bdef..cd9fb0385bc29 100644
--- a/llvm/unittests/IR/InstructionsTest.cpp
+++ b/llvm/unittests/IR/InstructionsTest.cpp
@@ -752,7 +752,7 @@ TEST(InstructionsTest, AlterCallBundles) {
   AttrBuilder AB(C);
   AB.addAttribute(Attribute::Cold);
   Call->setAttributes(AttributeList::get(C, AttributeList::FunctionIndex, AB));
-  Call->setDebugLoc(DebugLoc(MDNode::get(C, None)));
+  Call->setDebugLoc(DebugLoc(MDNode::get(C, std::nullopt)));
 
   OperandBundleDef NewBundle("after", ConstantInt::get(Int32Ty, 7));
   std::unique_ptr<CallInst> Clone(CallInst::Create(Call.get(), NewBundle));
@@ -782,7 +782,7 @@ TEST(InstructionsTest, AlterInvokeBundles) {
   AB.addAttribute(Attribute::Cold);
   Invoke->setAttributes(
       AttributeList::get(C, AttributeList::FunctionIndex, AB));
-  Invoke->setDebugLoc(DebugLoc(MDNode::get(C, None)));
+  Invoke->setDebugLoc(DebugLoc(MDNode::get(C, std::nullopt)));
 
   OperandBundleDef NewBundle("after", ConstantInt::get(Int32Ty, 7));
   std::unique_ptr<InvokeInst> Clone(

diff  --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp
index 7ba2d7680fac9..fcb0b296941a0 100644
--- a/llvm/unittests/IR/MetadataTest.cpp
+++ b/llvm/unittests/IR/MetadataTest.cpp
@@ -72,14 +72,14 @@ class MetadataTest : public testing::Test {
   Module M;
   int Counter;
 
-  MDNode *getNode() { return MDNode::get(Context, None); }
+  MDNode *getNode() { return MDNode::get(Context, std::nullopt); }
   MDNode *getNode(Metadata *MD) { return MDNode::get(Context, MD); }
   MDNode *getNode(Metadata *MD1, Metadata *MD2) {
     Metadata *MDs[] = {MD1, MD2};
     return MDNode::get(Context, MDs);
   }
 
-  MDTuple *getTuple() { return MDTuple::getDistinct(Context, None); }
+  MDTuple *getTuple() { return MDTuple::getDistinct(Context, std::nullopt); }
   DISubroutineType *getSubroutineType() {
     return DISubroutineType::getDistinct(Context, DINode::FlagZero, 0,
                                          getNode(nullptr));
@@ -105,7 +105,7 @@ class MetadataTest : public testing::Test {
   DIType *getDerivedType() {
     return DIDerivedType::getDistinct(
         Context, dwarf::DW_TAG_pointer_type, "", nullptr, 0, nullptr,
-        getBasicType("basictype"), 1, 2, 0, None, DINode::FlagZero);
+        getBasicType("basictype"), 1, 2, 0, std::nullopt, DINode::FlagZero);
   }
   Constant *getConstant() {
     return ConstantInt::get(Type::getInt32Ty(Context), Counter++);
@@ -120,7 +120,7 @@ class MetadataTest : public testing::Test {
   }
   Function *getFunction(StringRef Name) {
     return Function::Create(
-        FunctionType::get(Type::getVoidTy(Context), None, false),
+        FunctionType::get(Type::getVoidTy(Context), std::nullopt, false),
         Function::ExternalLinkage, Name, M);
   }
 };
@@ -226,7 +226,7 @@ TEST_F(MDNodeTest, SelfReference) {
   // !0 = !{!0}
   // !1 = !{!0}
   {
-    auto Temp = MDNode::getTemporary(Context, None);
+    auto Temp = MDNode::getTemporary(Context, std::nullopt);
     Metadata *Args[] = {Temp.get()};
     MDNode *Self = MDNode::get(Context, Args);
     Self->replaceOperandWith(0, Self);
@@ -244,8 +244,8 @@ TEST_F(MDNodeTest, SelfReference) {
   // !0 = !{!0, !{}}
   // !1 = !{!0, !{}}
   {
-    auto Temp = MDNode::getTemporary(Context, None);
-    Metadata *Args[] = {Temp.get(), MDNode::get(Context, None)};
+    auto Temp = MDNode::getTemporary(Context, std::nullopt);
+    Metadata *Args[] = {Temp.get(), MDNode::get(Context, std::nullopt)};
     MDNode *Self = MDNode::get(Context, Args);
     Self->replaceOperandWith(0, Self);
     ASSERT_EQ(Self, Self->getOperand(0));
@@ -354,8 +354,8 @@ TEST_F(MDNodeTest, PrintFromFunction) {
   auto *BB1 = BasicBlock::Create(Context, "entry", F1);
   auto *R0 = ReturnInst::Create(Context, BB0);
   auto *R1 = ReturnInst::Create(Context, BB1);
-  auto *N0 = MDNode::getDistinct(Context, None);
-  auto *N1 = MDNode::getDistinct(Context, None);
+  auto *N0 = MDNode::getDistinct(Context, std::nullopt);
+  auto *N1 = MDNode::getDistinct(Context, std::nullopt);
   R0->setMetadata("md", N0);
   R1->setMetadata("md", N1);
 
@@ -380,8 +380,8 @@ TEST_F(MDNodeTest, PrintFromMetadataAsValue) {
   auto *F1 = Function::Create(FTy, GlobalValue::ExternalLinkage, "F1", &M);
   auto *BB0 = BasicBlock::Create(Context, "entry", F0);
   auto *BB1 = BasicBlock::Create(Context, "entry", F1);
-  auto *N0 = MDNode::getDistinct(Context, None);
-  auto *N1 = MDNode::getDistinct(Context, None);
+  auto *N0 = MDNode::getDistinct(Context, std::nullopt);
+  auto *N1 = MDNode::getDistinct(Context, std::nullopt);
   auto *MAV0 = MetadataAsValue::get(Context, N0);
   auto *MAV1 = MetadataAsValue::get(Context, N1);
   CallInst::Create(Intrinsic, MAV0, "", BB0);
@@ -415,7 +415,7 @@ TEST_F(MDNodeTest, PrintWithDroppedCallOperand) {
   CI0->dropAllReferences();
 
   auto *R0 = ReturnInst::Create(Context, BB0);
-  auto *N0 = MDNode::getDistinct(Context, None);
+  auto *N0 = MDNode::getDistinct(Context, std::nullopt);
   R0->setMetadata("md", N0);
 
   // Printing the metadata node would previously result in a failed assertion
@@ -460,7 +460,7 @@ TEST_F(MDNodeTest, PrintTree) {
     auto *StructTy = cast<DICompositeType>(getCompositeType());
     DIType *PointerTy = DIDerivedType::getDistinct(
         Context, dwarf::DW_TAG_pointer_type, "", nullptr, 0, nullptr, StructTy,
-        1, 2, 0, None, DINode::FlagZero);
+        1, 2, 0, std::nullopt, DINode::FlagZero);
     StructTy->replaceElements(MDTuple::get(Context, PointerTy));
 
     auto *Var = DILocalVariable::get(Context, Scope, "foo", File,
@@ -488,7 +488,7 @@ TEST_F(MDNodeTest, PrintTree) {
 
 TEST_F(MDNodeTest, NullOperand) {
   // metadata !{}
-  MDNode *Empty = MDNode::get(Context, None);
+  MDNode *Empty = MDNode::get(Context, std::nullopt);
 
   // metadata !{metadata !{}}
   Metadata *Ops[] = {Empty};
@@ -508,7 +508,7 @@ TEST_F(MDNodeTest, NullOperand) {
 
 TEST_F(MDNodeTest, DistinctOnUniquingCollision) {
   // !{}
-  MDNode *Empty = MDNode::get(Context, None);
+  MDNode *Empty = MDNode::get(Context, std::nullopt);
   ASSERT_TRUE(Empty->isResolved());
   EXPECT_FALSE(Empty->isDistinct());
 
@@ -535,7 +535,7 @@ TEST_F(MDNodeTest, DistinctOnUniquingCollision) {
 
 TEST_F(MDNodeTest, UniquedOnDeletedOperand) {
   // temp !{}
-  TempMDTuple T = MDTuple::getTemporary(Context, None);
+  TempMDTuple T = MDTuple::getTemporary(Context, std::nullopt);
 
   // !{temp !{}}
   Metadata *Ops[] = {T.get()};
@@ -569,14 +569,14 @@ TEST_F(MDNodeTest, DistinctOnDeletedValueOperand) {
 
 TEST_F(MDNodeTest, getDistinct) {
   // !{}
-  MDNode *Empty = MDNode::get(Context, None);
+  MDNode *Empty = MDNode::get(Context, std::nullopt);
   ASSERT_TRUE(Empty->isResolved());
   ASSERT_FALSE(Empty->isDistinct());
-  ASSERT_EQ(Empty, MDNode::get(Context, None));
+  ASSERT_EQ(Empty, MDNode::get(Context, std::nullopt));
 
   // distinct !{}
-  MDNode *Distinct1 = MDNode::getDistinct(Context, None);
-  MDNode *Distinct2 = MDNode::getDistinct(Context, None);
+  MDNode *Distinct1 = MDNode::getDistinct(Context, std::nullopt);
+  MDNode *Distinct2 = MDNode::getDistinct(Context, std::nullopt);
   EXPECT_TRUE(Distinct1->isResolved());
   EXPECT_TRUE(Distinct2->isDistinct());
   EXPECT_NE(Empty, Distinct1);
@@ -584,31 +584,31 @@ TEST_F(MDNodeTest, getDistinct) {
   EXPECT_NE(Distinct1, Distinct2);
 
   // !{}
-  ASSERT_EQ(Empty, MDNode::get(Context, None));
+  ASSERT_EQ(Empty, MDNode::get(Context, std::nullopt));
 }
 
 TEST_F(MDNodeTest, isUniqued) {
-  MDNode *U = MDTuple::get(Context, None);
-  MDNode *D = MDTuple::getDistinct(Context, None);
-  auto T = MDTuple::getTemporary(Context, None);
+  MDNode *U = MDTuple::get(Context, std::nullopt);
+  MDNode *D = MDTuple::getDistinct(Context, std::nullopt);
+  auto T = MDTuple::getTemporary(Context, std::nullopt);
   EXPECT_TRUE(U->isUniqued());
   EXPECT_FALSE(D->isUniqued());
   EXPECT_FALSE(T->isUniqued());
 }
 
 TEST_F(MDNodeTest, isDistinct) {
-  MDNode *U = MDTuple::get(Context, None);
-  MDNode *D = MDTuple::getDistinct(Context, None);
-  auto T = MDTuple::getTemporary(Context, None);
+  MDNode *U = MDTuple::get(Context, std::nullopt);
+  MDNode *D = MDTuple::getDistinct(Context, std::nullopt);
+  auto T = MDTuple::getTemporary(Context, std::nullopt);
   EXPECT_FALSE(U->isDistinct());
   EXPECT_TRUE(D->isDistinct());
   EXPECT_FALSE(T->isDistinct());
 }
 
 TEST_F(MDNodeTest, isTemporary) {
-  MDNode *U = MDTuple::get(Context, None);
-  MDNode *D = MDTuple::getDistinct(Context, None);
-  auto T = MDTuple::getTemporary(Context, None);
+  MDNode *U = MDTuple::get(Context, std::nullopt);
+  MDNode *D = MDTuple::getDistinct(Context, std::nullopt);
+  auto T = MDTuple::getTemporary(Context, std::nullopt);
   EXPECT_FALSE(U->isTemporary());
   EXPECT_FALSE(D->isTemporary());
   EXPECT_TRUE(T->isTemporary());
@@ -616,7 +616,7 @@ TEST_F(MDNodeTest, isTemporary) {
 
 TEST_F(MDNodeTest, getDistinctWithUnresolvedOperands) {
   // temporary !{}
-  auto Temp = MDTuple::getTemporary(Context, None);
+  auto Temp = MDTuple::getTemporary(Context, std::nullopt);
   ASSERT_FALSE(Temp->isResolved());
 
   // distinct !{temporary !{}}
@@ -626,17 +626,17 @@ TEST_F(MDNodeTest, getDistinctWithUnresolvedOperands) {
   EXPECT_EQ(Temp.get(), Distinct->getOperand(0));
 
   // temporary !{} => !{}
-  MDNode *Empty = MDNode::get(Context, None);
+  MDNode *Empty = MDNode::get(Context, std::nullopt);
   Temp->replaceAllUsesWith(Empty);
   EXPECT_EQ(Empty, Distinct->getOperand(0));
 }
 
 TEST_F(MDNodeTest, handleChangedOperandRecursion) {
   // !0 = !{}
-  MDNode *N0 = MDNode::get(Context, None);
+  MDNode *N0 = MDNode::get(Context, std::nullopt);
 
   // !1 = !{!3, null}
-  auto Temp3 = MDTuple::getTemporary(Context, None);
+  auto Temp3 = MDTuple::getTemporary(Context, std::nullopt);
   Metadata *Ops1[] = {Temp3.get(), nullptr};
   MDNode *N1 = MDNode::get(Context, Ops1);
 
@@ -700,7 +700,7 @@ TEST_F(MDNodeTest, replaceResolvedOperand) {
   // a global value that gets RAUW'ed.
   //
   // Use a temporary node to keep N from being resolved.
-  auto Temp = MDTuple::getTemporary(Context, None);
+  auto Temp = MDTuple::getTemporary(Context, std::nullopt);
   Metadata *Ops[] = {nullptr, Temp.get()};
 
   MDNode *Empty = MDTuple::get(Context, ArrayRef<Metadata *>());
@@ -721,7 +721,7 @@ TEST_F(MDNodeTest, replaceResolvedOperand) {
 }
 
 TEST_F(MDNodeTest, replaceWithUniqued) {
-  auto *Empty = MDTuple::get(Context, None);
+  auto *Empty = MDTuple::get(Context, std::nullopt);
   MDTuple *FirstUniqued;
   {
     Metadata *Ops[] = {Empty};
@@ -747,7 +747,7 @@ TEST_F(MDNodeTest, replaceWithUniqued) {
     EXPECT_EQ(FirstUniqued, Uniqued);
   }
   {
-    auto Unresolved = MDTuple::getTemporary(Context, None);
+    auto Unresolved = MDTuple::getTemporary(Context, std::nullopt);
     Metadata *Ops[] = {Unresolved.get()};
     auto Temp = MDTuple::getTemporary(Context, Ops);
     EXPECT_TRUE(Temp->isTemporary());
@@ -769,7 +769,7 @@ TEST_F(MDNodeTest, replaceWithUniqued) {
 
 TEST_F(MDNodeTest, replaceWithUniquedResolvingOperand) {
   // temp !{}
-  MDTuple *Op = MDTuple::getTemporary(Context, None).release();
+  MDTuple *Op = MDTuple::getTemporary(Context, std::nullopt).release();
   EXPECT_FALSE(Op->isResolved());
 
   // temp !{temp !{}}
@@ -836,7 +836,7 @@ TEST_F(MDNodeTest, replaceWithUniquedChangedOperand) {
 
 TEST_F(MDNodeTest, replaceWithDistinct) {
   {
-    auto *Empty = MDTuple::get(Context, None);
+    auto *Empty = MDTuple::get(Context, std::nullopt);
     Metadata *Ops[] = {Empty};
     auto Temp = MDTuple::getTemporary(Context, Ops);
     EXPECT_TRUE(Temp->isTemporary());
@@ -849,7 +849,7 @@ TEST_F(MDNodeTest, replaceWithDistinct) {
     EXPECT_EQ(Current, Distinct);
   }
   {
-    auto Unresolved = MDTuple::getTemporary(Context, None);
+    auto Unresolved = MDTuple::getTemporary(Context, std::nullopt);
     Metadata *Ops[] = {Unresolved.get()};
     auto Temp = MDTuple::getTemporary(Context, Ops);
     EXPECT_TRUE(Temp->isTemporary());
@@ -908,7 +908,7 @@ TEST_F(MDNodeTest, deleteTemporaryWithTrackingRef) {
   TrackingMDRef Ref;
   EXPECT_EQ(nullptr, Ref.get());
   {
-    auto Temp = MDTuple::getTemporary(Context, None);
+    auto Temp = MDTuple::getTemporary(Context, std::nullopt);
     Ref.reset(Temp.get());
     EXPECT_EQ(Temp.get(), Ref.get());
   }
@@ -1100,14 +1100,14 @@ TEST_F(DILocationTest, getDistinct) {
 }
 
 TEST_F(DILocationTest, getTemporary) {
-  MDNode *N = MDNode::get(Context, None);
+  MDNode *N = MDNode::get(Context, std::nullopt);
   auto L = DILocation::getTemporary(Context, 2, 7, N);
   EXPECT_TRUE(L->isTemporary());
   EXPECT_FALSE(L->isResolved());
 }
 
 TEST_F(DILocationTest, cloneTemporary) {
-  MDNode *N = MDNode::get(Context, None);
+  MDNode *N = MDNode::get(Context, std::nullopt);
   auto L = DILocation::getTemporary(Context, 2, 7, N);
   EXPECT_TRUE(L->isTemporary());
   auto L2 = L->clone();
@@ -1163,15 +1163,14 @@ TEST_F(DILocationTest, discriminatorEncoding) {
 }
 
 TEST_F(DILocationTest, discriminatorEncodingNegativeTests) {
-  EXPECT_EQ(None, DILocation::encodeDiscriminator(0, 0, 0x1000));
-  EXPECT_EQ(None, DILocation::encodeDiscriminator(0x1000, 0, 0));
-  EXPECT_EQ(None, DILocation::encodeDiscriminator(0, 0x1000, 0));
-  EXPECT_EQ(None, DILocation::encodeDiscriminator(0, 0, 0x1000));
-  EXPECT_EQ(None, DILocation::encodeDiscriminator(0x1ff, 0x1ff, 8));
-  EXPECT_EQ(None,
-            DILocation::encodeDiscriminator(std::numeric_limits<uint32_t>::max(),
-                                            std::numeric_limits<uint32_t>::max(),
-                                            0));
+  EXPECT_EQ(std::nullopt, DILocation::encodeDiscriminator(0, 0, 0x1000));
+  EXPECT_EQ(std::nullopt, DILocation::encodeDiscriminator(0x1000, 0, 0));
+  EXPECT_EQ(std::nullopt, DILocation::encodeDiscriminator(0, 0x1000, 0));
+  EXPECT_EQ(std::nullopt, DILocation::encodeDiscriminator(0, 0, 0x1000));
+  EXPECT_EQ(std::nullopt, DILocation::encodeDiscriminator(0x1ff, 0x1ff, 8));
+  EXPECT_EQ(std::nullopt, DILocation::encodeDiscriminator(
+                              std::numeric_limits<uint32_t>::max(),
+                              std::numeric_limits<uint32_t>::max(), 0));
 }
 
 TEST_F(DILocationTest, discriminatorSpecialCases) {
@@ -1215,8 +1214,8 @@ TEST_F(DILocationTest, discriminatorSpecialCases) {
                         ->getDuplicationFactor());
 
   // Check we return None for unencodable cases.
-  EXPECT_EQ(None, L4->cloneWithBaseDiscriminator(0x1000));
-  EXPECT_EQ(None, L4->cloneByMultiplyingDuplicationFactor(0x1000));
+  EXPECT_EQ(std::nullopt, L4->cloneWithBaseDiscriminator(0x1000));
+  EXPECT_EQ(std::nullopt, L4->cloneByMultiplyingDuplicationFactor(0x1000));
 }
 
 
@@ -1224,7 +1223,7 @@ typedef MetadataTest GenericDINodeTest;
 
 TEST_F(GenericDINodeTest, get) {
   StringRef Header = "header";
-  auto *Empty = MDNode::get(Context, None);
+  auto *Empty = MDNode::get(Context, std::nullopt);
   Metadata *Ops1[] = {Empty};
   auto *N = GenericDINode::get(Context, 15, Header, Ops1);
   EXPECT_EQ(15u, N->getTag());
@@ -1260,7 +1259,7 @@ TEST_F(GenericDINodeTest, get) {
 
 TEST_F(GenericDINodeTest, getEmptyHeader) {
   // Canonicalize !"" to null.
-  auto *N = GenericDINode::get(Context, 15, StringRef(), None);
+  auto *N = GenericDINode::get(Context, 15, StringRef(), std::nullopt);
   EXPECT_EQ(StringRef(), N->getHeader());
   EXPECT_EQ(nullptr, N->getOperand(0));
 }
@@ -1966,7 +1965,7 @@ TEST_F(DICompositeTypeTest, replaceOperands) {
       Context, Tag, Name, File, Line, Scope, BaseType, SizeInBits, AlignInBits,
       OffsetInBits, Flags, nullptr, RuntimeLang, nullptr, nullptr, Identifier);
 
-  auto *Elements = MDTuple::getDistinct(Context, None);
+  auto *Elements = MDTuple::getDistinct(Context, std::nullopt);
   EXPECT_EQ(nullptr, N->getElements().get());
   N->replaceElements(Elements);
   EXPECT_EQ(Elements, N->getElements().get());
@@ -1985,7 +1984,7 @@ TEST_F(DICompositeTypeTest, replaceOperands) {
   N->replaceVTableHolder(nullptr);
   EXPECT_EQ(nullptr, N->getVTableHolder());
 
-  auto *TemplateParams = MDTuple::getDistinct(Context, None);
+  auto *TemplateParams = MDTuple::getDistinct(Context, std::nullopt);
   EXPECT_EQ(nullptr, N->getTemplateParams().get());
   N->replaceTemplateParams(TemplateParams);
   EXPECT_EQ(TemplateParams, N->getTemplateParams().get());
@@ -2303,9 +2302,9 @@ TEST_F(DICompileUnitTest, replaceArrays) {
   unsigned RuntimeVersion = 2;
   StringRef SplitDebugFilename = "another/file";
   auto EmissionKind = DICompileUnit::FullDebug;
-  MDTuple *EnumTypes = MDTuple::getDistinct(Context, None);
-  MDTuple *RetainedTypes = MDTuple::getDistinct(Context, None);
-  MDTuple *ImportedEntities = MDTuple::getDistinct(Context, None);
+  MDTuple *EnumTypes = MDTuple::getDistinct(Context, std::nullopt);
+  MDTuple *RetainedTypes = MDTuple::getDistinct(Context, std::nullopt);
+  MDTuple *ImportedEntities = MDTuple::getDistinct(Context, std::nullopt);
   uint64_t DWOId = 0xc0ffee;
   StringRef SysRoot = "/";
   StringRef SDK = "MacOSX.sdk";
@@ -2315,14 +2314,14 @@ TEST_F(DICompileUnitTest, replaceArrays) {
       RetainedTypes, nullptr, ImportedEntities, nullptr, DWOId, true, false,
       DICompileUnit::DebugNameTableKind::Default, false, SysRoot, SDK);
 
-  auto *GlobalVariables = MDTuple::getDistinct(Context, None);
+  auto *GlobalVariables = MDTuple::getDistinct(Context, std::nullopt);
   EXPECT_EQ(nullptr, N->getGlobalVariables().get());
   N->replaceGlobalVariables(GlobalVariables);
   EXPECT_EQ(GlobalVariables, N->getGlobalVariables().get());
   N->replaceGlobalVariables(nullptr);
   EXPECT_EQ(nullptr, N->getGlobalVariables().get());
 
-  auto *Macros = MDTuple::getDistinct(Context, None);
+  auto *Macros = MDTuple::getDistinct(Context, std::nullopt);
   EXPECT_EQ(nullptr, N->getMacros().get());
   N->replaceMacros(Macros);
   EXPECT_EQ(Macros, N->getMacros().get());
@@ -2972,7 +2971,7 @@ TEST_F(DIExpressionTest, isValid) {
   } while (false)
 
   // Empty expression should be valid.
-  EXPECT_TRUE(DIExpression::get(Context, None));
+  EXPECT_TRUE(DIExpression::get(Context, std::nullopt));
 
   // Valid constructions.
   EXPECT_VALID(dwarf::DW_OP_plus_uconst, 6);
@@ -3258,7 +3257,7 @@ TEST_F(DIImportedEntityTest, get) {
 typedef MetadataTest MetadataAsValueTest;
 
 TEST_F(MetadataAsValueTest, MDNode) {
-  MDNode *N = MDNode::get(Context, None);
+  MDNode *N = MDNode::get(Context, std::nullopt);
   auto *V = MetadataAsValue::get(Context, N);
   EXPECT_TRUE(V->getType()->isMetadataTy());
   EXPECT_EQ(N, V->getMetadata());
@@ -3268,7 +3267,7 @@ TEST_F(MetadataAsValueTest, MDNode) {
 }
 
 TEST_F(MetadataAsValueTest, MDNodeMDNode) {
-  MDNode *N = MDNode::get(Context, None);
+  MDNode *N = MDNode::get(Context, std::nullopt);
   Metadata *Ops[] = {N};
   MDNode *N2 = MDNode::get(Context, Ops);
   auto *V = MetadataAsValue::get(Context, N2);
@@ -3320,7 +3319,7 @@ TEST_F(ValueAsMetadataTest, TempTempReplacement) {
   ConstantAsMetadata *CI =
       ConstantAsMetadata::get(ConstantInt::get(Context, APInt(8, 0)));
 
-  auto Temp1 = MDTuple::getTemporary(Context, None);
+  auto Temp1 = MDTuple::getTemporary(Context, std::nullopt);
   auto Temp2 = MDTuple::getTemporary(Context, {CI});
   auto *N = MDTuple::get(Context, {Temp1.get()});
 
@@ -3338,7 +3337,7 @@ TEST_F(ValueAsMetadataTest, CollidingDoubleUpdates) {
       ConstantAsMetadata::get(ConstantInt::get(Context, APInt(8, 0)));
 
   // Create a temporary to prevent nodes from resolving.
-  auto Temp = MDTuple::getTemporary(Context, None);
+  auto Temp = MDTuple::getTemporary(Context, std::nullopt);
 
   // When the first operand of N1 gets reset to nullptr, it'll collide with N2.
   Metadata *Ops1[] = {CI, CI, Temp.get()};
@@ -3604,7 +3603,7 @@ TEST_F(DistinctMDOperandPlaceholderTest, replaceUseWith) {
   ASSERT_EQ(&PH2, D->getOperand(2));
 
   // Replace them.
-  auto *N0 = MDTuple::get(Context, None);
+  auto *N0 = MDTuple::get(Context, std::nullopt);
   auto *N1 = MDTuple::get(Context, N0);
   PH0.replaceUseWith(N0);
   PH1.replaceUseWith(N1);
@@ -3616,7 +3615,8 @@ TEST_F(DistinctMDOperandPlaceholderTest, replaceUseWith) {
 
 TEST_F(DistinctMDOperandPlaceholderTest, replaceUseWithNoUser) {
   // There is no user, but we can still call replace.
-  DistinctMDOperandPlaceholder(7).replaceUseWith(MDTuple::get(Context, None));
+  DistinctMDOperandPlaceholder(7).replaceUseWith(
+      MDTuple::get(Context, std::nullopt));
 }
 
 // Test various assertions in metadata tracking. Don't run these tests if gtest
@@ -3683,9 +3683,9 @@ TEST_F(DebugVariableTest, DenseMap) {
   DILocalVariable *VarB =
       DILocalVariable::get(Context, Scope, "B", File, 7, Type, 3, Flags, 8, nullptr);
 
-  DebugVariable DebugVariableA(VarA, None, nullptr);
-  DebugVariable DebugVariableInlineA(VarA, None, InlinedLoc);
-  DebugVariable DebugVariableB(VarB, None, nullptr);
+  DebugVariable DebugVariableA(VarA, std::nullopt, nullptr);
+  DebugVariable DebugVariableInlineA(VarA, std::nullopt, InlinedLoc);
+  DebugVariable DebugVariableB(VarB, std::nullopt, nullptr);
   DebugVariable DebugVariableFragB(VarB, {{16, 16}}, nullptr);
 
   DebugVariableMap.insert({DebugVariableA, 2});
@@ -3782,7 +3782,7 @@ TEST_F(MDTupleAllocationTest, Resize) {
   EXPECT_EQ(B->getOperand(3), Value5);
 
   // Check that we can resize temporary nodes as well.
-  auto Temp1 = MDTuple::getTemporary(Context, None);
+  auto Temp1 = MDTuple::getTemporary(Context, std::nullopt);
   EXPECT_EQ(Temp1->getNumOperands(), 0u);
 
   Temp1->push_back(Value1);

diff  --git a/llvm/unittests/IR/PassBuilderCallbacksTest.cpp b/llvm/unittests/IR/PassBuilderCallbacksTest.cpp
index 91fa4e88ad784..c5947cfc381b7 100644
--- a/llvm/unittests/IR/PassBuilderCallbacksTest.cpp
+++ b/llvm/unittests/IR/PassBuilderCallbacksTest.cpp
@@ -462,8 +462,8 @@ class PassBuilderCallbacksTest<PassManager<
                   "exit:\n"
                   "  ret void\n"
                   "}\n")),
-        CallbacksHandle(),
-        PB(nullptr, PipelineTuningOptions(), None, &CallbacksHandle.Callbacks),
+        CallbacksHandle(), PB(nullptr, PipelineTuningOptions(), std::nullopt,
+                              &CallbacksHandle.Callbacks),
         PM(), LAM(), FAM(), CGAM(), AM() {
 
     EXPECT_TRUE(&CallbacksHandle.Callbacks ==

diff  --git a/llvm/unittests/IR/VerifierTest.cpp b/llvm/unittests/IR/VerifierTest.cpp
index c4977a9ecd55a..cca29e84ce75e 100644
--- a/llvm/unittests/IR/VerifierTest.cpp
+++ b/llvm/unittests/IR/VerifierTest.cpp
@@ -240,7 +240,7 @@ TEST(VerifierTest, DetectInvalidDebugInfo) {
 
 TEST(VerifierTest, MDNodeWrongContext) {
   LLVMContext C1, C2;
-  auto *Node = MDNode::get(C1, None);
+  auto *Node = MDNode::get(C1, std::nullopt);
 
   Module M("M", C2);
   auto *NamedNode = M.getOrInsertNamedMetadata("test");

diff  --git a/llvm/unittests/MC/AMDGPU/DwarfRegMappings.cpp b/llvm/unittests/MC/AMDGPU/DwarfRegMappings.cpp
index f0cfa8f78dfce..e1acb8677a046 100644
--- a/llvm/unittests/MC/AMDGPU/DwarfRegMappings.cpp
+++ b/llvm/unittests/MC/AMDGPU/DwarfRegMappings.cpp
@@ -37,8 +37,9 @@ createTargetMachine(std::string TStr, StringRef CPU, StringRef FS) {
     return nullptr;
 
   TargetOptions Options;
-  return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
-      T->createTargetMachine(TStr, CPU, FS, Options, None, None)));
+  return std::unique_ptr<LLVMTargetMachine>(
+      static_cast<LLVMTargetMachine *>(T->createTargetMachine(
+          TStr, CPU, FS, Options, std::nullopt, std::nullopt)));
 }
 
 TEST(AMDGPUDwarfRegMappingTests, TestWave64DwarfRegMapping) {

diff  --git a/llvm/unittests/MC/DwarfLineTableHeaders.cpp b/llvm/unittests/MC/DwarfLineTableHeaders.cpp
index 5b40df41e4291..7dab9df0ef08b 100644
--- a/llvm/unittests/MC/DwarfLineTableHeaders.cpp
+++ b/llvm/unittests/MC/DwarfLineTableHeaders.cpp
@@ -118,10 +118,10 @@ class DwarfLineTableHeaders : public ::testing::Test {
     TheStreamer->switchSection(C.MOFI->getDwarfLineSection());
     MCDwarfLineTableHeader Header;
     MCDwarfLineTableParams Params = Assembler.getDWARFLinetableParams();
-    Optional<MCDwarfLineStr> LineStr(None);
+    Optional<MCDwarfLineStr> LineStr(std::nullopt);
     if (Ctx.getDwarfVersion() >= 5) {
       LineStr.emplace(Ctx);
-      Header.setRootFile("dir", "file", None, None);
+      Header.setRootFile("dir", "file", std::nullopt, std::nullopt);
     }
     MCSymbol *LineEndSym = Header.Emit(TheStreamer, Params, LineStr).second;
 

diff  --git a/llvm/unittests/MC/MCDisassemblerTest.cpp b/llvm/unittests/MC/MCDisassemblerTest.cpp
index 07d13cfa24c4e..252dbc6be5bf5 100644
--- a/llvm/unittests/MC/MCDisassemblerTest.cpp
+++ b/llvm/unittests/MC/MCDisassemblerTest.cpp
@@ -13,8 +13,8 @@ using namespace llvm;
 
 TEST(MCDisassembler, XCOFFSymbolPriorityTest) {
 
-  SymbolInfoTy SIT1(0x100000, "sym1", None, 1, false);
-  SymbolInfoTy SIT2(0x110000, "sym2", None, 2, false);
+  SymbolInfoTy SIT1(0x100000, "sym1", std::nullopt, 1, false);
+  SymbolInfoTy SIT2(0x110000, "sym2", std::nullopt, 2, false);
   SymbolInfoTy SIT3(0x120000, ".func", XCOFF::XMC_PR, 3, true);
   SymbolInfoTy SIT4(0x120000, ".text", XCOFF::XMC_PR, 4, false);
   SymbolInfoTy SIT5(0x130000, "TOC", XCOFF::XMC_TC0, 5, false);

diff  --git a/llvm/unittests/MI/LiveIntervalTest.cpp b/llvm/unittests/MI/LiveIntervalTest.cpp
index 31e668a11080a..14c17bca7a166 100644
--- a/llvm/unittests/MI/LiveIntervalTest.cpp
+++ b/llvm/unittests/MI/LiveIntervalTest.cpp
@@ -44,9 +44,9 @@ std::unique_ptr<LLVMTargetMachine> createTargetMachine() {
     return nullptr;
 
   TargetOptions Options;
-  return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine*>(
-      T->createTargetMachine("AMDGPU", "gfx900", "", Options, None, None,
-                             CodeGenOpt::Aggressive)));
+  return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+      T->createTargetMachine("AMDGPU", "gfx900", "", Options, std::nullopt,
+                             std::nullopt, CodeGenOpt::Aggressive)));
 }
 
 std::unique_ptr<Module> parseMIR(LLVMContext &Context,

diff  --git a/llvm/unittests/MIR/MachineMetadata.cpp b/llvm/unittests/MIR/MachineMetadata.cpp
index 39d10dddb764e..f192b942190cf 100644
--- a/llvm/unittests/MIR/MachineMetadata.cpp
+++ b/llvm/unittests/MIR/MachineMetadata.cpp
@@ -72,8 +72,9 @@ class MachineMetadataTest : public testing::Test {
     if (!T)
       return nullptr;
     TargetOptions Options;
-    return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
-        T->createTargetMachine(TT, CPU, FS, Options, None, None)));
+    return std::unique_ptr<LLVMTargetMachine>(
+        static_cast<LLVMTargetMachine *>(T->createTargetMachine(
+            TT, CPU, FS, Options, std::nullopt, std::nullopt)));
   }
 
   std::unique_ptr<Module> parseMIR(const TargetMachine &TM, StringRef MIRCode,

diff  --git a/llvm/unittests/Object/ELFObjectFileTest.cpp b/llvm/unittests/Object/ELFObjectFileTest.cpp
index 877a140f969a7..2c8585bf558fb 100644
--- a/llvm/unittests/Object/ELFObjectFileTest.cpp
+++ b/llvm/unittests/Object/ELFObjectFileTest.cpp
@@ -703,7 +703,8 @@ TEST(ELFObjectFileTest, ReadBBAddrMap) {
   };
 
   // Check that we can retrieve the data in the normal case.
-  DoCheckSucceeds(CommonYamlString, /*TextSectionIndex=*/None, AllBBAddrMaps);
+  DoCheckSucceeds(CommonYamlString, /*TextSectionIndex=*/std::nullopt,
+                  AllBBAddrMaps);
   DoCheckSucceeds(CommonYamlString, /*TextSectionIndex=*/0, Section0BBAddrMaps);
   DoCheckSucceeds(CommonYamlString, /*TextSectionIndex=*/1, Section1BBAddrMaps);
   // Check that when no bb-address-map section is found for a text section,
@@ -723,7 +724,7 @@ TEST(ELFObjectFileTest, ReadBBAddrMap) {
                "index: 10");
   // Linked sections are not checked when we don't target a specific text
   // section.
-  DoCheckSucceeds(InvalidLinkedYamlString, /*TextSectionIndex=*/None,
+  DoCheckSucceeds(InvalidLinkedYamlString, /*TextSectionIndex=*/std::nullopt,
                   AllBBAddrMaps);
 
   // Check that we can detect when bb-address-map decoding fails.
@@ -732,7 +733,7 @@ TEST(ELFObjectFileTest, ReadBBAddrMap) {
     ShSize: 0x8
 )";
 
-  DoCheckFails(TruncatedYamlString, /*TextSectionIndex=*/None,
+  DoCheckFails(TruncatedYamlString, /*TextSectionIndex=*/std::nullopt,
                "unable to read SHT_LLVM_BB_ADDR_MAP_V0 section with index 3: "
                "unable to decode LEB128 at offset 0x00000008: malformed "
                "uleb128, extends past end");

diff  --git a/llvm/unittests/Object/MinidumpTest.cpp b/llvm/unittests/Object/MinidumpTest.cpp
index 85ffa79c46dfb..d2d9f115bb94a 100644
--- a/llvm/unittests/Object/MinidumpTest.cpp
+++ b/llvm/unittests/Object/MinidumpTest.cpp
@@ -200,7 +200,7 @@ TEST(MinidumpFile, IngoresDummyStreams) {
   ASSERT_EQ(2u, File.streams().size());
   EXPECT_EQ(StreamType::Unused, File.streams()[0].Type);
   EXPECT_EQ(StreamType::Unused, File.streams()[1].Type);
-  EXPECT_EQ(None, File.getRawStream(StreamType::Unused));
+  EXPECT_EQ(std::nullopt, File.getRawStream(StreamType::Unused));
 }
 
 TEST(MinidumpFile, getSystemInfo) {

diff  --git a/llvm/unittests/Remarks/BitstreamRemarksSerializerTest.cpp b/llvm/unittests/Remarks/BitstreamRemarksSerializerTest.cpp
index 81bd30ca5225f..50c50ecf027a7 100644
--- a/llvm/unittests/Remarks/BitstreamRemarksSerializerTest.cpp
+++ b/llvm/unittests/Remarks/BitstreamRemarksSerializerTest.cpp
@@ -67,15 +67,16 @@ static void check(remarks::SerializerMode Mode, const remarks::Remark &R,
 
 static void check(const remarks::Remark &R, StringRef ExpectedR,
                   StringRef ExpectedMeta,
-                  Optional<remarks::StringTable> StrTab = None) {
+                  Optional<remarks::StringTable> StrTab = std::nullopt) {
   return check(remarks::SerializerMode::Separate, R, ExpectedR, ExpectedMeta,
                std::move(StrTab));
 }
 
-static void checkStandalone(const remarks::Remark &R, StringRef ExpectedR,
-                            Optional<remarks::StringTable> StrTab = None) {
+static void
+checkStandalone(const remarks::Remark &R, StringRef ExpectedR,
+                Optional<remarks::StringTable> StrTab = std::nullopt) {
   return check(remarks::SerializerMode::Standalone, R, ExpectedR,
-               /*ExpectedMeta=*/None, std::move(StrTab));
+               /*ExpectedMeta=*/std::nullopt, std::move(StrTab));
 }
 
 TEST(BitstreamRemarkSerializer, SeparateRemarkFileNoOptionals) {

diff  --git a/llvm/unittests/Remarks/YAMLRemarksParsingTest.cpp b/llvm/unittests/Remarks/YAMLRemarksParsingTest.cpp
index f20cdb5e6bbb4..2741a79a2c8e7 100644
--- a/llvm/unittests/Remarks/YAMLRemarksParsingTest.cpp
+++ b/llvm/unittests/Remarks/YAMLRemarksParsingTest.cpp
@@ -68,14 +68,15 @@ enum class CmpType {
   Contains
 };
 
-void parseExpectErrorMeta(StringRef Buf, const char *Error, CmpType Cmp,
-                          Optional<StringRef> ExternalFilePrependPath = None) {
+void parseExpectErrorMeta(
+    StringRef Buf, const char *Error, CmpType Cmp,
+    Optional<StringRef> ExternalFilePrependPath = std::nullopt) {
   std::string ErrorStr;
   raw_string_ostream Stream(ErrorStr);
 
   Expected<std::unique_ptr<remarks::RemarkParser>> MaybeParser =
       remarks::createRemarkParserFromMeta(remarks::Format::YAML, Buf,
-                                          /*StrTab=*/None,
+                                          /*StrTab=*/std::nullopt,
                                           std::move(ExternalFilePrependPath));
   handleAllErrors(MaybeParser.takeError(),
                   [&](const ErrorInfoBase &EIB) { EIB.log(Stream); });

diff  --git a/llvm/unittests/Remarks/YAMLRemarksSerializerTest.cpp b/llvm/unittests/Remarks/YAMLRemarksSerializerTest.cpp
index 0ebb47809f562..6ad665b2d09cb 100644
--- a/llvm/unittests/Remarks/YAMLRemarksSerializerTest.cpp
+++ b/llvm/unittests/Remarks/YAMLRemarksSerializerTest.cpp
@@ -25,7 +25,7 @@ using namespace llvm;
 static void check(remarks::Format SerializerFormat,
                   remarks::SerializerMode Mode, ArrayRef<remarks::Remark> Rs,
                   StringRef ExpectedR, Optional<StringRef> ExpectedMeta,
-                  Optional<remarks::StringTable> StrTab = None) {
+                  Optional<remarks::StringTable> StrTab = std::nullopt) {
   std::string Buf;
   raw_string_ostream OS(Buf);
   Expected<std::unique_ptr<remarks::RemarkSerializer>> MaybeS = [&] {
@@ -53,18 +53,19 @@ static void check(remarks::Format SerializerFormat,
 
 static void check(remarks::Format SerializerFormat, const remarks::Remark &R,
                   StringRef ExpectedR, StringRef ExpectedMeta,
-                  Optional<remarks::StringTable> StrTab = None) {
+                  Optional<remarks::StringTable> StrTab = std::nullopt) {
   return check(SerializerFormat, remarks::SerializerMode::Separate,
                makeArrayRef(&R, &R + 1), ExpectedR, ExpectedMeta,
                std::move(StrTab));
 }
 
-static void checkStandalone(remarks::Format SerializerFormat,
-                            const remarks::Remark &R, StringRef ExpectedR,
-                            Optional<remarks::StringTable> StrTab = None) {
+static void
+checkStandalone(remarks::Format SerializerFormat, const remarks::Remark &R,
+                StringRef ExpectedR,
+                Optional<remarks::StringTable> StrTab = std::nullopt) {
   return check(SerializerFormat, remarks::SerializerMode::Standalone,
                makeArrayRef(&R, &R + 1), ExpectedR,
-               /*ExpectedMeta=*/None, std::move(StrTab));
+               /*ExpectedMeta=*/std::nullopt, std::move(StrTab));
 }
 
 TEST(YAMLRemarks, SerializerRemark) {
@@ -325,5 +326,5 @@ TEST(YAMLRemarks, SerializerRemarkParsedStrTabStandaloneMultipleRemarks) {
                   "    DebugLoc:        { File: 6, Line: 6, Column: 7 }\n"
                   "...\n",
                   561),
-        /*ExpectedMeta=*/None, std::move(PreFilledStrTab));
+        /*ExpectedMeta=*/std::nullopt, std::move(PreFilledStrTab));
 }

diff  --git a/llvm/unittests/Support/CheckedArithmeticTest.cpp b/llvm/unittests/Support/CheckedArithmeticTest.cpp
index 18eee4c447e41..eae54eb1c0cba 100644
--- a/llvm/unittests/Support/CheckedArithmeticTest.cpp
+++ b/llvm/unittests/Support/CheckedArithmeticTest.cpp
@@ -8,75 +8,75 @@ namespace {
 TEST(CheckedArithmetic, CheckedAdd) {
   const int64_t Max = std::numeric_limits<int64_t>::max();
   const int64_t Min = std::numeric_limits<int64_t>::min();
-  EXPECT_EQ(checkedAdd<int64_t>(Max, Max), None);
-  EXPECT_EQ(checkedAdd<int64_t>(Min, -1), None);
-  EXPECT_EQ(checkedAdd<int64_t>(Max, 1), None);
+  EXPECT_EQ(checkedAdd<int64_t>(Max, Max), std::nullopt);
+  EXPECT_EQ(checkedAdd<int64_t>(Min, -1), std::nullopt);
+  EXPECT_EQ(checkedAdd<int64_t>(Max, 1), std::nullopt);
   EXPECT_EQ(checkedAdd<int64_t>(10, 1), Optional<int64_t>(11));
 }
 
 TEST(CheckedArithmetic, CheckedAddSmall) {
   const int16_t Max = std::numeric_limits<int16_t>::max();
   const int16_t Min = std::numeric_limits<int16_t>::min();
-  EXPECT_EQ(checkedAdd<int16_t>(Max, Max), None);
-  EXPECT_EQ(checkedAdd<int16_t>(Min, -1), None);
-  EXPECT_EQ(checkedAdd<int16_t>(Max, 1), None);
+  EXPECT_EQ(checkedAdd<int16_t>(Max, Max), std::nullopt);
+  EXPECT_EQ(checkedAdd<int16_t>(Min, -1), std::nullopt);
+  EXPECT_EQ(checkedAdd<int16_t>(Max, 1), std::nullopt);
   EXPECT_EQ(checkedAdd<int16_t>(10, 1), Optional<int64_t>(11));
 }
 
 TEST(CheckedArithmetic, CheckedMul) {
   const int64_t Max = std::numeric_limits<int64_t>::max();
   const int64_t Min = std::numeric_limits<int64_t>::min();
-  EXPECT_EQ(checkedMul<int64_t>(Max, 2), None);
-  EXPECT_EQ(checkedMul<int64_t>(Max, Max), None);
-  EXPECT_EQ(checkedMul<int64_t>(Min, 2), None);
+  EXPECT_EQ(checkedMul<int64_t>(Max, 2), std::nullopt);
+  EXPECT_EQ(checkedMul<int64_t>(Max, Max), std::nullopt);
+  EXPECT_EQ(checkedMul<int64_t>(Min, 2), std::nullopt);
   EXPECT_EQ(checkedMul<int64_t>(10, 2), Optional<int64_t>(20));
 }
 
 TEST(CheckedArithmetic, CheckedMulAdd) {
   const int64_t Max = std::numeric_limits<int64_t>::max();
   const int64_t Min = std::numeric_limits<int64_t>::min();
-  EXPECT_EQ(checkedMulAdd<int64_t>(Max, 1, 2), None);
-  EXPECT_EQ(checkedMulAdd<int64_t>(1, 1, Max), None);
-  EXPECT_EQ(checkedMulAdd<int64_t>(1, -1, Min), None);
+  EXPECT_EQ(checkedMulAdd<int64_t>(Max, 1, 2), std::nullopt);
+  EXPECT_EQ(checkedMulAdd<int64_t>(1, 1, Max), std::nullopt);
+  EXPECT_EQ(checkedMulAdd<int64_t>(1, -1, Min), std::nullopt);
   EXPECT_EQ(checkedMulAdd<int64_t>(10, 2, 3), Optional<int64_t>(23));
 }
 
 TEST(CheckedArithmetic, CheckedMulSmall) {
   const int16_t Max = std::numeric_limits<int16_t>::max();
   const int16_t Min = std::numeric_limits<int16_t>::min();
-  EXPECT_EQ(checkedMul<int16_t>(Max, 2), None);
-  EXPECT_EQ(checkedMul<int16_t>(Max, Max), None);
-  EXPECT_EQ(checkedMul<int16_t>(Min, 2), None);
+  EXPECT_EQ(checkedMul<int16_t>(Max, 2), std::nullopt);
+  EXPECT_EQ(checkedMul<int16_t>(Max, Max), std::nullopt);
+  EXPECT_EQ(checkedMul<int16_t>(Min, 2), std::nullopt);
   EXPECT_EQ(checkedMul<int16_t>(10, 2), Optional<int16_t>(20));
 }
 
 TEST(CheckedArithmetic, CheckedMulAddSmall) {
   const int16_t Max = std::numeric_limits<int16_t>::max();
   const int16_t Min = std::numeric_limits<int16_t>::min();
-  EXPECT_EQ(checkedMulAdd<int16_t>(Max, 1, 2), None);
-  EXPECT_EQ(checkedMulAdd<int16_t>(1, 1, Max), None);
-  EXPECT_EQ(checkedMulAdd<int16_t>(1, -1, Min), None);
+  EXPECT_EQ(checkedMulAdd<int16_t>(Max, 1, 2), std::nullopt);
+  EXPECT_EQ(checkedMulAdd<int16_t>(1, 1, Max), std::nullopt);
+  EXPECT_EQ(checkedMulAdd<int16_t>(1, -1, Min), std::nullopt);
   EXPECT_EQ(checkedMulAdd<int16_t>(10, 2, 3), Optional<int16_t>(23));
 }
 
 TEST(CheckedArithmetic, CheckedAddUnsigned) {
   const uint64_t Max = std::numeric_limits<uint64_t>::max();
-  EXPECT_EQ(checkedAddUnsigned<uint64_t>(Max, Max), None);
-  EXPECT_EQ(checkedAddUnsigned<uint64_t>(Max, 1), None);
+  EXPECT_EQ(checkedAddUnsigned<uint64_t>(Max, Max), std::nullopt);
+  EXPECT_EQ(checkedAddUnsigned<uint64_t>(Max, 1), std::nullopt);
   EXPECT_EQ(checkedAddUnsigned<uint64_t>(10, 1), Optional<uint64_t>(11));
 }
 
 TEST(CheckedArithmetic, CheckedMulUnsigned) {
   const uint64_t Max = std::numeric_limits<uint64_t>::max();
-  EXPECT_EQ(checkedMulUnsigned<uint64_t>(Max, 2), llvm::None);
-  EXPECT_EQ(checkedMulUnsigned<uint64_t>(Max, Max), llvm::None);
+  EXPECT_EQ(checkedMulUnsigned<uint64_t>(Max, 2), std::nullopt);
+  EXPECT_EQ(checkedMulUnsigned<uint64_t>(Max, Max), std::nullopt);
   EXPECT_EQ(checkedMulUnsigned<uint64_t>(10, 2), Optional<uint64_t>(20));
 }
 
 TEST(CheckedArithmetic, CheckedMulAddUnsigned) {
   const uint64_t Max = std::numeric_limits<uint64_t>::max();
-  EXPECT_EQ(checkedMulAddUnsigned<uint64_t>(Max, 1, 2), None);
-  EXPECT_EQ(checkedMulAddUnsigned<uint64_t>(1, 1, Max), None);
+  EXPECT_EQ(checkedMulAddUnsigned<uint64_t>(Max, 1, 2), std::nullopt);
+  EXPECT_EQ(checkedMulAddUnsigned<uint64_t>(1, 1, Max), std::nullopt);
   EXPECT_EQ(checkedMulAddUnsigned<uint64_t>(10, 2, 3), Optional<uint64_t>(23));
 }
 

diff  --git a/llvm/unittests/Support/ConvertUTFTest.cpp b/llvm/unittests/Support/ConvertUTFTest.cpp
index 5f2cff8c30207..8f172b79d05d5 100644
--- a/llvm/unittests/Support/ConvertUTFTest.cpp
+++ b/llvm/unittests/Support/ConvertUTFTest.cpp
@@ -81,7 +81,8 @@ TEST(ConvertUTFTest, OddLengthInput) {
 
 TEST(ConvertUTFTest, Empty) {
   std::string Result;
-  bool Success = convertUTF16ToUTF8String(llvm::ArrayRef<char>(None), Result);
+  bool Success =
+      convertUTF16ToUTF8String(llvm::ArrayRef<char>(std::nullopt), Result);
   EXPECT_TRUE(Success);
   EXPECT_TRUE(Result.empty());
 }
@@ -96,7 +97,7 @@ TEST(ConvertUTFTest, HasUTF16BOM) {
   HasBOM = hasUTF16ByteOrderMark(makeArrayRef("\xfe\xff\x00asdf", 6));
   EXPECT_TRUE(HasBOM);
 
-  HasBOM = hasUTF16ByteOrderMark(None);
+  HasBOM = hasUTF16ByteOrderMark(std::nullopt);
   EXPECT_FALSE(HasBOM);
   HasBOM = hasUTF16ByteOrderMark(makeArrayRef("\xfe", 1));
   EXPECT_FALSE(HasBOM);

diff  --git a/llvm/unittests/Support/ErrorTest.cpp b/llvm/unittests/Support/ErrorTest.cpp
index 57dda997db401..16118a9660152 100644
--- a/llvm/unittests/Support/ErrorTest.cpp
+++ b/llvm/unittests/Support/ErrorTest.cpp
@@ -1097,7 +1097,7 @@ TEST(Error, moveInto) {
 
     // Failure with no prior value.
     EXPECT_THAT_ERROR(makeFailure().moveInto(V), Failed());
-    EXPECT_EQ(None, V.Box);
+    EXPECT_EQ(std::nullopt, V.Box);
 
     // Success with no prior value.
     EXPECT_THAT_ERROR(make(5).moveInto(V), Succeeded());
@@ -1119,7 +1119,7 @@ TEST(Error, moveInto) {
     // Same cases as above.
     Optional<MoveOnlyBox> MaybeV;
     EXPECT_THAT_ERROR(makeFailure().moveInto(MaybeV), Failed());
-    EXPECT_EQ(None, MaybeV);
+    EXPECT_EQ(std::nullopt, MaybeV);
 
     EXPECT_THAT_ERROR(make(5).moveInto(MaybeV), Succeeded());
     EXPECT_EQ(MoveOnlyBox(5), MaybeV);

diff  --git a/llvm/unittests/Support/Host.cpp b/llvm/unittests/Support/Host.cpp
index 21f2e3b7a56bc..e4796c2e211a2 100644
--- a/llvm/unittests/Support/Host.cpp
+++ b/llvm/unittests/Support/Host.cpp
@@ -388,8 +388,9 @@ static bool runAndGetCommandOutput(
     StringRef OutputPath = OutputFile.str();
 
     const std::optional<StringRef> Redirects[] = {
-        /*STDIN=*/None, /*STDOUT=*/OutputPath, /*STDERR=*/None};
-    int RetCode = ExecuteAndWait(ExePath, argv, /*env=*/llvm::None, Redirects);
+        /*STDIN=*/std::nullopt, /*STDOUT=*/OutputPath, /*STDERR=*/std::nullopt};
+    int RetCode =
+        ExecuteAndWait(ExePath, argv, /*env=*/std::nullopt, Redirects);
     ASSERT_EQ(0, RetCode);
 
     int FD = 0;

diff  --git a/llvm/unittests/Support/InstructionCostTest.cpp b/llvm/unittests/Support/InstructionCostTest.cpp
index e31bf34233a23..2f634110bd513 100644
--- a/llvm/unittests/Support/InstructionCostTest.cpp
+++ b/llvm/unittests/Support/InstructionCostTest.cpp
@@ -72,7 +72,7 @@ TEST_F(CostTest, Operators) {
 
   // Test value extraction
   EXPECT_EQ(*(VThree.getValue()), 3);
-  EXPECT_EQ(IThreeA.getValue(), None);
+  EXPECT_EQ(IThreeA.getValue(), std::nullopt);
 
   EXPECT_EQ(std::min(VThree, VNegTwo), -2);
   EXPECT_EQ(std::max(VThree, VSix), 6);

diff  --git a/llvm/unittests/Support/JSONTest.cpp b/llvm/unittests/Support/JSONTest.cpp
index 8d90a70cc99d0..bbd69f51112a4 100644
--- a/llvm/unittests/Support/JSONTest.cpp
+++ b/llvm/unittests/Support/JSONTest.cpp
@@ -49,7 +49,7 @@ TEST(JSONTest, Constructors) {
   EXPECT_EQ("null", s(llvm::Optional<double>()));
   EXPECT_EQ("2.5", s(llvm::Optional<double>(2.5)));
   EXPECT_EQ("[[2.5,null]]", s(std::vector<std::vector<llvm::Optional<double>>>{
-                                 {2.5, llvm::None}}));
+                                {2.5, std::nullopt}}));
 }
 
 TEST(JSONTest, StringOwnership) {
@@ -301,49 +301,49 @@ TEST(JSONTest, Integers) {
     llvm::Optional<int64_t> AsInt;
     llvm::Optional<double> AsNumber;
   } TestCases[] = {
-      {
-          "Non-integer. Stored as double, not convertible.",
-          double{1.5},
-          "1.5",
-          llvm::None,
-          1.5,
-      },
+    {
+        "Non-integer. Stored as double, not convertible.",
+        double{1.5},
+        "1.5",
+        std::nullopt,
+        1.5,
+    },
 
-      {
-          "Integer, not exact double. Stored as int64, convertible.",
-          int64_t{0x4000000000000001},
-          "4611686018427387905",
-          int64_t{0x4000000000000001},
-          double{0x4000000000000000},
-      },
+    {
+        "Integer, not exact double. Stored as int64, convertible.",
+        int64_t{0x4000000000000001},
+        "4611686018427387905",
+        int64_t{0x4000000000000001},
+        double{0x4000000000000000},
+    },
 
-      {
-          "Negative integer, not exact double. Stored as int64, convertible.",
-          int64_t{-0x4000000000000001},
-          "-4611686018427387905",
-          int64_t{-0x4000000000000001},
-          double{-0x4000000000000000},
-      },
+    {
+        "Negative integer, not exact double. Stored as int64, convertible.",
+        int64_t{-0x4000000000000001},
+        "-4611686018427387905",
+        int64_t{-0x4000000000000001},
+        double{-0x4000000000000000},
+    },
 
       // PR46470,
       // https://developercommunity.visualstudio.com/content/problem/1093399/incorrect-result-when-printing-6917529027641081856.html
 #if !defined(_MSC_VER) || _MSC_VER < 1926
-      {
-          "Dynamically exact integer. Stored as double, convertible.",
-          double{0x6000000000000000},
-          "6.9175290276410819e+18",
-          int64_t{0x6000000000000000},
-          double{0x6000000000000000},
-      },
+    {
+        "Dynamically exact integer. Stored as double, convertible.",
+        double{0x6000000000000000},
+        "6.9175290276410819e+18",
+        int64_t{0x6000000000000000},
+        double{0x6000000000000000},
+    },
 #endif
 
-      {
-          "Dynamically integer, >64 bits. Stored as double, not convertible.",
-          1.5 * double{0x8000000000000000},
-          "1.3835058055282164e+19",
-          llvm::None,
-          1.5 * double{0x8000000000000000},
-      },
+    {
+        "Dynamically integer, >64 bits. Stored as double, not convertible.",
+        1.5 * double{0x8000000000000000},
+        "1.3835058055282164e+19",
+        std::nullopt,
+        1.5 * double{0x8000000000000000},
+    },
   };
   for (const auto &T : TestCases) {
     EXPECT_EQ(T.Str, s(T.Val)) << T.Desc;
@@ -382,7 +382,7 @@ TEST(JSONTest, U64Integers) {
 
     EXPECT_TRUE(!!Doc);
     EXPECT_EQ(Doc->getAsInteger(), int64_t{-78278238238328222});
-    EXPECT_EQ(Doc->getAsUINT64(), llvm::None);
+    EXPECT_EQ(Doc->getAsUINT64(), std::nullopt);
   }
 
   // Test with the largest 64 signed int.
@@ -401,7 +401,7 @@ TEST(JSONTest, U64Integers) {
     llvm::Expected<Value> Doc = parse(Str);
 
     EXPECT_TRUE(!!Doc);
-    EXPECT_EQ(Doc->getAsInteger(), None);
+    EXPECT_EQ(Doc->getAsInteger(), std::nullopt);
     EXPECT_EQ(Doc->getAsUINT64(), uint64_t{18446744073709551615u});
   }
 
@@ -411,8 +411,8 @@ TEST(JSONTest, U64Integers) {
     llvm::Expected<Value> Doc = parse(Str);
 
     EXPECT_TRUE(!!Doc);
-    EXPECT_EQ(Doc->getAsInteger(), None);
-    EXPECT_EQ(Doc->getAsUINT64(), None);
+    EXPECT_EQ(Doc->getAsInteger(), std::nullopt);
+    EXPECT_EQ(Doc->getAsUINT64(), std::nullopt);
     // The number was parsed as a double.
     EXPECT_TRUE(!!Doc->getAsNumber());
   }
@@ -423,8 +423,8 @@ TEST(JSONTest, U64Integers) {
     llvm::Expected<Value> Doc = parse(Str);
 
     EXPECT_TRUE(!!Doc);
-    EXPECT_EQ(Doc->getAsInteger(), None);
-    EXPECT_EQ(Doc->getAsUINT64(), None);
+    EXPECT_EQ(Doc->getAsInteger(), std::nullopt);
+    EXPECT_EQ(Doc->getAsUINT64(), std::nullopt);
     // The number was parsed as a double.
     EXPECT_TRUE(!!Doc->getAsNumber());
   }
@@ -483,7 +483,7 @@ TEST(JSONTest, Deserialize) {
                            }}};
   Expected["foo"] = {
       CustomStruct("foo", 42, true),
-      CustomStruct("bar", llvm::None, false),
+      CustomStruct("bar", std::nullopt, false),
   };
   Path::Root Root("CustomStruct");
   ASSERT_TRUE(fromJSON(J, R, Root));

diff  --git a/llvm/unittests/Support/MatchersTest.cpp b/llvm/unittests/Support/MatchersTest.cpp
index 3248686fba936..d07e82d9851be 100644
--- a/llvm/unittests/Support/MatchersTest.cpp
+++ b/llvm/unittests/Support/MatchersTest.cpp
@@ -18,7 +18,7 @@ using ::testing::Not;
 
 namespace {
 TEST(MatchersTest, Optional) {
-  EXPECT_THAT(llvm::Optional<int>(llvm::None), Not(llvm::ValueIs(_)));
+  EXPECT_THAT(llvm::Optional<int>(std::nullopt), Not(llvm::ValueIs(_)));
   EXPECT_THAT(llvm::Optional<int>(10), llvm::ValueIs(10));
   EXPECT_THAT(llvm::Optional<int>(10), llvm::ValueIs(AllOf(Lt(11), Gt(9))));
 }

diff  --git a/llvm/unittests/Support/NativeFormatTests.cpp b/llvm/unittests/Support/NativeFormatTests.cpp
index 8ab99ffd66b14..591a68f1380cb 100644
--- a/llvm/unittests/Support/NativeFormatTests.cpp
+++ b/llvm/unittests/Support/NativeFormatTests.cpp
@@ -26,7 +26,7 @@ template <typename T> std::string format_number(T N, IntegerStyle Style) {
 }
 
 std::string format_number(uint64_t N, HexPrintStyle Style,
-                          Optional<size_t> Width = None) {
+                          Optional<size_t> Width = std::nullopt) {
   std::string S;
   llvm::raw_string_ostream Str(S);
   write_hex(Str, N, Style, Width);
@@ -35,7 +35,7 @@ std::string format_number(uint64_t N, HexPrintStyle Style,
 }
 
 std::string format_number(double D, FloatStyle Style,
-                          Optional<size_t> Precision = None) {
+                          Optional<size_t> Precision = std::nullopt) {
   std::string S;
   llvm::raw_string_ostream Str(S);
   write_double(Str, D, Style, Precision);

diff  --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp
index 3b8ffd8fee94a..d649debeed421 100644
--- a/llvm/unittests/Support/Path.cpp
+++ b/llvm/unittests/Support/Path.cpp
@@ -1994,7 +1994,7 @@ TEST_F(FileSystemTest, readNativeFileToEOF) {
         static_cast<SmallVectorImpl<char> *>(&StaysSmall),
     };
     for (SmallVectorImpl<char> *V : Vectors) {
-      ASSERT_THAT_ERROR(Read(*V, None), Succeeded());
+      ASSERT_THAT_ERROR(Read(*V, std::nullopt), Succeeded());
       ASSERT_EQ(Content, StringRef(V->begin(), V->size()));
     }
     ASSERT_EQ(fs::DefaultReadChunkSize + Content.size(), StaysSmall.capacity());
@@ -2004,7 +2004,7 @@ TEST_F(FileSystemTest, readNativeFileToEOF) {
       constexpr StringLiteral Prefix = "prefix-";
       for (SmallVectorImpl<char> *V : Vectors) {
         V->assign(Prefix.begin(), Prefix.end());
-        ASSERT_THAT_ERROR(Read(*V, None), Succeeded());
+        ASSERT_THAT_ERROR(Read(*V, std::nullopt), Succeeded());
         ASSERT_EQ((Prefix + Content).str(), StringRef(V->begin(), V->size()));
       }
     }

diff  --git a/llvm/unittests/Support/ProgramTest.cpp b/llvm/unittests/Support/ProgramTest.cpp
index 54ad9be41823a..2134b969466a1 100644
--- a/llvm/unittests/Support/ProgramTest.cpp
+++ b/llvm/unittests/Support/ProgramTest.cpp
@@ -195,7 +195,7 @@ TEST_F(ProgramEnvTest, CreateProcessTrailingSlash) {
 #else
   StringRef nul("/dev/null");
 #endif
-  std::optional<StringRef> redirects[] = {nul, nul, None};
+  std::optional<StringRef> redirects[] = {nul, nul, std::nullopt};
   int rc = ExecuteAndWait(my_exe, argv, getEnviron(), redirects,
                           /*secondsToWait=*/ 10, /*memoryLimit=*/ 0, &error,
                           &ExecutionFailed);
@@ -289,8 +289,8 @@ TEST(ProgramTest, TestExecuteNegative) {
   {
     std::string Error;
     bool ExecutionFailed;
-    int RetCode = ExecuteAndWait(Executable, argv, llvm::None, {}, 0, 0, &Error,
-                                 &ExecutionFailed);
+    int RetCode = ExecuteAndWait(Executable, argv, std::nullopt, {}, 0, 0,
+                                 &Error, &ExecutionFailed);
     ASSERT_LT(RetCode, 0) << "On error ExecuteAndWait should return 0 or "
                              "positive value indicating the result code";
     ASSERT_TRUE(ExecutionFailed);
@@ -300,8 +300,8 @@ TEST(ProgramTest, TestExecuteNegative) {
   {
     std::string Error;
     bool ExecutionFailed;
-    ProcessInfo PI = ExecuteNoWait(Executable, argv, llvm::None, {}, 0, &Error,
-                                   &ExecutionFailed);
+    ProcessInfo PI = ExecuteNoWait(Executable, argv, std::nullopt, {}, 0,
+                                   &Error, &ExecutionFailed);
     ASSERT_EQ(PI.Pid, ProcessInfo::InvalidPid)
         << "On error ExecuteNoWait should return an invalid ProcessInfo";
     ASSERT_TRUE(ExecutionFailed);

diff  --git a/llvm/unittests/Support/SourceMgrTest.cpp b/llvm/unittests/Support/SourceMgrTest.cpp
index a3079a403a10a..1cce649b6154c 100644
--- a/llvm/unittests/Support/SourceMgrTest.cpp
+++ b/llvm/unittests/Support/SourceMgrTest.cpp
@@ -48,7 +48,8 @@ class SourceMgrTest : public testing::Test {
 
 TEST_F(SourceMgrTest, BasicError) {
   setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
-  printMessage(getLoc(4), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(4), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
 
   EXPECT_EQ("file.in:1:5: error: message\n"
             "aaa bbb\n"
@@ -58,7 +59,8 @@ TEST_F(SourceMgrTest, BasicError) {
 
 TEST_F(SourceMgrTest, BasicWarning) {
   setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
-  printMessage(getLoc(4), SourceMgr::DK_Warning, "message", None, None);
+  printMessage(getLoc(4), SourceMgr::DK_Warning, "message", std::nullopt,
+               std::nullopt);
 
   EXPECT_EQ("file.in:1:5: warning: message\n"
             "aaa bbb\n"
@@ -68,7 +70,8 @@ TEST_F(SourceMgrTest, BasicWarning) {
 
 TEST_F(SourceMgrTest, BasicRemark) {
   setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
-  printMessage(getLoc(4), SourceMgr::DK_Remark, "message", None, None);
+  printMessage(getLoc(4), SourceMgr::DK_Remark, "message", std::nullopt,
+               std::nullopt);
 
   EXPECT_EQ("file.in:1:5: remark: message\n"
             "aaa bbb\n"
@@ -78,7 +81,8 @@ TEST_F(SourceMgrTest, BasicRemark) {
 
 TEST_F(SourceMgrTest, BasicNote) {
   setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
-  printMessage(getLoc(4), SourceMgr::DK_Note, "message", None, None);
+  printMessage(getLoc(4), SourceMgr::DK_Note, "message", std::nullopt,
+               std::nullopt);
 
   EXPECT_EQ("file.in:1:5: note: message\n"
             "aaa bbb\n"
@@ -88,7 +92,8 @@ TEST_F(SourceMgrTest, BasicNote) {
 
 TEST_F(SourceMgrTest, LocationAtEndOfLine) {
   setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
-  printMessage(getLoc(6), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(6), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
 
   EXPECT_EQ("file.in:1:7: error: message\n"
             "aaa bbb\n"
@@ -98,7 +103,8 @@ TEST_F(SourceMgrTest, LocationAtEndOfLine) {
 
 TEST_F(SourceMgrTest, LocationAtNewline) {
   setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
-  printMessage(getLoc(7), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(7), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
 
   EXPECT_EQ("file.in:1:8: error: message\n"
             "aaa bbb\n"
@@ -108,7 +114,8 @@ TEST_F(SourceMgrTest, LocationAtNewline) {
 
 TEST_F(SourceMgrTest, LocationAtEmptyBuffer) {
   setMainBuffer("", "file.in");
-  printMessage(getLoc(0), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(0), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
 
   EXPECT_EQ("file.in:1:1: error: message\n"
             "\n"
@@ -118,7 +125,8 @@ TEST_F(SourceMgrTest, LocationAtEmptyBuffer) {
 
 TEST_F(SourceMgrTest, LocationJustOnSoleNewline) {
   setMainBuffer("\n", "file.in");
-  printMessage(getLoc(0), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(0), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
 
   EXPECT_EQ("file.in:1:1: error: message\n"
             "\n"
@@ -128,7 +136,8 @@ TEST_F(SourceMgrTest, LocationJustOnSoleNewline) {
 
 TEST_F(SourceMgrTest, LocationJustAfterSoleNewline) {
   setMainBuffer("\n", "file.in");
-  printMessage(getLoc(1), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(1), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
 
   EXPECT_EQ("file.in:2:1: error: message\n"
             "\n"
@@ -138,7 +147,8 @@ TEST_F(SourceMgrTest, LocationJustAfterSoleNewline) {
 
 TEST_F(SourceMgrTest, LocationJustAfterNonNewline) {
   setMainBuffer("123", "file.in");
-  printMessage(getLoc(3), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(3), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
 
   EXPECT_EQ("file.in:1:4: error: message\n"
             "123\n"
@@ -148,7 +158,8 @@ TEST_F(SourceMgrTest, LocationJustAfterNonNewline) {
 
 TEST_F(SourceMgrTest, LocationOnFirstLineOfMultiline) {
   setMainBuffer("1234\n6789\n", "file.in");
-  printMessage(getLoc(3), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(3), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
 
   EXPECT_EQ("file.in:1:4: error: message\n"
             "1234\n"
@@ -158,7 +169,8 @@ TEST_F(SourceMgrTest, LocationOnFirstLineOfMultiline) {
 
 TEST_F(SourceMgrTest, LocationOnEOLOfFirstLineOfMultiline) {
   setMainBuffer("1234\n6789\n", "file.in");
-  printMessage(getLoc(4), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(4), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
 
   EXPECT_EQ("file.in:1:5: error: message\n"
             "1234\n"
@@ -168,7 +180,8 @@ TEST_F(SourceMgrTest, LocationOnEOLOfFirstLineOfMultiline) {
 
 TEST_F(SourceMgrTest, LocationOnSecondLineOfMultiline) {
   setMainBuffer("1234\n6789\n", "file.in");
-  printMessage(getLoc(5), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(5), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
 
   EXPECT_EQ("file.in:2:1: error: message\n"
             "6789\n"
@@ -178,7 +191,8 @@ TEST_F(SourceMgrTest, LocationOnSecondLineOfMultiline) {
 
 TEST_F(SourceMgrTest, LocationOnSecondLineOfMultilineNoSecondEOL) {
   setMainBuffer("1234\n6789", "file.in");
-  printMessage(getLoc(5), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(5), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
 
   EXPECT_EQ("file.in:2:1: error: message\n"
             "6789\n"
@@ -188,7 +202,8 @@ TEST_F(SourceMgrTest, LocationOnSecondLineOfMultilineNoSecondEOL) {
 
 TEST_F(SourceMgrTest, LocationOnEOLOfSecondSecondLineOfMultiline) {
   setMainBuffer("1234\n6789\n", "file.in");
-  printMessage(getLoc(9), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(9), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
 
   EXPECT_EQ("file.in:2:5: error: message\n"
             "6789\n"
@@ -218,7 +233,8 @@ TEST_F(SourceMgrTest, LocationBeforeEndOf255ByteBuffer) {
   setMainBuffer(STRING_LITERAL_253_BYTES   // first 253 bytes
                 "12"                       // + 2 = 255 bytes
                 , "file.in");
-  printMessage(getLoc(253), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(253), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
   EXPECT_EQ("file.in:24:1: error: message\n"
             "12\n"
             "^\n",
@@ -229,7 +245,8 @@ TEST_F(SourceMgrTest, LocationAtEndOf255ByteBuffer) {
   setMainBuffer(STRING_LITERAL_253_BYTES   // first 253 bytes
                 "12"                       // + 2 = 255 bytes
                 , "file.in");
-  printMessage(getLoc(254), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(254), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
   EXPECT_EQ("file.in:24:2: error: message\n"
             "12\n"
             " ^\n",
@@ -240,7 +257,8 @@ TEST_F(SourceMgrTest, LocationPastEndOf255ByteBuffer) {
   setMainBuffer(STRING_LITERAL_253_BYTES   // first 253 bytes
                 "12"                       // + 2 = 255 bytes
                 , "file.in");
-  printMessage(getLoc(255), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(255), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
   EXPECT_EQ("file.in:24:3: error: message\n"
             "12\n"
             "  ^\n",
@@ -251,7 +269,8 @@ TEST_F(SourceMgrTest, LocationBeforeEndOf255ByteBufferEndingInNewline) {
   setMainBuffer(STRING_LITERAL_253_BYTES   // first 253 bytes
                 "1\n"                      // + 2 = 255 bytes
                 , "file.in");
-  printMessage(getLoc(253), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(253), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
   EXPECT_EQ("file.in:24:1: error: message\n"
             "1\n"
             "^\n",
@@ -262,7 +281,8 @@ TEST_F(SourceMgrTest, LocationAtEndOf255ByteBufferEndingInNewline) {
   setMainBuffer(STRING_LITERAL_253_BYTES   // first 253 bytes
                 "1\n"                      // + 2 = 255 bytes
                 , "file.in");
-  printMessage(getLoc(254), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(254), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
   EXPECT_EQ("file.in:24:2: error: message\n"
             "1\n"
             " ^\n",
@@ -273,7 +293,8 @@ TEST_F(SourceMgrTest, LocationPastEndOf255ByteBufferEndingInNewline) {
   setMainBuffer(STRING_LITERAL_253_BYTES   // first 253 bytes
                 "1\n"                      // + 2 = 255 bytes
                 , "file.in");
-  printMessage(getLoc(255), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(255), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
   EXPECT_EQ("file.in:25:1: error: message\n"
             "\n"
             "^\n",
@@ -288,7 +309,8 @@ TEST_F(SourceMgrTest, LocationBeforeEndOf256ByteBuffer) {
   setMainBuffer(STRING_LITERAL_253_BYTES   // first 253 bytes
                 "123"                      // + 3 = 256 bytes
                 , "file.in");
-  printMessage(getLoc(254), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(254), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
   EXPECT_EQ("file.in:24:2: error: message\n"
             "123\n"
             " ^\n",
@@ -299,7 +321,8 @@ TEST_F(SourceMgrTest, LocationAtEndOf256ByteBuffer) {
   setMainBuffer(STRING_LITERAL_253_BYTES   // first 253 bytes
                 "123"                      // + 3 = 256 bytes
                 , "file.in");
-  printMessage(getLoc(255), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(255), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
   EXPECT_EQ("file.in:24:3: error: message\n"
             "123\n"
             "  ^\n",
@@ -310,7 +333,8 @@ TEST_F(SourceMgrTest, LocationPastEndOf256ByteBuffer) {
   setMainBuffer(STRING_LITERAL_253_BYTES   // first 253 bytes
                 "123"                      // + 3 = 256 bytes
                 , "file.in");
-  printMessage(getLoc(256), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(256), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
   EXPECT_EQ("file.in:24:4: error: message\n"
             "123\n"
             "   ^\n",
@@ -321,7 +345,8 @@ TEST_F(SourceMgrTest, LocationBeforeEndOf256ByteBufferEndingInNewline) {
   setMainBuffer(STRING_LITERAL_253_BYTES   // first 253 bytes
                 "12\n"                     // + 3 = 256 bytes
                 , "file.in");
-  printMessage(getLoc(254), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(254), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
   EXPECT_EQ("file.in:24:2: error: message\n"
             "12\n"
             " ^\n",
@@ -332,7 +357,8 @@ TEST_F(SourceMgrTest, LocationAtEndOf256ByteBufferEndingInNewline) {
   setMainBuffer(STRING_LITERAL_253_BYTES   // first 253 bytes
                 "12\n"                     // + 3 = 256 bytes
                 , "file.in");
-  printMessage(getLoc(255), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(255), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
   EXPECT_EQ("file.in:24:3: error: message\n"
             "12\n"
             "  ^\n",
@@ -343,7 +369,8 @@ TEST_F(SourceMgrTest, LocationPastEndOf256ByteBufferEndingInNewline) {
   setMainBuffer(STRING_LITERAL_253_BYTES   // first 253 bytes
                 "12\n"                     // + 3 = 256 bytes
                 , "file.in");
-  printMessage(getLoc(256), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(256), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
   EXPECT_EQ("file.in:25:1: error: message\n"
             "\n"
             "^\n",
@@ -358,7 +385,8 @@ TEST_F(SourceMgrTest, LocationBeforeEndOf257ByteBuffer) {
   setMainBuffer(STRING_LITERAL_253_BYTES   // first 253 bytes
                 "1234"                     // + 4 = 257 bytes
                 , "file.in");
-  printMessage(getLoc(255), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(255), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
   EXPECT_EQ("file.in:24:3: error: message\n"
             "1234\n"
             "  ^\n",
@@ -369,7 +397,8 @@ TEST_F(SourceMgrTest, LocationAtEndOf257ByteBuffer) {
   setMainBuffer(STRING_LITERAL_253_BYTES   // first 253 bytes
                 "1234"                     // + 4 = 257 bytes
                 , "file.in");
-  printMessage(getLoc(256), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(256), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
   EXPECT_EQ("file.in:24:4: error: message\n"
             "1234\n"
             "   ^\n",
@@ -380,7 +409,8 @@ TEST_F(SourceMgrTest, LocationPastEndOf257ByteBuffer) {
   setMainBuffer(STRING_LITERAL_253_BYTES   // first 253 bytes
                 "1234"                     // + 4 = 257 bytes
                 , "file.in");
-  printMessage(getLoc(257), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(257), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
   EXPECT_EQ("file.in:24:5: error: message\n"
             "1234\n"
             "    ^\n",
@@ -391,7 +421,8 @@ TEST_F(SourceMgrTest, LocationBeforeEndOf257ByteBufferEndingInNewline) {
   setMainBuffer(STRING_LITERAL_253_BYTES   // first 253 bytes
                 "123\n"                    // + 4 = 257 bytes
                 , "file.in");
-  printMessage(getLoc(255), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(255), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
   EXPECT_EQ("file.in:24:3: error: message\n"
             "123\n"
             "  ^\n",
@@ -402,7 +433,8 @@ TEST_F(SourceMgrTest, LocationAtEndOf257ByteBufferEndingInNewline) {
   setMainBuffer(STRING_LITERAL_253_BYTES   // first 253 bytes
                 "123\n"                    // + 4 = 257 bytes
                 , "file.in");
-  printMessage(getLoc(256), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(256), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
   EXPECT_EQ("file.in:24:4: error: message\n"
             "123\n"
             "   ^\n",
@@ -413,7 +445,8 @@ TEST_F(SourceMgrTest, LocationPastEndOf257ByteBufferEndingInNewline) {
   setMainBuffer(STRING_LITERAL_253_BYTES   // first 253 bytes
                 "123\n"                    // + 4 = 257 bytes
                 , "file.in");
-  printMessage(getLoc(257), SourceMgr::DK_Error, "message", None, None);
+  printMessage(getLoc(257), SourceMgr::DK_Error, "message", std::nullopt,
+               std::nullopt);
   EXPECT_EQ("file.in:25:1: error: message\n"
             "\n"
             "^\n",
@@ -422,7 +455,8 @@ TEST_F(SourceMgrTest, LocationPastEndOf257ByteBufferEndingInNewline) {
 
 TEST_F(SourceMgrTest, BasicRange) {
   setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
-  printMessage(getLoc(4), SourceMgr::DK_Error, "message", getRange(4, 3), None);
+  printMessage(getLoc(4), SourceMgr::DK_Error, "message", getRange(4, 3),
+               std::nullopt);
 
   EXPECT_EQ("file.in:1:5: error: message\n"
             "aaa bbb\n"
@@ -432,7 +466,8 @@ TEST_F(SourceMgrTest, BasicRange) {
 
 TEST_F(SourceMgrTest, RangeWithTab) {
   setMainBuffer("aaa\tbbb\nccc ddd\n", "file.in");
-  printMessage(getLoc(4), SourceMgr::DK_Error, "message", getRange(3, 3), None);
+  printMessage(getLoc(4), SourceMgr::DK_Error, "message", getRange(3, 3),
+               std::nullopt);
 
   EXPECT_EQ("file.in:1:5: error: message\n"
             "aaa     bbb\n"
@@ -442,7 +477,8 @@ TEST_F(SourceMgrTest, RangeWithTab) {
 
 TEST_F(SourceMgrTest, MultiLineRange) {
   setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
-  printMessage(getLoc(4), SourceMgr::DK_Error, "message", getRange(4, 7), None);
+  printMessage(getLoc(4), SourceMgr::DK_Error, "message", getRange(4, 7),
+               std::nullopt);
 
   EXPECT_EQ("file.in:1:5: error: message\n"
             "aaa bbb\n"
@@ -453,7 +489,7 @@ TEST_F(SourceMgrTest, MultiLineRange) {
 TEST_F(SourceMgrTest, MultipleRanges) {
   setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
   SMRange Ranges[] = { getRange(0, 3), getRange(4, 3) };
-  printMessage(getLoc(4), SourceMgr::DK_Error, "message", Ranges, None);
+  printMessage(getLoc(4), SourceMgr::DK_Error, "message", Ranges, std::nullopt);
 
   EXPECT_EQ("file.in:1:5: error: message\n"
             "aaa bbb\n"
@@ -464,7 +500,7 @@ TEST_F(SourceMgrTest, MultipleRanges) {
 TEST_F(SourceMgrTest, OverlappingRanges) {
   setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
   SMRange Ranges[] = { getRange(0, 3), getRange(2, 4) };
-  printMessage(getLoc(4), SourceMgr::DK_Error, "message", Ranges, None);
+  printMessage(getLoc(4), SourceMgr::DK_Error, "message", Ranges, std::nullopt);
 
   EXPECT_EQ("file.in:1:5: error: message\n"
             "aaa bbb\n"
@@ -474,7 +510,7 @@ TEST_F(SourceMgrTest, OverlappingRanges) {
 
 TEST_F(SourceMgrTest, BasicFixit) {
   setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
-  printMessage(getLoc(4), SourceMgr::DK_Error, "message", None,
+  printMessage(getLoc(4), SourceMgr::DK_Error, "message", std::nullopt,
                makeArrayRef(SMFixIt(getRange(4, 3), "zzz")));
 
   EXPECT_EQ("file.in:1:5: error: message\n"
@@ -486,7 +522,7 @@ TEST_F(SourceMgrTest, BasicFixit) {
 
 TEST_F(SourceMgrTest, FixitForTab) {
   setMainBuffer("aaa\tbbb\nccc ddd\n", "file.in");
-  printMessage(getLoc(3), SourceMgr::DK_Error, "message", None,
+  printMessage(getLoc(3), SourceMgr::DK_Error, "message", std::nullopt,
                makeArrayRef(SMFixIt(getRange(3, 1), "zzz")));
 
   EXPECT_EQ("file.in:1:4: error: message\n"

diff  --git a/llvm/unittests/Support/VirtualFileSystemTest.cpp b/llvm/unittests/Support/VirtualFileSystemTest.cpp
index 1e300eec711d1..e4f93cad3fbdf 100644
--- a/llvm/unittests/Support/VirtualFileSystemTest.cpp
+++ b/llvm/unittests/Support/VirtualFileSystemTest.cpp
@@ -1129,7 +1129,8 @@ TEST_F(InMemoryFileSystemTest, AddFileWithUser) {
 }
 
 TEST_F(InMemoryFileSystemTest, AddFileWithGroup) {
-  FS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"), None, 0xDABBAD00);
+  FS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"), std::nullopt,
+             0xDABBAD00);
   auto Stat = FS.status("/a");
   ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
   ASSERT_TRUE(Stat->isDirectory());
@@ -1146,8 +1147,8 @@ TEST_F(InMemoryFileSystemTest, AddFileWithGroup) {
 }
 
 TEST_F(InMemoryFileSystemTest, AddFileWithFileType) {
-  FS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"), None, None,
-             sys::fs::file_type::socket_file);
+  FS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"), std::nullopt,
+             std::nullopt, sys::fs::file_type::socket_file);
   auto Stat = FS.status("/a");
   ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
   ASSERT_TRUE(Stat->isDirectory());
@@ -1161,7 +1162,8 @@ TEST_F(InMemoryFileSystemTest, AddFileWithFileType) {
 }
 
 TEST_F(InMemoryFileSystemTest, AddFileWithPerms) {
-  FS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"), None, None, None,
+  FS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"), std::nullopt,
+             std::nullopt, std::nullopt,
              sys::fs::perms::owner_read | sys::fs::perms::owner_write);
   auto Stat = FS.status("/a");
   ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
@@ -1183,10 +1185,11 @@ TEST_F(InMemoryFileSystemTest, AddFileWithPerms) {
 }
 
 TEST_F(InMemoryFileSystemTest, AddDirectoryThenAddChild) {
-  FS.addFile("/a", 0, MemoryBuffer::getMemBuffer(""), /*User=*/None,
-             /*Group=*/None, sys::fs::file_type::directory_file);
-  FS.addFile("/a/b", 0, MemoryBuffer::getMemBuffer("abc"), /*User=*/None,
-             /*Group=*/None, sys::fs::file_type::regular_file);
+  FS.addFile("/a", 0, MemoryBuffer::getMemBuffer(""), /*User=*/std::nullopt,
+             /*Group=*/std::nullopt, sys::fs::file_type::directory_file);
+  FS.addFile("/a/b", 0, MemoryBuffer::getMemBuffer("abc"),
+             /*User=*/std::nullopt,
+             /*Group=*/std::nullopt, sys::fs::file_type::regular_file);
   auto Stat = FS.status("/a");
   ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
   ASSERT_TRUE(Stat->isDirectory());
@@ -1199,8 +1202,9 @@ TEST_F(InMemoryFileSystemTest, AddDirectoryThenAddChild) {
 // was requested (to match the behavior of RealFileSystem).
 TEST_F(InMemoryFileSystemTest, StatusName) {
   NormalizedFS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"),
-                       /*User=*/None,
-                       /*Group=*/None, sys::fs::file_type::regular_file);
+                       /*User=*/std::nullopt,
+                       /*Group=*/std::nullopt,
+                       sys::fs::file_type::regular_file);
   NormalizedFS.setCurrentWorkingDirectory("/a/b");
 
   // Access using InMemoryFileSystem::status.

diff  --git a/llvm/unittests/Support/raw_ostream_test.cpp b/llvm/unittests/Support/raw_ostream_test.cpp
index 8c695300b745d..84006cb0b3151 100644
--- a/llvm/unittests/Support/raw_ostream_test.cpp
+++ b/llvm/unittests/Support/raw_ostream_test.cpp
@@ -204,10 +204,10 @@ TEST(raw_ostreamTest, FormatDecimal) {
                           printToString(format_decimal(INT64_MIN, 21), 21));
 }
 
-static std::string formatted_bytes_str(ArrayRef<uint8_t> Bytes,
-                                       llvm::Optional<uint64_t> Offset = None,
-                                       uint32_t NumPerLine = 16,
-                                       uint8_t ByteGroupSize = 4) {
+static std::string
+formatted_bytes_str(ArrayRef<uint8_t> Bytes,
+                    llvm::Optional<uint64_t> Offset = std::nullopt,
+                    uint32_t NumPerLine = 16, uint8_t ByteGroupSize = 4) {
   std::string S;
   raw_string_ostream Str(S);
   Str << format_bytes(Bytes, Offset, NumPerLine, ByteGroupSize);
@@ -215,10 +215,9 @@ static std::string formatted_bytes_str(ArrayRef<uint8_t> Bytes,
   return S;
 }
 
-static std::string format_bytes_with_ascii_str(ArrayRef<uint8_t> Bytes,
-                                               Optional<uint64_t> Offset = None,
-                                               uint32_t NumPerLine = 16,
-                                               uint8_t ByteGroupSize = 4) {
+static std::string format_bytes_with_ascii_str(
+    ArrayRef<uint8_t> Bytes, Optional<uint64_t> Offset = std::nullopt,
+    uint32_t NumPerLine = 16, uint8_t ByteGroupSize = 4) {
   std::string S;
   raw_string_ostream Str(S);
   Str << format_bytes_with_ascii(Bytes, Offset, NumPerLine, ByteGroupSize);
@@ -249,47 +248,48 @@ TEST(raw_ostreamTest, FormattedHexBytes) {
             formatted_bytes_str(B.take_front(17)));
   // Test raw bytes with 1 bytes per line wrapping.
   EXPECT_EQ("61\n62\n63\n64\n65\n66",
-            formatted_bytes_str(B.take_front(6), None, 1));
+            formatted_bytes_str(B.take_front(6), std::nullopt, 1));
   // Test raw bytes with 7 bytes per line wrapping.
   EXPECT_EQ("61626364 656667\n68696a6b 6c6d6e\n6f7071",
-            formatted_bytes_str(B.take_front(17), None, 7));
+            formatted_bytes_str(B.take_front(17), std::nullopt, 7));
   // Test raw bytes with 8 bytes per line wrapping.
   EXPECT_EQ("61626364 65666768\n696a6b6c 6d6e6f70\n71",
-            formatted_bytes_str(B.take_front(17), None, 8));
+            formatted_bytes_str(B.take_front(17), std::nullopt, 8));
   //----------------------------------------------------------------------
   // Test hex byte output with the 1 byte groups
   //----------------------------------------------------------------------
   EXPECT_EQ("61 62 63 64 65",
-            formatted_bytes_str(B.take_front(5), None, 16, 1));
+            formatted_bytes_str(B.take_front(5), std::nullopt, 16, 1));
   // Test that 16 bytes get written to a line correctly.
   EXPECT_EQ("61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70",
-            formatted_bytes_str(B.take_front(16), None, 16, 1));
+            formatted_bytes_str(B.take_front(16), std::nullopt, 16, 1));
   // Test raw bytes with default 16 bytes per line wrapping.
   EXPECT_EQ("61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70\n71",
-            formatted_bytes_str(B.take_front(17), None, 16, 1));
+            formatted_bytes_str(B.take_front(17), std::nullopt, 16, 1));
   // Test raw bytes with 7 bytes per line wrapping.
   EXPECT_EQ("61 62 63 64 65 66 67\n68 69 6a 6b 6c 6d 6e\n6f 70 71",
-            formatted_bytes_str(B.take_front(17), None, 7, 1));
+            formatted_bytes_str(B.take_front(17), std::nullopt, 7, 1));
   // Test raw bytes with 8 bytes per line wrapping.
   EXPECT_EQ("61 62 63 64 65 66 67 68\n69 6a 6b 6c 6d 6e 6f 70\n71",
-            formatted_bytes_str(B.take_front(17), None, 8, 1));
+            formatted_bytes_str(B.take_front(17), std::nullopt, 8, 1));
 
   //----------------------------------------------------------------------
   // Test hex byte output with the 2 byte groups
   //----------------------------------------------------------------------
-  EXPECT_EQ("6162 6364 65", formatted_bytes_str(B.take_front(5), None, 16, 2));
+  EXPECT_EQ("6162 6364 65",
+            formatted_bytes_str(B.take_front(5), std::nullopt, 16, 2));
   // Test that 16 bytes get written to a line correctly.
   EXPECT_EQ("6162 6364 6566 6768 696a 6b6c 6d6e 6f70",
-            formatted_bytes_str(B.take_front(16), None, 16, 2));
+            formatted_bytes_str(B.take_front(16), std::nullopt, 16, 2));
   // Test raw bytes with default 16 bytes per line wrapping.
   EXPECT_EQ("6162 6364 6566 6768 696a 6b6c 6d6e 6f70\n71",
-            formatted_bytes_str(B.take_front(17), None, 16, 2));
+            formatted_bytes_str(B.take_front(17), std::nullopt, 16, 2));
   // Test raw bytes with 7 bytes per line wrapping.
   EXPECT_EQ("6162 6364 6566 67\n6869 6a6b 6c6d 6e\n6f70 71",
-            formatted_bytes_str(B.take_front(17), None, 7, 2));
+            formatted_bytes_str(B.take_front(17), std::nullopt, 7, 2));
   // Test raw bytes with 8 bytes per line wrapping.
   EXPECT_EQ("6162 6364 6566 6768\n696a 6b6c 6d6e 6f70\n71",
-            formatted_bytes_str(B.take_front(17), None, 8, 2));
+            formatted_bytes_str(B.take_front(17), std::nullopt, 8, 2));
 
   //----------------------------------------------------------------------
   // Test hex bytes with offset with the default 4 byte groups.
@@ -305,9 +305,9 @@ TEST(raw_ostreamTest, FormattedHexBytes) {
             format_bytes_with_ascii_str(B.take_front(16)));
   EXPECT_EQ("61626364 65666768  |abcdefgh|\n"
             "696a6b6c 6d6e6f70  |ijklmnop|",
-            format_bytes_with_ascii_str(B.take_front(16), None, 8));
+            format_bytes_with_ascii_str(B.take_front(16), std::nullopt, 8));
   EXPECT_EQ("61626364 65666768  |abcdefgh|\n696a6b6c           |ijkl|",
-            format_bytes_with_ascii_str(B.take_front(12), None, 8));
+            format_bytes_with_ascii_str(B.take_front(12), std::nullopt, 8));
   std::vector<uint8_t> Unprintable = {'a', '\x1e', 'b', '\x1f'};
   // Make sure the ASCII is still lined up correctly when fewer bytes than 16
   // bytes per line are available. The ASCII should still be aligned as if 16

diff  --git a/llvm/unittests/Target/AArch64/InstSizes.cpp b/llvm/unittests/Target/AArch64/InstSizes.cpp
index 3fab5183da3a9..76bad4d3e99bd 100644
--- a/llvm/unittests/Target/AArch64/InstSizes.cpp
+++ b/llvm/unittests/Target/AArch64/InstSizes.cpp
@@ -23,9 +23,9 @@ std::unique_ptr<LLVMTargetMachine> createTargetMachine() {
   std::string Error;
   const Target *TheTarget = TargetRegistry::lookupTarget(TT, Error);
 
-  return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine*>(
-      TheTarget->createTargetMachine(TT, CPU, FS, TargetOptions(), None, None,
-                                     CodeGenOpt::Default)));
+  return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+      TheTarget->createTargetMachine(TT, CPU, FS, TargetOptions(), std::nullopt,
+                                     std::nullopt, CodeGenOpt::Default)));
 }
 
 std::unique_ptr<AArch64InstrInfo> createInstrInfo(TargetMachine *TM) {

diff  --git a/llvm/unittests/Target/AArch64/MatrixRegisterAliasing.cpp b/llvm/unittests/Target/AArch64/MatrixRegisterAliasing.cpp
index d1693e9b17abd..b4e2fea90432e 100644
--- a/llvm/unittests/Target/AArch64/MatrixRegisterAliasing.cpp
+++ b/llvm/unittests/Target/AArch64/MatrixRegisterAliasing.cpp
@@ -19,9 +19,9 @@ std::unique_ptr<LLVMTargetMachine> createTargetMachine() {
   std::string Error;
   const Target *TheTarget = TargetRegistry::lookupTarget(TT, Error);
 
-  return std::unique_ptr<LLVMTargetMachine>(
-      static_cast<LLVMTargetMachine *>(TheTarget->createTargetMachine(
-          TT, CPU, FS, TargetOptions(), None, None, CodeGenOpt::Default)));
+  return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+      TheTarget->createTargetMachine(TT, CPU, FS, TargetOptions(), std::nullopt,
+                                     std::nullopt, CodeGenOpt::Default)));
 }
 
 std::unique_ptr<AArch64InstrInfo> createInstrInfo(TargetMachine *TM) {

diff  --git a/llvm/unittests/Target/AMDGPU/DwarfRegMappings.cpp b/llvm/unittests/Target/AMDGPU/DwarfRegMappings.cpp
index 802ea83dcbe34..e4d712e14364c 100644
--- a/llvm/unittests/Target/AMDGPU/DwarfRegMappings.cpp
+++ b/llvm/unittests/Target/AMDGPU/DwarfRegMappings.cpp
@@ -38,8 +38,9 @@ createTargetMachine(std::string TStr, StringRef CPU, StringRef FS) {
     return nullptr;
 
   TargetOptions Options;
-  return std::unique_ptr<GCNTargetMachine>(static_cast<GCNTargetMachine *>(
-      T->createTargetMachine(TStr, CPU, FS, Options, None, None)));
+  return std::unique_ptr<GCNTargetMachine>(
+      static_cast<GCNTargetMachine *>(T->createTargetMachine(
+          TStr, CPU, FS, Options, std::nullopt, std::nullopt)));
 }
 
 TEST(AMDGPUDwarfRegMappingTests, TestWave64DwarfRegMapping) {

diff  --git a/llvm/unittests/Target/ARM/InstSizes.cpp b/llvm/unittests/Target/ARM/InstSizes.cpp
index a8838f1304348..eb13e8a752a25 100644
--- a/llvm/unittests/Target/ARM/InstSizes.cpp
+++ b/llvm/unittests/Target/ARM/InstSizes.cpp
@@ -81,9 +81,9 @@ TEST(InstSizes, PseudoInst) {
   }
 
   TargetOptions Options;
-  auto TM = std::unique_ptr<LLVMTargetMachine>(
-      static_cast<LLVMTargetMachine *>(T->createTargetMachine(
-          TT, "generic", "", Options, None, None, CodeGenOpt::Default)));
+  auto TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+      T->createTargetMachine(TT, "generic", "", Options, std::nullopt,
+                             std::nullopt, CodeGenOpt::Default)));
   ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
                   std::string(TM->getTargetFeatureString()),
                   *static_cast<const ARMBaseTargetMachine *>(TM.get()), false);

diff  --git a/llvm/unittests/Target/ARM/MachineInstrTest.cpp b/llvm/unittests/Target/ARM/MachineInstrTest.cpp
index 21f3ee6f993a3..636f7cfb2b10c 100644
--- a/llvm/unittests/Target/ARM/MachineInstrTest.cpp
+++ b/llvm/unittests/Target/ARM/MachineInstrTest.cpp
@@ -83,10 +83,9 @@ TEST(MachineInstructionDoubleWidthResult, IsCorrect) {
   }
 
   TargetOptions Options;
-  auto TM = std::unique_ptr<LLVMTargetMachine>(
-    static_cast<LLVMTargetMachine*>(
-      T->createTargetMachine(TT, "generic", "", Options, None, None,
-                             CodeGenOpt::Default)));
+  auto TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+      T->createTargetMachine(TT, "generic", "", Options, std::nullopt,
+                             std::nullopt, CodeGenOpt::Default)));
   ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
                   std::string(TM->getTargetFeatureString()),
                   *static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
@@ -240,10 +239,9 @@ TEST(MachineInstructionHorizontalReduction, IsCorrect) {
   }
 
   TargetOptions Options;
-  auto TM = std::unique_ptr<LLVMTargetMachine>(
-    static_cast<LLVMTargetMachine*>(
-      T->createTargetMachine(TT, "generic", "", Options, None, None,
-                             CodeGenOpt::Default)));
+  auto TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+      T->createTargetMachine(TT, "generic", "", Options, std::nullopt,
+                             std::nullopt, CodeGenOpt::Default)));
   ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
                   std::string(TM->getTargetFeatureString()),
                   *static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
@@ -340,10 +338,9 @@ TEST(MachineInstructionRetainsPreviousHalfElement, IsCorrect) {
   }
 
   TargetOptions Options;
-  auto TM = std::unique_ptr<LLVMTargetMachine>(
-    static_cast<LLVMTargetMachine*>(
-      T->createTargetMachine(TT, "generic", "", Options, None, None,
-                             CodeGenOpt::Default)));
+  auto TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+      T->createTargetMachine(TT, "generic", "", Options, std::nullopt,
+                             std::nullopt, CodeGenOpt::Default)));
   ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
                   std::string(TM->getTargetFeatureString()),
                   *static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
@@ -1047,10 +1044,9 @@ TEST(MachineInstrValidTailPredication, IsCorrect) {
   }
 
   TargetOptions Options;
-  auto TM = std::unique_ptr<LLVMTargetMachine>(
-    static_cast<LLVMTargetMachine*>(
-      T->createTargetMachine(TT, "generic", "", Options, None, None,
-                             CodeGenOpt::Default)));
+  auto TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+      T->createTargetMachine(TT, "generic", "", Options, std::nullopt,
+                             std::nullopt, CodeGenOpt::Default)));
   ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
                   std::string(TM->getTargetFeatureString()),
                   *static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
@@ -1189,9 +1185,9 @@ TEST(MachineInstr, HasSideEffects) {
   }
 
   TargetOptions Options;
-  auto TM = std::unique_ptr<LLVMTargetMachine>(
-      static_cast<LLVMTargetMachine *>(T->createTargetMachine(
-          TT, "generic", "", Options, None, None, CodeGenOpt::Default)));
+  auto TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+      T->createTargetMachine(TT, "generic", "", Options, std::nullopt,
+                             std::nullopt, CodeGenOpt::Default)));
   ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
                   std::string(TM->getTargetFeatureString()),
                   *static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
@@ -2069,10 +2065,9 @@ TEST(MachineInstr, MVEVecSize) {
   }
 
   TargetOptions Options;
-  auto TM = std::unique_ptr<LLVMTargetMachine>(
-    static_cast<LLVMTargetMachine*>(
-      T->createTargetMachine(TT, "generic", "", Options, None, None,
-                             CodeGenOpt::Default)));
+  auto TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+      T->createTargetMachine(TT, "generic", "", Options, std::nullopt,
+                             std::nullopt, CodeGenOpt::Default)));
   ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
                   std::string(TM->getTargetFeatureString()),
                   *static_cast<const ARMBaseTargetMachine *>(TM.get()), false);

diff  --git a/llvm/unittests/Target/PowerPC/AIXRelocModelTest.cpp b/llvm/unittests/Target/PowerPC/AIXRelocModelTest.cpp
index 2f54b94545ba6..021ea6f1fbe47 100644
--- a/llvm/unittests/Target/PowerPC/AIXRelocModelTest.cpp
+++ b/llvm/unittests/Target/PowerPC/AIXRelocModelTest.cpp
@@ -28,7 +28,7 @@ TEST_F(AIXRelocModelTest, DefalutToPIC) {
   // relocation model unset.
   std::unique_ptr<TargetMachine> Target(TheTarget->createTargetMachine(
       /*TT*/ TheTriple.getTriple(), /*CPU*/ "", /*Features*/ "",
-      /*Options*/ Options, /*RM*/ None, /*CM*/ None,
+      /*Options*/ Options, /*RM*/ std::nullopt, /*CM*/ std::nullopt,
       /*OL*/ CodeGenOpt::Default));
   ASSERT_TRUE(Target) << "Could not allocate target machine!";
 

diff  --git a/llvm/unittests/Target/WebAssembly/WebAssemblyExceptionInfoTest.cpp b/llvm/unittests/Target/WebAssembly/WebAssemblyExceptionInfoTest.cpp
index d9247e4a4cdcb..617ff7bff5424 100644
--- a/llvm/unittests/Target/WebAssembly/WebAssemblyExceptionInfoTest.cpp
+++ b/llvm/unittests/Target/WebAssembly/WebAssemblyExceptionInfoTest.cpp
@@ -34,9 +34,9 @@ std::unique_ptr<LLVMTargetMachine> createTargetMachine() {
   const Target *TheTarget = TargetRegistry::lookupTarget(TT, Error);
   assert(TheTarget);
 
-  return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine*>(
-      TheTarget->createTargetMachine(TT, CPU, FS, TargetOptions(), None, None,
-                                     CodeGenOpt::Default)));
+  return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+      TheTarget->createTargetMachine(TT, CPU, FS, TargetOptions(), std::nullopt,
+                                     std::nullopt, CodeGenOpt::Default)));
 }
 
 std::unique_ptr<Module> parseMIR(LLVMContext &Context,

diff  --git a/llvm/unittests/Target/X86/MachineSizeOptsTest.cpp b/llvm/unittests/Target/X86/MachineSizeOptsTest.cpp
index c99955c3e48f6..84286455a269e 100644
--- a/llvm/unittests/Target/X86/MachineSizeOptsTest.cpp
+++ b/llvm/unittests/Target/X86/MachineSizeOptsTest.cpp
@@ -31,9 +31,9 @@ std::unique_ptr<LLVMTargetMachine> createTargetMachine() {
   auto TT(Triple::normalize("x86_64--"));
   std::string Error;
   const Target *TheTarget = TargetRegistry::lookupTarget(TT, Error);
-  return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine*>(
-      TheTarget->createTargetMachine(TT, "", "", TargetOptions(), None, None,
-                                     CodeGenOpt::Default)));
+  return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+      TheTarget->createTargetMachine(TT, "", "", TargetOptions(), std::nullopt,
+                                     std::nullopt, CodeGenOpt::Default)));
 }
 
 class MachineSizeOptsTest : public testing::Test {

diff  --git a/llvm/unittests/Testing/Support/TempPathTest.cpp b/llvm/unittests/Testing/Support/TempPathTest.cpp
index 830221c30d7c2..11820b0e8aa14 100644
--- a/llvm/unittests/Testing/Support/TempPathTest.cpp
+++ b/llvm/unittests/Testing/Support/TempPathTest.cpp
@@ -33,10 +33,10 @@ TEST(TempPathTest, TempDir) {
   ASSERT_EQ(Path, Dir2->path());
   ASSERT_TRUE(sys::fs::exists(Path));
 
-  Dir1 = None;
+  Dir1 = std::nullopt;
   ASSERT_TRUE(sys::fs::exists(Path));
 
-  Dir2 = None;
+  Dir2 = std::nullopt;
   ASSERT_FALSE(sys::fs::exists(Path));
 }
 
@@ -61,10 +61,10 @@ TEST(TempPathTest, TempFile) {
   ASSERT_EQ(Path, File2->path());
   ASSERT_TRUE(sys::fs::exists(Path));
 
-  File1 = None;
+  File1 = std::nullopt;
   ASSERT_TRUE(sys::fs::exists(Path));
 
-  File2 = None;
+  File2 = std::nullopt;
   ASSERT_FALSE(sys::fs::exists(Path));
 }
 
@@ -90,10 +90,10 @@ TEST(TempPathTest, TempLink) {
   ASSERT_EQ(Path, Link2->path());
   ASSERT_TRUE(sys::fs::exists(Path));
 
-  Link1 = None;
+  Link1 = std::nullopt;
   ASSERT_TRUE(sys::fs::exists(Path));
 
-  Link2 = None;
+  Link2 = std::nullopt;
   ASSERT_FALSE(sys::fs::exists(Path));
 }
 

diff  --git a/llvm/unittests/Transforms/Utils/CloningTest.cpp b/llvm/unittests/Transforms/Utils/CloningTest.cpp
index 9b4a6fbe81100..d5cd285f5bee9 100644
--- a/llvm/unittests/Transforms/Utils/CloningTest.cpp
+++ b/llvm/unittests/Transforms/Utils/CloningTest.cpp
@@ -473,7 +473,7 @@ class CloneFunc : public ::testing::Test {
 
     // Function DI
     auto *File = DBuilder.createFile("filename.c", "/file/dir/");
-    DITypeRefArray ParamTypes = DBuilder.getOrCreateTypeArray(None);
+    DITypeRefArray ParamTypes = DBuilder.getOrCreateTypeArray(std::nullopt);
     DISubroutineType *FuncType =
         DBuilder.createSubroutineType(ParamTypes);
     auto *CU = DBuilder.createCompileUnit(dwarf::DW_LANG_C99,
@@ -962,7 +962,7 @@ class CloneModule : public ::testing::Test {
 
     // Create debug info
     auto *File = DBuilder.createFile("filename.c", "/file/dir/");
-    DITypeRefArray ParamTypes = DBuilder.getOrCreateTypeArray(None);
+    DITypeRefArray ParamTypes = DBuilder.getOrCreateTypeArray(std::nullopt);
     DISubroutineType *DFuncType = DBuilder.createSubroutineType(ParamTypes);
     auto *CU = DBuilder.createCompileUnit(dwarf::DW_LANG_C99,
                                           DBuilder.createFile("filename.c",

diff  --git a/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp b/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp
index 4417cc4e52e53..b5b785321b992 100644
--- a/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp
+++ b/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp
@@ -21,7 +21,7 @@ namespace {
 
 TEST(ValueMapperTest, mapMDNode) {
   LLVMContext Context;
-  auto *U = MDTuple::get(Context, None);
+  auto *U = MDTuple::get(Context, std::nullopt);
 
   // The node should be unchanged.
   ValueToValueMapTy VM;
@@ -107,7 +107,7 @@ TEST(ValueMapperTest, mapMDNodeDuplicatedCycle) {
 
 TEST(ValueMapperTest, mapMDNodeUnresolved) {
   LLVMContext Context;
-  TempMDTuple T = MDTuple::getTemporary(Context, None);
+  TempMDTuple T = MDTuple::getTemporary(Context, std::nullopt);
 
   ValueToValueMapTy VM;
   EXPECT_EQ(T.get(), ValueMapper(VM, RF_NoModuleLevelChanges).mapMDNode(*T));
@@ -115,7 +115,7 @@ TEST(ValueMapperTest, mapMDNodeUnresolved) {
 
 TEST(ValueMapperTest, mapMDNodeDistinct) {
   LLVMContext Context;
-  auto *D = MDTuple::getDistinct(Context, None);
+  auto *D = MDTuple::getDistinct(Context, std::nullopt);
 
   {
     // The node should be cloned.
@@ -131,11 +131,11 @@ TEST(ValueMapperTest, mapMDNodeDistinct) {
 
 TEST(ValueMapperTest, mapMDNodeDistinctOperands) {
   LLVMContext Context;
-  Metadata *Old = MDTuple::getDistinct(Context, None);
+  Metadata *Old = MDTuple::getDistinct(Context, std::nullopt);
   auto *D = MDTuple::getDistinct(Context, Old);
   ASSERT_EQ(Old, D->getOperand(0));
 
-  Metadata *New = MDTuple::getDistinct(Context, None);
+  Metadata *New = MDTuple::getDistinct(Context, std::nullopt);
   ValueToValueMapTy VM;
   VM.MD()[Old].reset(New);
 
@@ -146,11 +146,11 @@ TEST(ValueMapperTest, mapMDNodeDistinctOperands) {
 
 TEST(ValueMapperTest, mapMDNodeSeeded) {
   LLVMContext Context;
-  auto *D = MDTuple::getDistinct(Context, None);
+  auto *D = MDTuple::getDistinct(Context, std::nullopt);
 
   // The node should be moved.
   ValueToValueMapTy VM;
-  EXPECT_EQ(None, VM.getMappedMD(D));
+  EXPECT_EQ(std::nullopt, VM.getMappedMD(D));
 
   VM.MD().insert(std::make_pair(D, TrackingMDRef(D)));
   EXPECT_EQ(D, *VM.getMappedMD(D));
@@ -159,11 +159,11 @@ TEST(ValueMapperTest, mapMDNodeSeeded) {
 
 TEST(ValueMapperTest, mapMDNodeSeededWithNull) {
   LLVMContext Context;
-  auto *D = MDTuple::getDistinct(Context, None);
+  auto *D = MDTuple::getDistinct(Context, std::nullopt);
 
   // The node should be moved.
   ValueToValueMapTy VM;
-  EXPECT_EQ(None, VM.getMappedMD(D));
+  EXPECT_EQ(std::nullopt, VM.getMappedMD(D));
 
   VM.MD().insert(std::make_pair(D, TrackingMDRef()));
   EXPECT_EQ(nullptr, *VM.getMappedMD(D));
@@ -189,7 +189,7 @@ TEST(ValueMapperTest, mapMetadataMDString) {
 
   // Make sure S1 maps to itself, but isn't memoized.
   EXPECT_EQ(S1, ValueMapper(VM).mapMetadata(*S1));
-  EXPECT_EQ(None, VM.getMappedMD(S1));
+  EXPECT_EQ(std::nullopt, VM.getMappedMD(S1));
 
   // We still expect VM.MD() to be respected.
   auto *S2 = MDString::get(C, "S2");
@@ -199,7 +199,7 @@ TEST(ValueMapperTest, mapMetadataMDString) {
 
 TEST(ValueMapperTest, mapMetadataGetMappedMD) {
   LLVMContext C;
-  auto *N0 = MDTuple::get(C, None);
+  auto *N0 = MDTuple::get(C, std::nullopt);
   auto *N1 = MDTuple::get(C, N0);
 
   // Make sure hasMD and getMappedMD work correctly.
@@ -208,15 +208,15 @@ TEST(ValueMapperTest, mapMetadataGetMappedMD) {
   EXPECT_EQ(N0, ValueMapper(VM).mapMetadata(*N0));
   EXPECT_EQ(N1, ValueMapper(VM).mapMetadata(*N1));
   EXPECT_TRUE(VM.hasMD());
-  ASSERT_NE(None, VM.getMappedMD(N0));
-  ASSERT_NE(None, VM.getMappedMD(N1));
+  ASSERT_NE(std::nullopt, VM.getMappedMD(N0));
+  ASSERT_NE(std::nullopt, VM.getMappedMD(N1));
   EXPECT_EQ(N0, *VM.getMappedMD(N0));
   EXPECT_EQ(N1, *VM.getMappedMD(N1));
 }
 
 TEST(ValueMapperTest, mapMetadataNoModuleLevelChanges) {
   LLVMContext C;
-  auto *N0 = MDTuple::get(C, None);
+  auto *N0 = MDTuple::get(C, std::nullopt);
   auto *N1 = MDTuple::get(C, N0);
 
   // Nothing should be memoized when RF_NoModuleLevelChanges.
@@ -225,8 +225,8 @@ TEST(ValueMapperTest, mapMetadataNoModuleLevelChanges) {
   EXPECT_EQ(N0, ValueMapper(VM, RF_NoModuleLevelChanges).mapMetadata(*N0));
   EXPECT_EQ(N1, ValueMapper(VM, RF_NoModuleLevelChanges).mapMetadata(*N1));
   EXPECT_FALSE(VM.hasMD());
-  EXPECT_EQ(None, VM.getMappedMD(N0));
-  EXPECT_EQ(None, VM.getMappedMD(N1));
+  EXPECT_EQ(std::nullopt, VM.getMappedMD(N0));
+  EXPECT_EQ(std::nullopt, VM.getMappedMD(N1));
 }
 
 TEST(ValueMapperTest, mapMetadataConstantAsMetadata) {
@@ -246,7 +246,7 @@ TEST(ValueMapperTest, mapMetadataConstantAsMetadata) {
     EXPECT_FALSE(VM.MD().count(CAM));
 
     // But it should respect a mapping that gets seeded.
-    auto *N = MDTuple::get(C, None);
+    auto *N = MDTuple::get(C, std::nullopt);
     VM.MD()[CAM].reset(N);
     EXPECT_EQ(N, ValueMapper(VM).mapMetadata(*CAM));
     EXPECT_EQ(N, ValueMapper(VM, RF_IgnoreMissingLocals).mapMetadata(*CAM));
@@ -303,14 +303,14 @@ TEST(ValueMapperTest, mapValueLocalAsMetadata) {
   // property.  To keep RemapInstruction from crashing we need a non-null
   // return here, but we also shouldn't reference the unmapped local.  Use
   // "metadata !{}".
-  auto *N0 = MDTuple::get(C, None);
+  auto *N0 = MDTuple::get(C, std::nullopt);
   auto *N0AV = MetadataAsValue::get(C, N0);
   ValueToValueMapTy VM;
   EXPECT_EQ(N0AV, ValueMapper(VM).mapValue(*MAV));
   EXPECT_EQ(nullptr, ValueMapper(VM, RF_IgnoreMissingLocals).mapValue(*MAV));
   EXPECT_FALSE(VM.count(MAV));
   EXPECT_FALSE(VM.count(&A));
-  EXPECT_EQ(None, VM.getMappedMD(LAM));
+  EXPECT_EQ(std::nullopt, VM.getMappedMD(LAM));
 
   VM[MAV] = MAV;
   EXPECT_EQ(MAV, ValueMapper(VM).mapValue(*MAV));
@@ -359,8 +359,8 @@ TEST(ValueMapperTest, mapValueLocalInArgList) {
   EXPECT_EQ(MAV, ValueMapper(VM, RF_IgnoreMissingLocals).mapValue(*MAV));
   EXPECT_FALSE(VM.count(MAV));
   EXPECT_FALSE(VM.count(&A));
-  EXPECT_EQ(None, VM.getMappedMD(LAM));
-  EXPECT_EQ(None, VM.getMappedMD(ArgList));
+  EXPECT_EQ(std::nullopt, VM.getMappedMD(LAM));
+  EXPECT_EQ(std::nullopt, VM.getMappedMD(ArgList));
 
   VM[MAV] = MAV;
   EXPECT_EQ(MAV, ValueMapper(VM).mapValue(*MAV));

diff  --git a/llvm/unittests/tools/llvm-mca/MCATestBase.h b/llvm/unittests/tools/llvm-mca/MCATestBase.h
index c1deb419ec5d2..95a0f20e33516 100644
--- a/llvm/unittests/tools/llvm-mca/MCATestBase.h
+++ b/llvm/unittests/tools/llvm-mca/MCATestBase.h
@@ -74,7 +74,7 @@ class MCATestBase : public ::testing::Test {
   /// `llvm-mca` tool to verify result correctness.
   /// This function only displays on SummaryView by default.
   virtual Error runBaselineMCA(json::Object &Result, ArrayRef<MCInst> Insts,
-                               ArrayRef<mca::View *> Views = None,
+                               ArrayRef<mca::View *> Views = std::nullopt,
                                const mca::PipelineOptions *PO = nullptr);
 };
 


        


More information about the llvm-commits mailing list