[llvm] edace86 - [Scalar] Use std::optional in CorrelatedValuePropagation.cpp (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 25 23:52:54 PST 2022


Author: Kazu Hirata
Date: 2022-11-25T23:52:49-08:00
New Revision: edace862f63a4644c199eb8ca90b8ef1b2353b39

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

LOG: [Scalar] Use std::optional in CorrelatedValuePropagation.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/Transforms/Scalar/CorrelatedValuePropagation.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
index ea887d982b1b7..8cc5eceaec3d4 100644
--- a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
+++ b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
@@ -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);


        


More information about the llvm-commits mailing list