summaryrefslogtreecommitdiff
path: root/mlir/lib/Dialect/Affine/Utils
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/lib/Dialect/Affine/Utils')
-rw-r--r--mlir/lib/Dialect/Affine/Utils/LoopFusionUtils.cpp4
-rw-r--r--mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp21
-rw-r--r--mlir/lib/Dialect/Affine/Utils/Utils.cpp9
3 files changed, 17 insertions, 17 deletions
diff --git a/mlir/lib/Dialect/Affine/Utils/LoopFusionUtils.cpp b/mlir/lib/Dialect/Affine/Utils/LoopFusionUtils.cpp
index 59fdeb8d440b..366c090d0dcf 100644
--- a/mlir/lib/Dialect/Affine/Utils/LoopFusionUtils.cpp
+++ b/mlir/lib/Dialect/Affine/Utils/LoopFusionUtils.cpp
@@ -358,7 +358,7 @@ FusionResult mlir::canFuseLoops(AffineForOp srcForOp, AffineForOp dstForOp,
LogicalResult promoteSingleIterReductionLoop(AffineForOp forOp,
bool siblingFusionUser) {
// Check if the reduction loop is a single iteration loop.
- Optional<uint64_t> tripCount = getConstantTripCount(forOp);
+ std::optional<uint64_t> tripCount = getConstantTripCount(forOp);
if (!tripCount || *tripCount != 1)
return failure();
auto iterOperands = forOp.getIterOperands();
@@ -491,7 +491,7 @@ bool mlir::getLoopNestStats(AffineForOp forOpRoot, LoopNestStats *stats) {
// Record trip count for 'forOp'. Set flag if trip count is not
// constant.
- Optional<uint64_t> maybeConstTripCount = getConstantTripCount(forOp);
+ std::optional<uint64_t> maybeConstTripCount = getConstantTripCount(forOp);
if (!maybeConstTripCount) {
// Currently only constant trip count loop nests are supported.
LLVM_DEBUG(llvm::dbgs() << "Non-constant trip count unsupported\n");
diff --git a/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp b/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
index 9b3ec21f7797..5860086e588b 100644
--- a/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
+++ b/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
@@ -130,7 +130,7 @@ static void replaceIterArgsAndYieldResults(AffineForOp forOp) {
/// was known to have a single iteration.
// TODO: extend this for arbitrary affine bounds.
LogicalResult mlir::promoteIfSingleIteration(AffineForOp forOp) {
- Optional<uint64_t> tripCount = getConstantTripCount(forOp);
+ std::optional<uint64_t> tripCount = getConstantTripCount(forOp);
if (!tripCount || *tripCount != 1)
return failure();
@@ -791,7 +791,8 @@ constructTiledIndexSetHyperRect(MutableArrayRef<AffineForOp> origLoops,
// Bounds for intra-tile loops.
for (unsigned i = 0; i < width; i++) {
int64_t largestDiv = getLargestDivisorOfTripCount(origLoops[i]);
- Optional<uint64_t> mayBeConstantCount = getConstantTripCount(origLoops[i]);
+ std::optional<uint64_t> mayBeConstantCount =
+ getConstantTripCount(origLoops[i]);
// The lower bound is just the tile-space loop.
AffineMap lbMap = b.getDimIdentityMap();
newLoops[width + i].setLowerBound(
@@ -971,7 +972,7 @@ void mlir::getTileableBands(func::FuncOp f,
/// Unrolls this loop completely.
LogicalResult mlir::loopUnrollFull(AffineForOp forOp) {
- Optional<uint64_t> mayBeConstantTripCount = getConstantTripCount(forOp);
+ std::optional<uint64_t> mayBeConstantTripCount = getConstantTripCount(forOp);
if (mayBeConstantTripCount.has_value()) {
uint64_t tripCount = *mayBeConstantTripCount;
if (tripCount == 0)
@@ -987,7 +988,7 @@ LogicalResult mlir::loopUnrollFull(AffineForOp forOp) {
/// whichever is lower.
LogicalResult mlir::loopUnrollUpToFactor(AffineForOp forOp,
uint64_t unrollFactor) {
- Optional<uint64_t> mayBeConstantTripCount = getConstantTripCount(forOp);
+ std::optional<uint64_t> mayBeConstantTripCount = getConstantTripCount(forOp);
if (mayBeConstantTripCount.has_value() &&
*mayBeConstantTripCount < unrollFactor)
return loopUnrollByFactor(forOp, *mayBeConstantTripCount);
@@ -1093,7 +1094,7 @@ LogicalResult mlir::loopUnrollByFactor(
bool cleanUpUnroll) {
assert(unrollFactor > 0 && "unroll factor should be positive");
- Optional<uint64_t> mayBeConstantTripCount = getConstantTripCount(forOp);
+ std::optional<uint64_t> mayBeConstantTripCount = getConstantTripCount(forOp);
if (unrollFactor == 1) {
if (mayBeConstantTripCount && *mayBeConstantTripCount == 1 &&
failed(promoteIfSingleIteration(forOp)))
@@ -1156,7 +1157,7 @@ LogicalResult mlir::loopUnrollByFactor(
LogicalResult mlir::loopUnrollJamUpToFactor(AffineForOp forOp,
uint64_t unrollJamFactor) {
- Optional<uint64_t> mayBeConstantTripCount = getConstantTripCount(forOp);
+ std::optional<uint64_t> mayBeConstantTripCount = getConstantTripCount(forOp);
if (mayBeConstantTripCount.has_value() &&
*mayBeConstantTripCount < unrollJamFactor)
return loopUnrollJamByFactor(forOp, *mayBeConstantTripCount);
@@ -1209,7 +1210,7 @@ LogicalResult mlir::loopUnrollJamByFactor(AffineForOp forOp,
uint64_t unrollJamFactor) {
assert(unrollJamFactor > 0 && "unroll jam factor should be positive");
- Optional<uint64_t> mayBeConstantTripCount = getConstantTripCount(forOp);
+ std::optional<uint64_t> mayBeConstantTripCount = getConstantTripCount(forOp);
if (unrollJamFactor == 1) {
if (mayBeConstantTripCount && *mayBeConstantTripCount == 1 &&
failed(promoteIfSingleIteration(forOp)))
@@ -2095,7 +2096,7 @@ static LogicalResult generateCopy(
std::vector<SmallVector<int64_t, 4>> lbs;
SmallVector<int64_t, 8> lbDivisors;
lbs.reserve(rank);
- Optional<int64_t> numElements = region.getConstantBoundingSizeAndShape(
+ std::optional<int64_t> numElements = region.getConstantBoundingSizeAndShape(
&fastBufferShape, &lbs, &lbDivisors);
if (!numElements) {
LLVM_DEBUG(llvm::dbgs() << "Non-constant region size not supported\n");
@@ -2376,7 +2377,7 @@ static bool getFullMemRefAsRegion(Operation *op, unsigned numParamLoopIVs,
LogicalResult mlir::affineDataCopyGenerate(Block::iterator begin,
Block::iterator end,
const AffineCopyOptions &copyOptions,
- Optional<Value> filterMemRef,
+ std::optional<Value> filterMemRef,
DenseSet<Operation *> &copyNests) {
if (begin == end)
return success();
@@ -2565,7 +2566,7 @@ LogicalResult mlir::affineDataCopyGenerate(Block::iterator begin,
// an AffineForOp.
LogicalResult mlir::affineDataCopyGenerate(AffineForOp forOp,
const AffineCopyOptions &copyOptions,
- Optional<Value> filterMemRef,
+ std::optional<Value> filterMemRef,
DenseSet<Operation *> &copyNests) {
return affineDataCopyGenerate(forOp.getBody()->begin(),
std::prev(forOp.getBody()->end()), copyOptions,
diff --git a/mlir/lib/Dialect/Affine/Utils/Utils.cpp b/mlir/lib/Dialect/Affine/Utils/Utils.cpp
index 9140031e5d39..180fef853e20 100644
--- a/mlir/lib/Dialect/Affine/Utils/Utils.cpp
+++ b/mlir/lib/Dialect/Affine/Utils/Utils.cpp
@@ -217,10 +217,9 @@ mlir::Value mlir::expandAffineExpr(OpBuilder &builder, Location loc,
/// Create a sequence of operations that implement the `affineMap` applied to
/// the given `operands` (as it it were an AffineApplyOp).
-Optional<SmallVector<Value, 8>> mlir::expandAffineMap(OpBuilder &builder,
- Location loc,
- AffineMap affineMap,
- ValueRange operands) {
+std::optional<SmallVector<Value, 8>>
+mlir::expandAffineMap(OpBuilder &builder, Location loc, AffineMap affineMap,
+ ValueRange operands) {
auto numDims = affineMap.getNumDims();
auto expanded = llvm::to_vector<8>(
llvm::map_range(affineMap.getResults(),
@@ -1817,7 +1816,7 @@ MemRefType mlir::normalizeMemRefType(MemRefType memrefType,
newShape[d] = ShapedType::kDynamic;
} else {
// The lower bound for the shape is always zero.
- Optional<int64_t> ubConst =
+ std::optional<int64_t> ubConst =
fac.getConstantBound64(IntegerPolyhedron::UB, d);
// For a static memref and an affine map with no symbols, this is
// always bounded. However, when we have symbols, we may not be able to