[Scalar] Use std::optional in CorrelatedValuePropagation.cpp (NFC)
authorKazu Hirata <kazu@google.com>
Sat, 26 Nov 2022 07:52:49 +0000 (23:52 -0800)
committerKazu Hirata <kazu@google.com>
Sat, 26 Nov 2022 07:52:49 +0000 (23:52 -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/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp

index ea887d9..8cc5ece 100644 (file)
@@ -44,6 +44,7 @@
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Transforms/Utils/Local.h"
 #include <cassert>
+#include <optional>
 #include <utility>
 
 using namespace llvm;
@@ -729,7 +730,7 @@ static bool narrowSDivOrSRem(BinaryOperator *Instr, LazyValueInfo *LVI) {
 
   // What is the smallest bit width that can accommodate the entire value ranges
   // of both of the operands?
-  std::array<Optional<ConstantRange>, 2> CRs;
+  std::array<std::optional<ConstantRange>, 2> CRs;
   unsigned MinSignedBits = 0;
   for (auto I : zip(Instr->operands(), CRs)) {
     std::get<1>(I) = LVI->getConstantRange(std::get<0>(I), Instr);