[Mlir-commits] [mlir] e3915e6 - [Analysis] Use std::optional in LoopAnalysis.cpp (NFC)

Kazu Hirata llvmlistbot at llvm.org
Sat Dec 10 10:46:14 PST 2022


Author: Kazu Hirata
Date: 2022-12-10T10:46:08-08:00
New Revision: e3915e6bb435b6aa3b4ff4638755246d1e91aad6

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

LOG: [Analysis] Use std::optional in LoopAnalysis.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/Dialect/Affine/Analysis/LoopAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Affine/Analysis/LoopAnalysis.cpp b/mlir/lib/Dialect/Affine/Analysis/LoopAnalysis.cpp
index 375a113558d5..0a9fd6042aa2 100644
--- a/mlir/lib/Dialect/Affine/Analysis/LoopAnalysis.cpp
+++ b/mlir/lib/Dialect/Affine/Analysis/LoopAnalysis.cpp
@@ -24,6 +24,7 @@
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallString.h"
 #include <numeric>
+#include <optional>
 #include <type_traits>
 
 using namespace mlir;
@@ -119,7 +120,7 @@ uint64_t mlir::getLargestDivisorOfTripCount(AffineForOp forOp) {
   // The largest divisor of the trip count is the GCD of the individual largest
   // divisors.
   assert(map.getNumResults() >= 1 && "expected one or more results");
-  Optional<uint64_t> gcd;
+  std::optional<uint64_t> gcd;
   for (auto resultExpr : map.getResults()) {
     uint64_t thisGcd;
     if (auto constExpr = resultExpr.dyn_cast<AffineConstantExpr>()) {


        


More information about the Mlir-commits mailing list