[llvm] eb0b5a3 - [Analysis] Use std::optional in LazyValueInfo.cpp (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 25 10:25:41 PST 2022


Author: Kazu Hirata
Date: 2022-11-25T10:25:36-08:00
New Revision: eb0b5a36be583623915322a2d1259c47928316b4

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

LOG: [Analysis] Use std::optional in LazyValueInfo.cpp (NFC)

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/lib/Analysis/LazyValueInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp
index fe08e512a81f..f65ef7c2adf6 100644
--- a/llvm/lib/Analysis/LazyValueInfo.cpp
+++ b/llvm/lib/Analysis/LazyValueInfo.cpp
@@ -38,6 +38,7 @@
 #include "llvm/Support/FormattedStream.h"
 #include "llvm/Support/KnownBits.h"
 #include "llvm/Support/raw_ostream.h"
+#include <optional>
 using namespace llvm;
 using namespace PatternMatch;
 
@@ -164,7 +165,7 @@ namespace {
       SmallDenseSet<AssertingVH<Value>, 4> OverDefined;
       // None indicates that the nonnull pointers for this basic block
       // block have not been computed yet.
-      Optional<NonNullPointerSet> NonNullPointers;
+      std::optional<NonNullPointerSet> NonNullPointers;
     };
 
     /// Cached information per basic block.
@@ -1296,7 +1297,7 @@ static ValueLatticeElement constantFoldUser(User *Usr, Value *Op,
 /// Compute the value of Val on the edge BBFrom -> BBTo. Returns false if
 /// Val is not constrained on the edge.  Result is unspecified if return value
 /// is false.
-static Optional<ValueLatticeElement> getEdgeValueLocal(Value *Val,
+static std::optional<ValueLatticeElement> getEdgeValueLocal(Value *Val,
                                                        BasicBlock *BBFrom,
                                                        BasicBlock *BBTo) {
   // TODO: Handle more complex conditionals. If (v == 0 || v2 < 1) is false, we


        


More information about the llvm-commits mailing list