[Analysis] Use std::optional in MemoryDependenceAnalysis.h (NFC)
authorKazu Hirata <kazu@google.com>
Sun, 27 Nov 2022 20:18:18 +0000 (12:18 -0800)
committerKazu Hirata <kazu@google.com>
Sun, 27 Nov 2022 20:18:18 +0000 (12:18 -0800)
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

llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h

index feb22c2..64a635e 100644 (file)
@@ -24,6 +24,7 @@
 #include "llvm/IR/PredIteratorCache.h"
 #include "llvm/IR/ValueHandle.h"
 #include "llvm/Pass.h"
+#include <optional>
 
 namespace llvm {
 
@@ -470,7 +471,7 @@ public:
   void releaseMemory();
 
   /// Return the clobber offset to dependent instruction.
-  Optional<int32_t> getClobberOffset(LoadInst *DepInst) const {
+  std::optional<int32_t> getClobberOffset(LoadInst *DepInst) const {
     const auto Off = ClobberOffsets.find(DepInst);
     if (Off != ClobberOffsets.end())
       return Off->getSecond();
@@ -524,7 +525,7 @@ public:
 /// A wrapper analysis pass for the legacy pass manager that exposes a \c
 /// MemoryDepnedenceResults instance.
 class MemoryDependenceWrapperPass : public FunctionPass {
-  Optional<MemoryDependenceResults> MemDep;
+  std::optional<MemoryDependenceResults> MemDep;
 
 public:
   static char ID;