[Mlir-commits] [mlir] f09b0e3 - [mlir] Replace None with std::nullopt in comments (NFC)
Kazu Hirata
llvmlistbot at llvm.org
Mon May 8 20:23:43 PDT 2023
Author: Kazu Hirata
Date: 2023-05-08T20:23:31-07:00
New Revision: f09b0e35b6d8f19385f37b213b029a7ca9cb6368
URL: https://github.com/llvm/llvm-project/commit/f09b0e35b6d8f19385f37b213b029a7ca9cb6368
DIFF: https://github.com/llvm/llvm-project/commit/f09b0e35b6d8f19385f37b213b029a7ca9cb6368.diff
LOG: [mlir] Replace None with std::nullopt in comments (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/include/mlir/Analysis/DataFlow/DeadCodeAnalysis.h
mlir/include/mlir/IR/OpImplementation.h
mlir/include/mlir/Tools/PDLL/AST/Nodes.h
mlir/lib/Analysis/DataFlow/DeadCodeAnalysis.cpp
mlir/lib/Dialect/Affine/IR/AffineOps.cpp
mlir/lib/Dialect/Utils/ReshapeOpsUtils.cpp
mlir/test/lib/Analysis/DataFlow/TestDenseDataFlowAnalysis.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Analysis/DataFlow/DeadCodeAnalysis.h b/mlir/include/mlir/Analysis/DataFlow/DeadCodeAnalysis.h
index 311b81ae90104..035566fbc1575 100644
--- a/mlir/include/mlir/Analysis/DataFlow/DeadCodeAnalysis.h
+++ b/mlir/include/mlir/Analysis/DataFlow/DeadCodeAnalysis.h
@@ -219,8 +219,8 @@ class DeadCodeAnalysis : public DataFlowAnalysis {
/// Mark the entry blocks of the operation as executable.
void markEntryBlocksLive(Operation *op);
- /// Get the constant values of the operands of the operation. Returns none if
- /// any of the operand lattices are uninitialized.
+ /// Get the constant values of the operands of the operation. Returns
+ /// std::nullopt if any of the operand lattices are uninitialized.
std::optional<SmallVector<Attribute>> getOperandValues(Operation *op);
/// The top-level operation the analysis is running on. This is used to detect
diff --git a/mlir/include/mlir/IR/OpImplementation.h b/mlir/include/mlir/IR/OpImplementation.h
index e770c7453129b..f4045b236a448 100644
--- a/mlir/include/mlir/IR/OpImplementation.h
+++ b/mlir/include/mlir/IR/OpImplementation.h
@@ -778,7 +778,7 @@ class AsmParser {
/// The parsed keyword itself.
StringRef keyword;
- /// The result of the switch statement or none if currently unknown.
+ /// The result of the switch statement or std::nullopt if currently unknown.
std::optional<ResultT> result;
};
diff --git a/mlir/include/mlir/Tools/PDLL/AST/Nodes.h b/mlir/include/mlir/Tools/PDLL/AST/Nodes.h
index 5e86cda27a5b7..3b29d48fb07bd 100644
--- a/mlir/include/mlir/Tools/PDLL/AST/Nodes.h
+++ b/mlir/include/mlir/Tools/PDLL/AST/Nodes.h
@@ -1009,7 +1009,7 @@ class OpNameDecl : public Node::NodeBase<OpNameDecl, Decl> {
static OpNameDecl *create(Context &ctx, const Name &name);
static OpNameDecl *create(Context &ctx, SMRange loc);
- /// Return the name of this operation, or none if the name is unknown.
+ /// Return the name of this operation, or std::nullopt if the name is unknown.
std::optional<StringRef> getName() const {
const Name *name = Decl::getName();
return name ? std::optional<StringRef>(name->getName()) : std::nullopt;
diff --git a/mlir/lib/Analysis/DataFlow/DeadCodeAnalysis.cpp b/mlir/lib/Analysis/DataFlow/DeadCodeAnalysis.cpp
index 2415ff48144bc..8ff71b59750a8 100644
--- a/mlir/lib/Analysis/DataFlow/DeadCodeAnalysis.cpp
+++ b/mlir/lib/Analysis/DataFlow/DeadCodeAnalysis.cpp
@@ -309,8 +309,8 @@ void DeadCodeAnalysis::visitCallOperation(CallOpInterface call) {
}
/// Get the constant values of the operands of an operation. If any of the
-/// constant value lattices are uninitialized, return none to indicate the
-/// analysis should bail out.
+/// constant value lattices are uninitialized, return std::nullopt to indicate
+/// the analysis should bail out.
static std::optional<SmallVector<Attribute>> getOperandValuesImpl(
Operation *op,
function_ref<const Lattice<ConstantValue> *(Value)> getLattice) {
diff --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
index 7a0f1e0983c7b..f3626afcd7059 100644
--- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
+++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
@@ -707,7 +707,7 @@ static std::optional<int64_t> getUpperBound(Value iv) {
/// expressions (w.r.t constant coefficients) so as to not depend on anything
/// heavyweight in `Analysis`. Expressions of the form: c0*d0 + c1*d1 + c2*s0 +
/// ... + c_n are handled. Expressions involving floordiv, ceildiv, mod or
-/// semi-affine ones will lead a none being returned.
+/// semi-affine ones will lead std::nullopt being returned.
static std::optional<int64_t>
getBoundForExpr(AffineExpr expr, unsigned numDims, unsigned numSymbols,
ArrayRef<std::optional<int64_t>> constLowerBounds,
diff --git a/mlir/lib/Dialect/Utils/ReshapeOpsUtils.cpp b/mlir/lib/Dialect/Utils/ReshapeOpsUtils.cpp
index 18646f598bcee..94fa2d3de22fb 100644
--- a/mlir/lib/Dialect/Utils/ReshapeOpsUtils.cpp
+++ b/mlir/lib/Dialect/Utils/ReshapeOpsUtils.cpp
@@ -356,7 +356,7 @@ SliceFromCollapseHelper::getInsertSliceParams(MLIRContext *ctx,
/// Returns the index of the only non-unit dimension among `indices` of `shape`,
/// if such a dimension exists and `indices` has more than one element.
-/// Otherwise, return none.
+/// Otherwise, return std::nullopt.
static std::optional<int64_t> getUniqueNonUnitDim(ArrayRef<int64_t> indices,
ArrayRef<int64_t> shape) {
// Return false if more than one of the dimensions in this group are not 1.
diff --git a/mlir/test/lib/Analysis/DataFlow/TestDenseDataFlowAnalysis.cpp b/mlir/test/lib/Analysis/DataFlow/TestDenseDataFlowAnalysis.cpp
index e9769c10e63fe..733a146469498 100644
--- a/mlir/test/lib/Analysis/DataFlow/TestDenseDataFlowAnalysis.cpp
+++ b/mlir/test/lib/Analysis/DataFlow/TestDenseDataFlowAnalysis.cpp
@@ -100,7 +100,7 @@ class LastModification : public AbstractDenseLattice {
return result;
}
- /// Get the last modifications of a value. Returns none if the last
+ /// Get the last modifications of a value. Returns std::nullopt if the last
/// modifications are not known.
std::optional<ArrayRef<Operation *>> getLastModifiers(Value value) const {
auto it = lastMods.find(value);
More information about the Mlir-commits
mailing list