[Mlir-commits] [mlir] 2122c8a - [Presburger] Use std::optional in Simplex.cpp (NFC)

Kazu Hirata llvmlistbot at llvm.org
Sat Dec 10 10:24:58 PST 2022


Author: Kazu Hirata
Date: 2022-12-10T10:24:52-08:00
New Revision: 2122c8a5467879718b4fa4f50904295970b95052

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

LOG: [Presburger] Use std::optional in Simplex.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: 
    mlir/lib/Analysis/Presburger/Simplex.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Analysis/Presburger/Simplex.cpp b/mlir/lib/Analysis/Presburger/Simplex.cpp
index 5c9d42019e8a..0bcc8ee18b81 100644
--- a/mlir/lib/Analysis/Presburger/Simplex.cpp
+++ b/mlir/lib/Analysis/Presburger/Simplex.cpp
@@ -12,6 +12,7 @@
 #include "llvm/ADT/Optional.h"
 #include "llvm/Support/Compiler.h"
 #include <numeric>
+#include <optional>
 
 using namespace mlir;
 using namespace presburger;
@@ -756,7 +757,7 @@ LogicalResult LexSimplex::restoreRationalConsistency() {
 // lexicographically smaller than B.col(k) / B(i,k), since it lexicographically
 // minimizes the change in sample value.
 LogicalResult LexSimplexBase::moveRowUnknownToColumn(unsigned row) {
-  Optional<unsigned> maybeColumn;
+  std::optional<unsigned> maybeColumn;
   for (unsigned col = 3 + nSymbol, e = getNumColumns(); col < e; ++col) {
     if (tableau(row, col) <= 0)
       continue;
@@ -866,7 +867,7 @@ unsigned LexSimplexBase::getLexMinPivotColumn(unsigned row, unsigned colA,
 /// ordering where we prefer unknowns with lower index.
 Optional<SimplexBase::Pivot> Simplex::findPivot(int row,
                                                 Direction direction) const {
-  Optional<unsigned> col;
+  std::optional<unsigned> col;
   for (unsigned j = 2, e = getNumColumns(); j < e; ++j) {
     MPInt elem = tableau(row, j);
     if (elem == 0)


        


More information about the Mlir-commits mailing list