[Mlir-commits] [mlir] 8ada9cf - [Transforms] Use std::optional in LoopFusion.cpp (NFC)
Kazu Hirata
llvmlistbot at llvm.org
Sat Dec 10 10:49:58 PST 2022
Author: Kazu Hirata
Date: 2022-12-10T10:49:53-08:00
New Revision: 8ada9cf777751a4a2f0db91a89226fa79a7e8323
URL: https://github.com/llvm/llvm-project/commit/8ada9cf777751a4a2f0db91a89226fa79a7e8323
DIFF: https://github.com/llvm/llvm-project/commit/8ada9cf777751a4a2f0db91a89226fa79a7e8323.diff
LOG: [Transforms] Use std::optional in LoopFusion.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/Transforms/LoopFusion.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp b/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
index 491dd07757185..63b7ad70f9c82 100644
--- a/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
@@ -34,6 +34,7 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include <iomanip>
+#include <optional>
#include <sstream>
namespace mlir {
@@ -436,8 +437,8 @@ struct MemRefDependenceGraph {
// operation insertion point (or return null pointer if no such
// insertion point exists: 'firstSrcDepPos' <= 'lastDstDepPos').
SmallVector<Operation *, 2> depInsts;
- Optional<unsigned> firstSrcDepPos;
- Optional<unsigned> lastDstDepPos;
+ std::optional<unsigned> firstSrcDepPos;
+ std::optional<unsigned> lastDstDepPos;
unsigned pos = 0;
for (Block::iterator it = std::next(Block::iterator(srcNodeInst));
it != Block::iterator(dstNodeInst); ++it) {
@@ -1125,10 +1126,10 @@ static bool isFusionProfitable(Operation *srcOpInst, Operation *srcStoreOpInst,
// loop nest at 'dstLoopDepth'.
uint64_t minFusedLoopNestComputeCost = std::numeric_limits<uint64_t>::max();
double maxStorageReduction = 0.0;
- Optional<uint64_t> sliceMemEstimate;
+ std::optional<uint64_t> sliceMemEstimate;
// The best loop depth at which to materialize the slice.
- Optional<unsigned> bestDstLoopDepth;
+ std::optional<unsigned> bestDstLoopDepth;
// Compute op instance count for the src loop nest without iteration slicing.
uint64_t srcLoopNestCost = getComputeCost(srcLoopIVs[0], srcLoopNestStats);
@@ -1261,7 +1262,7 @@ static bool isFusionProfitable(Operation *srcOpInst, Operation *srcStoreOpInst,
auto dstMemSize = getMemoryFootprintBytes(dstForOp);
auto srcMemSize = getMemoryFootprintBytes(srcLoopIVs[0]);
- Optional<double> storageReduction;
+ std::optional<double> storageReduction;
if (!dstMemSize || !srcMemSize) {
LLVM_DEBUG(llvm::dbgs()
More information about the Mlir-commits
mailing list