[Mlir-commits] [mlir] 70c73d1 - [mlir] Use std::nullopt instead of None in comments (NFC)
Kazu Hirata
llvmlistbot at llvm.org
Sun Dec 4 17:23:57 PST 2022
Author: Kazu Hirata
Date: 2022-12-04T17:23:50-08:00
New Revision: 70c73d1b7274bcff2bfb2e688fe7eabbf2fbf889
URL: https://github.com/llvm/llvm-project/commit/70c73d1b7274bcff2bfb2e688fe7eabbf2fbf889
DIFF: https://github.com/llvm/llvm-project/commit/70c73d1b7274bcff2bfb2e688fe7eabbf2fbf889.diff
LOG: [mlir] Use std::nullopt instead of None 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/Conversion/MemRefToSPIRV/MemRefToSPIRV.h
mlir/include/mlir/Dialect/Affine/Analysis/Utils.h
mlir/include/mlir/Dialect/Linalg/Analysis/DependenceAnalysis.h
mlir/include/mlir/Dialect/MemRef/IR/MemRef.h
mlir/include/mlir/Dialect/SCF/IR/SCFOps.td
mlir/include/mlir/Dialect/SPIRV/IR/TargetAndABI.h
mlir/include/mlir/Dialect/Utils/IndexingUtils.h
mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h
mlir/include/mlir/IR/BuiltinAttributeInterfaces.td
mlir/include/mlir/IR/BuiltinAttributes.h
mlir/include/mlir/IR/BuiltinAttributes.td
mlir/include/mlir/IR/BuiltinTypes.h
mlir/include/mlir/IR/Operation.h
mlir/include/mlir/IR/OperationSupport.h
mlir/include/mlir/IR/PatternMatch.h
mlir/include/mlir/IR/SymbolTable.h
mlir/include/mlir/TableGen/CodeGenHelpers.h
mlir/include/mlir/TableGen/Type.h
mlir/include/mlir/Tools/PDLL/AST/Nodes.h
mlir/include/mlir/Transforms/DialectConversion.h
mlir/lib/Analysis/Presburger/Simplex.cpp
mlir/lib/AsmParser/AttributeParser.cpp
mlir/lib/AsmParser/Token.cpp
mlir/lib/AsmParser/Token.h
mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRV.cpp
mlir/lib/Dialect/Affine/Analysis/Utils.cpp
mlir/lib/Dialect/Arith/IR/InferIntRangeInterfaceImpls.cpp
mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp
mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp
mlir/lib/Dialect/SCF/IR/SCF.cpp
mlir/lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp
mlir/lib/Dialect/SPIRV/Transforms/UnifyAliasedResourcePass.cpp
mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
mlir/lib/Dialect/Traits.cpp
mlir/lib/Dialect/Vector/Transforms/VectorUnroll.cpp
mlir/lib/IR/BuiltinAttributes.cpp
mlir/lib/IR/BuiltinTypes.cpp
mlir/lib/IR/SymbolTable.cpp
mlir/lib/TableGen/CodeGenHelpers.cpp
mlir/lib/TableGen/Type.cpp
mlir/lib/Tools/lsp-server-support/SourceMgrUtils.h
mlir/lib/Tools/lsp-server-support/Transport.cpp
mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
mlir/tools/mlir-tblgen/DialectGenUtilities.h
mlir/tools/mlir-tblgen/EnumsGen.cpp
mlir/tools/mlir-tblgen/OpFormatGen.cpp
mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Conversion/MemRefToSPIRV/MemRefToSPIRV.h b/mlir/include/mlir/Conversion/MemRefToSPIRV/MemRefToSPIRV.h
index dbc6c64aa6230..48a82b19501c3 100644
--- a/mlir/include/mlir/Conversion/MemRefToSPIRV/MemRefToSPIRV.h
+++ b/mlir/include/mlir/Conversion/MemRefToSPIRV/MemRefToSPIRV.h
@@ -26,17 +26,19 @@ using MemorySpaceToStorageClassMap =
std::function<Optional<spirv::StorageClass>(Attribute)>;
/// Maps MemRef memory spaces to storage classes for Vulkan-flavored SPIR-V
-/// using the default rule. Returns None if the memory space is unknown.
+/// using the default rule. Returns std::nullopt if the memory space is unknown.
Optional<spirv::StorageClass> mapMemorySpaceToVulkanStorageClass(Attribute);
/// Maps storage classes for Vulkan-flavored SPIR-V to MemRef memory spaces
-/// using the default rule. Returns None if the storage class is unsupported.
+/// using the default rule. Returns std::nullopt if the storage class is
+/// unsupported.
Optional<unsigned> mapVulkanStorageClassToMemorySpace(spirv::StorageClass);
/// Maps MemRef memory spaces to storage classes for OpenCL-flavored SPIR-V
-/// using the default rule. Returns None if the memory space is unknown.
+/// using the default rule. Returns std::nullopt if the memory space is unknown.
Optional<spirv::StorageClass> mapMemorySpaceToOpenCLStorageClass(Attribute);
/// Maps storage classes for OpenCL-flavored SPIR-V to MemRef memory spaces
-/// using the default rule. Returns None if the storage class is unsupported.
+/// using the default rule. Returns std::nullopt if the storage class is
+/// unsupported.
Optional<unsigned> mapOpenCLStorageClassToMemorySpace(spirv::StorageClass);
/// Type converter for converting numeric MemRef memory spaces into SPIR-V
diff --git a/mlir/include/mlir/Dialect/Affine/Analysis/Utils.h b/mlir/include/mlir/Dialect/Affine/Analysis/Utils.h
index 9caa589a69bff..b75cabb70b36c 100644
--- a/mlir/include/mlir/Dialect/Affine/Analysis/Utils.h
+++ b/mlir/include/mlir/Dialect/Affine/Analysis/Utils.h
@@ -110,7 +110,7 @@ struct ComputationSliceState {
bool isEmpty() const { return ivs.empty(); }
/// Returns true if the computation slice encloses all the iterations of the
- /// sliced loop nest. Returns false if it does not. Returns llvm::None if it
+ /// sliced loop nest. Returns false if it does not. Returns std::nullopt if it
/// cannot determine if the slice is maximal or not.
// TODO: Cache 'isMaximal' so that we don't recompute it when the slice
// information hasn't changed.
diff --git a/mlir/include/mlir/Dialect/Linalg/Analysis/DependenceAnalysis.h b/mlir/include/mlir/Dialect/Linalg/Analysis/DependenceAnalysis.h
index a82d25a4c2114..ff043dbc14088 100644
--- a/mlir/include/mlir/Dialect/Linalg/Analysis/DependenceAnalysis.h
+++ b/mlir/include/mlir/Dialect/Linalg/Analysis/DependenceAnalysis.h
@@ -76,7 +76,7 @@ class LinalgDependenceGraph {
return opView.get<Value>();
}
// Return the indexing map of the operand/result in `opView` specified in
- // the owning LinalgOp. If the owner is not a LinalgOp returns llvm::None.
+ // the owning LinalgOp. If the owner is not a LinalgOp returns std::nullopt.
static Optional<AffineMap> getIndexingMap(OpView opView) {
auto owner = dyn_cast<LinalgOp>(getOwner(opView));
if (!owner)
@@ -87,7 +87,7 @@ class LinalgDependenceGraph {
opView.get<Value>().cast<OpResult>().getResultNumber()));
}
// Return the operand number if the `opView` is an OpOperand *. Otherwise
- // return llvm::None.
+ // return std::nullopt.
static Optional<unsigned> getOperandNumber(OpView opView) {
if (OpOperand *operand = opView.dyn_cast<OpOperand *>())
return operand->getOperandNumber();
@@ -126,13 +126,13 @@ class LinalgDependenceGraph {
}
// If the dependent OpView is a result value, return the result
- // number. Return llvm::None otherwise.
+ // number. Return std::nullopt otherwise.
Optional<unsigned> getDependentOpViewResultNum() const {
return getResultNumber(dependentOpView);
}
// If the dependent OpView is a result value, return the result
- // number. Return llvm::None otherwise.
+ // number. Return std::nullopt otherwise.
Optional<unsigned> getIndexingOpViewResultNum() const {
return getResultNumber(indexingOpView);
}
diff --git a/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h b/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h
index 6538abceb6293..9932f36e5f1bf 100644
--- a/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h
+++ b/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h
@@ -50,8 +50,8 @@ LogicalResult foldMemRefCast(Operation *op, Value inner = nullptr);
Type getTensorTypeFromMemRefType(Type type);
/// Finds a single dealloc operation for the given allocated value. If there
-/// are > 1 deallocates for `allocValue`, returns None, else returns the single
-/// deallocate if it exists or nullptr.
+/// are > 1 deallocates for `allocValue`, returns std::nullopt, else returns the
+/// single deallocate if it exists or nullptr.
Optional<Operation *> findDealloc(Value allocValue);
} // namespace memref
diff --git a/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td b/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td
index 60f254863cb12..fbee86b0a0ce1 100644
--- a/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td
+++ b/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td
@@ -273,7 +273,7 @@ def ForOp : SCF_Op<"for",
return getOperation()->getNumOperands() - getNumControlOperands();
}
/// Get the iter arg number for an operand. If it isnt an iter arg
- /// operand return llvm::None.
+ /// operand return std::nullopt.
Optional<unsigned> getIterArgNumberForOpOperand(OpOperand &opOperand) {
if (opOperand.getOwner() != getOperation())
return std::nullopt;
diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/TargetAndABI.h b/mlir/include/mlir/Dialect/SPIRV/IR/TargetAndABI.h
index 0f5e40e06d5a6..48c08cfa69b52 100644
--- a/mlir/include/mlir/Dialect/SPIRV/IR/TargetAndABI.h
+++ b/mlir/include/mlir/Dialect/SPIRV/IR/TargetAndABI.h
@@ -34,13 +34,13 @@ class TargetEnv {
/// Returns true if the given capability is allowed.
bool allows(Capability) const;
/// Returns the first allowed one if any of the given capabilities is allowed.
- /// Returns llvm::None otherwise.
+ /// Returns std::nullopt otherwise.
Optional<Capability> allows(ArrayRef<Capability>) const;
/// Returns true if the given extension is allowed.
bool allows(Extension) const;
/// Returns the first allowed one if any of the given extensions is allowed.
- /// Returns llvm::None otherwise.
+ /// Returns std::nullopt otherwise.
Optional<Extension> allows(ArrayRef<Extension>) const;
/// Returns the vendor ID.
diff --git a/mlir/include/mlir/Dialect/Utils/IndexingUtils.h b/mlir/include/mlir/Dialect/Utils/IndexingUtils.h
index bc58c127e1624..e9493e26d48e5 100644
--- a/mlir/include/mlir/Dialect/Utils/IndexingUtils.h
+++ b/mlir/include/mlir/Dialect/Utils/IndexingUtils.h
@@ -44,16 +44,17 @@ SmallVector<int64_t> computeElementwiseMul(ArrayRef<int64_t> v1,
/// Compute and return the multi-dimensional integral ratio of `subShape` to
/// the trailing dimensions of `shape`. This represents how many times
/// `subShape` fits within `shape`.
-/// If integral division is not possible, return None.
+/// If integral division is not possible, return std::nullopt.
/// The trailing `subShape.size()` entries of both shapes are assumed (and
/// enforced) to only contain noonnegative values.
///
/// Examples:
/// - shapeRatio({3, 5, 8}, {2, 5, 2}) returns {3, 2, 1}.
-/// - shapeRatio({3, 8}, {2, 5, 2}) returns None (subshape has higher rank).
+/// - shapeRatio({3, 8}, {2, 5, 2}) returns std::nullopt (subshape has higher
+/// rank).
/// - shapeRatio({42, 2, 10, 32}, {2, 5, 2}) returns {42, 1, 2, 16} which is
/// derived as {42(leading shape dim), 2/2, 10/5, 32/2}.
-/// - shapeRatio({42, 2, 11, 32}, {2, 5, 2}) returns None which is
+/// - shapeRatio({42, 2, 11, 32}, {2, 5, 2}) returns std::nullopt which is
/// derived as {42(leading shape dim), 2/2, 11/5(not divisible), 32/2}.
Optional<SmallVector<int64_t>> computeShapeRatio(ArrayRef<int64_t> shape,
ArrayRef<int64_t> subShape);
diff --git a/mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h b/mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h
index bc5bbc74d8f3b..0711aa3ba80d0 100644
--- a/mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h
+++ b/mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h
@@ -64,7 +64,7 @@ SmallVector<ReassociationIndices, 2> convertReassociationMapsToIndices(
OpBuilder &b, ArrayRef<ReassociationExprs> reassociationExprs);
/// Return the reassociations maps to use to reshape given the source type and
-/// the target type when possible. Return llvm::None when this computation
+/// the target type when possible. Return std::nullopt when this computation
/// failed.
Optional<SmallVector<ReassociationIndices>>
getReassociationIndicesForReshape(ShapedType sourceType, ShapedType targetType);
diff --git a/mlir/include/mlir/IR/BuiltinAttributeInterfaces.td b/mlir/include/mlir/IR/BuiltinAttributeInterfaces.td
index 22e91f1e1abb2..72cba52ed26ec 100644
--- a/mlir/include/mlir/IR/BuiltinAttributeInterfaces.td
+++ b/mlir/include/mlir/IR/BuiltinAttributeInterfaces.td
@@ -393,7 +393,7 @@ def ElementsAttrInterface : AttrInterface<"ElementsAttr"> {
// Failable Value Iteration
/// If this attribute supports iterating over element values of type `T`,
- /// return the iterable range. Otherwise, return llvm::None.
+ /// return the iterable range. Otherwise, return std::nullopt.
template <typename T>
DefaultValueCheckT<T, Optional<iterator_range<T>>> tryGetValues() const {
if (Optional<iterator<T>> beginIt = try_value_begin<T>())
@@ -404,7 +404,7 @@ def ElementsAttrInterface : AttrInterface<"ElementsAttr"> {
DefaultValueCheckT<T, Optional<iterator<T>>> try_value_begin() const;
/// If this attribute supports iterating over element values of type `T`,
- /// return the iterable range. Otherwise, return llvm::None.
+ /// return the iterable range. Otherwise, return std::nullopt.
template <typename T, typename = DerivedAttrValueCheckT<T>>
Optional<DerivedAttrValueIteratorRange<T>> tryGetValues() const {
auto values = tryGetValues<Attribute>();
diff --git a/mlir/include/mlir/IR/BuiltinAttributes.h b/mlir/include/mlir/IR/BuiltinAttributes.h
index e6902fb750301..f9365ef5cd48f 100644
--- a/mlir/include/mlir/IR/BuiltinAttributes.h
+++ b/mlir/include/mlir/IR/BuiltinAttributes.h
@@ -784,7 +784,7 @@ class DenseResourceElementsAttrBase : public DenseResourceElementsAttr {
get(ShapedType type, StringRef blobName, AsmResourceBlob blob);
/// Return the data of this attribute as an ArrayRef<T> if it is present,
- /// returns None otherwise.
+ /// returns std::nullopt otherwise.
Optional<ArrayRef<T>> tryGetAsArrayRef() const;
/// Support for isa<>/cast<>.
diff --git a/mlir/include/mlir/IR/BuiltinAttributes.td b/mlir/include/mlir/IR/BuiltinAttributes.td
index fc0f696cefc28..1a06c92e725ef 100644
--- a/mlir/include/mlir/IR/BuiltinAttributes.td
+++ b/mlir/include/mlir/IR/BuiltinAttributes.td
@@ -576,7 +576,7 @@ def Builtin_DictionaryAttr : Builtin_Attr<"Dictionary", [
static bool sortInPlace(SmallVectorImpl<NamedAttribute> &array);
/// Returns an entry with a duplicate name in `array`, if it exists, else
- /// returns llvm::None. If `isSorted` is true, the array is assumed to be
+ /// returns std::nullopt. If `isSorted` is true, the array is assumed to be
/// sorted else it will be sorted in place before finding the duplicate entry.
static Optional<NamedAttribute>
findDuplicate(SmallVectorImpl<NamedAttribute> &array, bool isSorted);
diff --git a/mlir/include/mlir/IR/BuiltinTypes.h b/mlir/include/mlir/IR/BuiltinTypes.h
index 03fc70937c2db..5aeea57c96716 100644
--- a/mlir/include/mlir/IR/BuiltinTypes.h
+++ b/mlir/include/mlir/IR/BuiltinTypes.h
@@ -335,8 +335,8 @@ class VectorType::Builder {
/// `reducedShape`. The returned mask can be applied as a projection to
/// `originalShape` to obtain the `reducedShape`. This mask is useful to track
/// which dimensions must be kept when e.g. compute MemRef strides under
-/// rank-reducing operations. Return None if reducedShape cannot be obtained
-/// by dropping only `1` entries in `originalShape`.
+/// rank-reducing operations. Return std::nullopt if reducedShape cannot be
+/// obtained by dropping only `1` entries in `originalShape`.
llvm::Optional<llvm::SmallDenseSet<unsigned>>
computeRankReductionMask(ArrayRef<int64_t> originalShape,
ArrayRef<int64_t> reducedShape);
diff --git a/mlir/include/mlir/IR/Operation.h b/mlir/include/mlir/IR/Operation.h
index 6ac6c0b0ba656..b7945710bd701 100644
--- a/mlir/include/mlir/IR/Operation.h
+++ b/mlir/include/mlir/IR/Operation.h
@@ -50,7 +50,7 @@ class alignas(8) Operation final
OperationName getName() { return name; }
/// If this operation has a registered operation description, return it.
- /// Otherwise return None.
+ /// Otherwise return std::nullopt.
Optional<RegisteredOperationName> getRegisteredInfo() {
return getName().getRegisteredInfo();
}
diff --git a/mlir/include/mlir/IR/OperationSupport.h b/mlir/include/mlir/IR/OperationSupport.h
index 576a4ecc6f49a..586b6cd5e3bd8 100644
--- a/mlir/include/mlir/IR/OperationSupport.h
+++ b/mlir/include/mlir/IR/OperationSupport.h
@@ -251,7 +251,7 @@ inline llvm::hash_code hash_value(OperationName arg) {
class RegisteredOperationName : public OperationName {
public:
/// Lookup the registered operation information for the given operation.
- /// Returns None if the operation isn't registered.
+ /// Returns std::nullopt if the operation isn't registered.
static Optional<RegisteredOperationName> lookup(StringRef name,
MLIRContext *ctx);
@@ -464,8 +464,8 @@ Attribute getAttrFromSortedRange(IteratorT first, IteratorT last, NameT name) {
return result.second ? result.first->getValue() : Attribute();
}
-/// Get an attribute from a sorted range of named attributes. Returns None if
-/// the attribute was not found.
+/// Get an attribute from a sorted range of named attributes. Returns
+/// std::nullopt if the attribute was not found.
template <typename IteratorT, typename NameT>
Optional<NamedAttribute>
getNamedAttrFromSortedRange(IteratorT first, IteratorT last, NameT name) {
@@ -554,7 +554,7 @@ class NamedAttrList {
void pop_back() { attrs.pop_back(); }
/// Returns an entry with a duplicate name the list, if it exists, else
- /// returns llvm::None.
+ /// returns std::nullopt.
Optional<NamedAttribute> findDuplicate() const;
/// Return a dictionary attribute for the underlying dictionary. This will
diff --git a/mlir/include/mlir/IR/PatternMatch.h b/mlir/include/mlir/IR/PatternMatch.h
index e59ec8d73b7ae..e548dc9e708bc 100644
--- a/mlir/include/mlir/IR/PatternMatch.h
+++ b/mlir/include/mlir/IR/PatternMatch.h
@@ -88,7 +88,7 @@ class Pattern {
ArrayRef<OperationName> getGeneratedOps() const { return generatedOps; }
/// Return the root node that this pattern matches. Patterns that can match
- /// multiple root types return None.
+ /// multiple root types return std::nullopt.
Optional<OperationName> getRootKind() const {
if (rootKind == RootKind::OperationName)
return OperationName::getFromOpaquePointer(rootValue);
@@ -97,7 +97,7 @@ class Pattern {
/// Return the interface ID used to match the root operation of this pattern.
/// If the pattern does not use an interface ID for deciding the root match,
- /// this returns None.
+ /// this returns std::nullopt.
Optional<TypeID> getRootInterfaceID() const {
if (rootKind == RootKind::InterfaceID)
return TypeID::getFromOpaquePointer(rootValue);
@@ -106,7 +106,7 @@ class Pattern {
/// Return the trait ID used to match the root operation of this pattern.
/// If the pattern does not use a trait ID for deciding the root match, this
- /// returns None.
+ /// returns std::nullopt.
Optional<TypeID> getRootTraitID() const {
if (rootKind == RootKind::TraitID)
return TypeID::getFromOpaquePointer(rootValue);
diff --git a/mlir/include/mlir/IR/SymbolTable.h b/mlir/include/mlir/IR/SymbolTable.h
index 7e7d31cc1bdd5..6addd72be1fbf 100644
--- a/mlir/include/mlir/IR/SymbolTable.h
+++ b/mlir/include/mlir/IR/SymbolTable.h
@@ -179,15 +179,15 @@ class SymbolTable {
/// Get an iterator range for all of the uses, for any symbol, that are nested
/// within the given operation 'from'. This does not traverse into any nested
- /// symbol tables. This function returns None if there are any unknown
+ /// symbol tables. This function returns std::nullopt if there are any unknown
/// operations that may potentially be symbol tables.
static Optional<UseRange> getSymbolUses(Operation *from);
static Optional<UseRange> getSymbolUses(Region *from);
/// Get all of the uses of the given symbol that are nested within the given
/// operation 'from'. This does not traverse into any nested symbol tables.
- /// This function returns None if there are any unknown operations that may
- /// potentially be symbol tables.
+ /// This function returns std::nullopt if there are any unknown operations
+ /// that may potentially be symbol tables.
static Optional<UseRange> getSymbolUses(StringAttr symbol, Operation *from);
static Optional<UseRange> getSymbolUses(Operation *symbol, Operation *from);
static Optional<UseRange> getSymbolUses(StringAttr symbol, Region *from);
diff --git a/mlir/include/mlir/TableGen/CodeGenHelpers.h b/mlir/include/mlir/TableGen/CodeGenHelpers.h
index ecde28f73138e..90eff6d3551a0 100644
--- a/mlir/include/mlir/TableGen/CodeGenHelpers.h
+++ b/mlir/include/mlir/TableGen/CodeGenHelpers.h
@@ -135,8 +135,8 @@ class StaticVerifierFunctionEmitter {
///
/// LogicalResult(Operation *op, Attribute attr, StringRef attrName);
///
- /// If a uniqued constraint was not found, this function returns None. The
- /// uniqued constraints cannot be used in the context of an OpAdaptor.
+ /// If a uniqued constraint was not found, this function returns std::nullopt.
+ /// The uniqued constraints cannot be used in the context of an OpAdaptor.
///
/// Pattern constraints have the form:
///
diff --git a/mlir/include/mlir/TableGen/Type.h b/mlir/include/mlir/TableGen/Type.h
index 7cc263faa4c21..9aaacdbe62ff5 100644
--- a/mlir/include/mlir/TableGen/Type.h
+++ b/mlir/include/mlir/TableGen/Type.h
@@ -53,7 +53,7 @@ class TypeConstraint : public Constraint {
bool isVariableLength() const { return isOptional() || isVariadic(); }
// Returns the builder call for this constraint if this is a buildable type,
- // returns None otherwise.
+ // returns std::nullopt otherwise.
Optional<StringRef> getBuilderCall() const;
// Return the C++ class name for this type (which may just be ::mlir::Type).
diff --git a/mlir/include/mlir/Tools/PDLL/AST/Nodes.h b/mlir/include/mlir/Tools/PDLL/AST/Nodes.h
index 9f958c59421de..6e6d6160ab335 100644
--- a/mlir/include/mlir/Tools/PDLL/AST/Nodes.h
+++ b/mlir/include/mlir/Tools/PDLL/AST/Nodes.h
@@ -668,7 +668,7 @@ class Decl : public Node {
void setDocComment(Context &ctx, StringRef comment);
/// Return the documentation comment attached to this decl if it has been set.
- /// Otherwise, returns None.
+ /// Otherwise, returns std::nullopt.
Optional<StringRef> getDocComment() const { return docComment; }
protected:
@@ -901,8 +901,8 @@ class UserConstraintDecl final
return const_cast<UserConstraintDecl *>(this)->getInputs();
}
- /// Return the explicit native type to use for the given input. Returns None
- /// if no explicit type was set.
+ /// Return the explicit native type to use for the given input. Returns
+ /// std::nullopt if no explicit type was set.
Optional<StringRef> getNativeInputType(unsigned index) const;
/// Return the explicit results of the constraint declaration. May be empty,
diff --git a/mlir/include/mlir/Transforms/DialectConversion.h b/mlir/include/mlir/Transforms/DialectConversion.h
index 55665b56f2fe8..307b126c23065 100644
--- a/mlir/include/mlir/Transforms/DialectConversion.h
+++ b/mlir/include/mlir/Transforms/DialectConversion.h
@@ -834,8 +834,8 @@ class ConversionTarget {
/// If the given operation instance is legal on this target, a structure
/// containing legality information is returned. If the operation is not
- /// legal, None is returned. Also returns None is operation legality wasn't
- /// registered by user or dynamic legality callbacks returned None.
+ /// legal, std::nullopt is returned. Also returns None is operation legality
+ /// wasn't registered by user or dynamic legality callbacks returned None.
///
/// Note: Legality is actually a 4-state: Legal(recursive=true),
/// Legal(recursive=false), Illegal or Unknown, where Unknown is treated
diff --git a/mlir/lib/Analysis/Presburger/Simplex.cpp b/mlir/lib/Analysis/Presburger/Simplex.cpp
index f08af75a6084a..98ea8653c135f 100644
--- a/mlir/lib/Analysis/Presburger/Simplex.cpp
+++ b/mlir/lib/Analysis/Presburger/Simplex.cpp
@@ -1325,7 +1325,7 @@ MaybeOptimum<Fraction> Simplex::computeRowOptimum(Direction direction,
// Keep trying to find a pivot for the row in the specified direction.
while (Optional<Pivot> maybePivot = findPivot(row, direction)) {
// If findPivot returns a pivot involving the row itself, then the optimum
- // is unbounded, so we return None.
+ // is unbounded, so we return std::nullopt.
if (maybePivot->row == row)
return OptimumKind::Unbounded;
pivot(*maybePivot);
@@ -1610,7 +1610,7 @@ Optional<SmallVector<MPInt, 8>> Simplex::getSamplePointIfIntegral() const {
SmallVector<MPInt, 8> integerSample;
integerSample.reserve(var.size());
for (const Fraction &coord : rationalSample) {
- // If the sample is non-integral, return None.
+ // If the sample is non-integral, return std::nullopt.
if (coord.num % coord.den != 0)
return {};
integerSample.push_back(coord.num / coord.den);
diff --git a/mlir/lib/AsmParser/AttributeParser.cpp b/mlir/lib/AsmParser/AttributeParser.cpp
index cec129ac66b75..e10dd5e108cd2 100644
--- a/mlir/lib/AsmParser/AttributeParser.cpp
+++ b/mlir/lib/AsmParser/AttributeParser.cpp
@@ -1166,8 +1166,8 @@ Attribute Parser::parseStridedLayoutAttr() {
return nullptr;
// Parses either an integer token or a question mark token. Reports an error
- // and returns None if the current token is neither. The integer token must
- // fit into int64_t limits.
+ // and returns std::nullopt if the current token is neither. The integer token
+ // must fit into int64_t limits.
auto parseStrideOrOffset = [&]() -> Optional<int64_t> {
if (consumeIf(Token::question))
return ShapedType::kDynamic;
diff --git a/mlir/lib/AsmParser/Token.cpp b/mlir/lib/AsmParser/Token.cpp
index 4f465ff384053..7000c1419e60d 100644
--- a/mlir/lib/AsmParser/Token.cpp
+++ b/mlir/lib/AsmParser/Token.cpp
@@ -24,7 +24,7 @@ SMLoc Token::getEndLoc() const {
SMRange Token::getLocRange() const { return SMRange(getLoc(), getEndLoc()); }
/// For an integer token, return its value as an unsigned. If it doesn't fit,
-/// return None.
+/// return std::nullopt.
Optional<unsigned> Token::getUnsignedIntegerValue() const {
bool isHex = spelling.size() > 1 && spelling[1] == 'x';
@@ -35,7 +35,7 @@ Optional<unsigned> Token::getUnsignedIntegerValue() const {
}
/// For an integer token, return its value as a uint64_t. If it doesn't fit,
-/// return None.
+/// return std::nullopt.
Optional<uint64_t> Token::getUInt64IntegerValue(StringRef spelling) {
bool isHex = spelling.size() > 1 && spelling[1] == 'x';
@@ -45,8 +45,8 @@ Optional<uint64_t> Token::getUInt64IntegerValue(StringRef spelling) {
return result;
}
-/// For a floatliteral, return its value as a double. Return None if the value
-/// underflows or overflows.
+/// For a floatliteral, return its value as a double. Return std::nullopt if the
+/// value underflows or overflows.
Optional<double> Token::getFloatingPointValue() const {
double result = 0;
if (spelling.getAsDouble(result))
diff --git a/mlir/lib/AsmParser/Token.h b/mlir/lib/AsmParser/Token.h
index 0e48805bb06f0..9f5cf1f837888 100644
--- a/mlir/lib/AsmParser/Token.h
+++ b/mlir/lib/AsmParser/Token.h
@@ -74,18 +74,18 @@ class Token {
// Helpers to decode specific sorts of tokens.
/// For an integer token, return its value as an unsigned. If it doesn't fit,
- /// return None.
+ /// return std::nullopt.
Optional<unsigned> getUnsignedIntegerValue() const;
/// For an integer token, return its value as an uint64_t. If it doesn't fit,
- /// return None.
+ /// return std::nullopt.
static Optional<uint64_t> getUInt64IntegerValue(StringRef spelling);
Optional<uint64_t> getUInt64IntegerValue() const {
return getUInt64IntegerValue(getSpelling());
}
- /// For a floatliteral token, return its value as a double. Returns None in
- /// the case of underflow or overflow.
+ /// For a floatliteral token, return its value as a double. Returns
+ /// std::nullopt in the case of underflow or overflow.
Optional<double> getFloatingPointValue() const;
/// For an inttype token, return its bitwidth.
diff --git a/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRV.cpp b/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRV.cpp
index cfb0e55326875..9e965e3083b22 100644
--- a/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRV.cpp
+++ b/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRV.cpp
@@ -114,7 +114,7 @@ static bool isAllocationSupported(Operation *allocOp, MemRefType type) {
/// Returns the scope to use for atomic operations use for emulating store
/// operations of unsupported integer bitwidths, based on the memref
-/// type. Returns None on failure.
+/// type. Returns std::nullopt on failure.
static Optional<spirv::Scope> getAtomicOpScope(MemRefType type) {
auto sc = type.getMemorySpace().dyn_cast_or_null<spirv::StorageClassAttr>();
switch (sc.getValue()) {
diff --git a/mlir/lib/Dialect/Affine/Analysis/Utils.cpp b/mlir/lib/Dialect/Affine/Analysis/Utils.cpp
index b9325b3717a0e..ca78601af3032 100644
--- a/mlir/lib/Dialect/Affine/Analysis/Utils.cpp
+++ b/mlir/lib/Dialect/Affine/Analysis/Utils.cpp
@@ -283,7 +283,7 @@ Optional<bool> ComputationSliceState::isSliceValid() {
}
/// Returns true if the computation slice encloses all the iterations of the
-/// sliced loop nest. Returns false if it does not. Returns llvm::None if it
+/// sliced loop nest. Returns false if it does not. Returns std::nullopt if it
/// cannot determine if the slice is maximal or not.
Optional<bool> ComputationSliceState::isMaximal() const {
// Fast check to determine if the computation slice is maximal. If the result
diff --git a/mlir/lib/Dialect/Arith/IR/InferIntRangeInterfaceImpls.cpp b/mlir/lib/Dialect/Arith/IR/InferIntRangeInterfaceImpls.cpp
index 243c3ef50faad..586c8e6a11aac 100644
--- a/mlir/lib/Dialect/Arith/IR/InferIntRangeInterfaceImpls.cpp
+++ b/mlir/lib/Dialect/Arith/IR/InferIntRangeInterfaceImpls.cpp
@@ -17,7 +17,7 @@ using namespace mlir;
using namespace mlir::arith;
/// Function that evaluates the result of doing something on arithmetic
-/// constants and returns None on overflow.
+/// constants and returns std::nullopt on overflow.
using ConstArithFn =
function_ref<Optional<APInt>(const APInt &, const APInt &)>;
diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp
index 462102a4f733f..7e5e608bb3303 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp
@@ -278,7 +278,7 @@ Optional<unsigned> mlir::LLVM::extractPointerSpecValue(Attribute attr,
/// Returns the part of the data layout entry that corresponds to `pos` for the
/// given `type` by interpreting the list of entries `params`. For the pointer
/// type in the default address space, returns the default value if the entries
-/// do not provide a custom one, for other address spaces returns None.
+/// do not provide a custom one, for other address spaces returns std::nullopt.
static Optional<unsigned>
getPointerDataLayoutEntry(DataLayoutEntryListRef params, LLVMPointerType type,
PtrDLEntryPos pos) {
diff --git a/mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp b/mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp
index b5d1dfd9bb243..cb325ff179587 100644
--- a/mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp
+++ b/mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp
@@ -48,7 +48,7 @@ llvm::Optional<Operation *> mlir::memref::findDealloc(Value allocValue) {
for (Operation *user : allocValue.getUsers()) {
if (!hasEffect<MemoryEffects::Free>(user, allocValue))
continue;
- // If we found > 1 dealloc, return None.
+ // If we found > 1 dealloc, return std::nullopt.
if (dealloc)
return std::nullopt;
dealloc = user;
diff --git a/mlir/lib/Dialect/SCF/IR/SCF.cpp b/mlir/lib/Dialect/SCF/IR/SCF.cpp
index 97313e191fe28..a7ca5783d67d6 100644
--- a/mlir/lib/Dialect/SCF/IR/SCF.cpp
+++ b/mlir/lib/Dialect/SCF/IR/SCF.cpp
@@ -719,7 +719,7 @@ struct ForOpIterArgsFolder : public OpRewritePattern<scf::ForOp> {
};
/// Util function that tries to compute a constant
diff between u and l.
-/// Returns llvm::None when the
diff erence between two AffineValueMap is
+/// Returns std::nullopt when the
diff erence between two AffineValueMap is
/// dynamic.
static Optional<int64_t> computeConstDiff(Value l, Value u) {
IntegerAttr clb, cub;
diff --git a/mlir/lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp b/mlir/lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp
index 381f2316e94a4..9998fcabd8290 100644
--- a/mlir/lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp
@@ -44,8 +44,8 @@ class Structural1ToNConversionPattern : public OpConversionPattern<SourceOp> {
//
// Derived classes should provide the following method which performs the
- // actual conversion. It should return llvm::None upon conversion failure and
- // return the converted operation upon success.
+ // actual conversion. It should return std::nullopt upon conversion failure
+ // and return the converted operation upon success.
//
// Optional<SourceOp> convertSourceOp(SourceOp op, OpAdaptor adaptor,
// ConversionPatternRewriter &rewriter,
diff --git a/mlir/lib/Dialect/SPIRV/Transforms/UnifyAliasedResourcePass.cpp b/mlir/lib/Dialect/SPIRV/Transforms/UnifyAliasedResourcePass.cpp
index 7330b399cde2a..520ee5f2fe64a 100644
--- a/mlir/lib/Dialect/SPIRV/Transforms/UnifyAliasedResourcePass.cpp
+++ b/mlir/lib/Dialect/SPIRV/Transforms/UnifyAliasedResourcePass.cpp
@@ -82,7 +82,7 @@ static Type getRuntimeArrayElementType(Type type) {
}
/// Given a list of resource element `types`, returns the index of the canonical
-/// resource that all resources should be unified into. Returns llvm::None if
+/// resource that all resources should be unified into. Returns std::nullopt if
/// unable to unify.
static Optional<int> deduceCanonicalResource(ArrayRef<spirv::SPIRVType> types) {
// scalarNumBits: contains all resources' scalar types' bit counts.
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
index 52dd6647166b6..113347cdc323a 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
@@ -115,7 +115,7 @@ static scf::ForOp createFor(OpBuilder &builder, Location loc, Value upper,
}
/// Gets the dimension size for the given sparse tensor at the given
-/// original dimension 'dim'. Returns None if no sparse encoding is
+/// original dimension 'dim'. Returns std::nullopt if no sparse encoding is
/// attached to the given tensor type.
static Optional<Value> sizeFromTensorAtDim(OpBuilder &builder, Location loc,
RankedTensorType tensorTp,
diff --git a/mlir/lib/Dialect/Traits.cpp b/mlir/lib/Dialect/Traits.cpp
index b763f2bb1b3b1..272f7675df44c 100644
--- a/mlir/lib/Dialect/Traits.cpp
+++ b/mlir/lib/Dialect/Traits.cpp
@@ -148,7 +148,7 @@ Type OpTrait::util::getBroadcastedType(Type type1, Type type2,
}
// Returns the type kind if the given type is a vector or ranked tensor type.
- // Returns llvm::None otherwise.
+ // Returns std::nullopt otherwise.
auto getCompositeTypeKind = [](Type type) -> Optional<TypeID> {
if (type.isa<VectorType, RankedTensorType>())
return type.getTypeID();
diff --git a/mlir/lib/Dialect/Vector/Transforms/VectorUnroll.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorUnroll.cpp
index c4d16d43e819e..c59972a867be9 100644
--- a/mlir/lib/Dialect/Vector/Transforms/VectorUnroll.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/VectorUnroll.cpp
@@ -132,8 +132,8 @@ static Operation *cloneOpWithOperandsAndTypes(OpBuilder &builder, Location loc,
resultTypes, op->getAttrs());
}
-/// Return the target shape for unrolling for the given `op`. Return llvm::None
-/// if the op shouldn't be or cannot be unrolled.
+/// Return the target shape for unrolling for the given `op`. Return
+/// std::nullopt if the op shouldn't be or cannot be unrolled.
static Optional<SmallVector<int64_t>>
getTargetShape(const vector::UnrollVectorOptions &options, Operation *op) {
if (options.filterConstraint && failed(options.filterConstraint(op)))
diff --git a/mlir/lib/IR/BuiltinAttributes.cpp b/mlir/lib/IR/BuiltinAttributes.cpp
index 0046590c0394e..99f7380727774 100644
--- a/mlir/lib/IR/BuiltinAttributes.cpp
+++ b/mlir/lib/IR/BuiltinAttributes.cpp
@@ -92,7 +92,7 @@ static bool dictionaryAttrSort(ArrayRef<NamedAttribute> value,
}
/// Returns an entry with a duplicate name from the given sorted array of named
-/// attributes. Returns llvm::None if all elements have unique names.
+/// attributes. Returns std::nullopt if all elements have unique names.
static Optional<NamedAttribute>
findDuplicateElement(ArrayRef<NamedAttribute> value) {
const Optional<NamedAttribute> none{std::nullopt};
diff --git a/mlir/lib/IR/BuiltinTypes.cpp b/mlir/lib/IR/BuiltinTypes.cpp
index 3dfaa12393fb7..378b87d1284ca 100644
--- a/mlir/lib/IR/BuiltinTypes.cpp
+++ b/mlir/lib/IR/BuiltinTypes.cpp
@@ -385,8 +385,8 @@ unsigned BaseMemRefType::getMemorySpaceAsInt() const {
/// `reducedShape`. The returned mask can be applied as a projection to
/// `originalShape` to obtain the `reducedShape`. This mask is useful to track
/// which dimensions must be kept when e.g. compute MemRef strides under
-/// rank-reducing operations. Return None if reducedShape cannot be obtained
-/// by dropping only `1` entries in `originalShape`.
+/// rank-reducing operations. Return std::nullopt if reducedShape cannot be
+/// obtained by dropping only `1` entries in `originalShape`.
llvm::Optional<llvm::SmallDenseSet<unsigned>>
mlir::computeRankReductionMask(ArrayRef<int64_t> originalShape,
ArrayRef<int64_t> reducedShape) {
diff --git a/mlir/lib/IR/SymbolTable.cpp b/mlir/lib/IR/SymbolTable.cpp
index 54ab2f58dd6ad..1f659d404cce1 100644
--- a/mlir/lib/IR/SymbolTable.cpp
+++ b/mlir/lib/IR/SymbolTable.cpp
@@ -778,8 +778,8 @@ static Optional<SymbolTable::UseRange> getSymbolUsesImpl(SymbolT symbol,
/// Get all of the uses of the given symbol that are nested within the given
/// operation 'from', invoking the provided callback for each. This does not
-/// traverse into any nested symbol tables. This function returns None if there
-/// are any unknown operations that may potentially be symbol tables.
+/// traverse into any nested symbol tables. This function returns std::nullopt
+/// if there are any unknown operations that may potentially be symbol tables.
auto SymbolTable::getSymbolUses(StringAttr symbol, Operation *from)
-> Optional<UseRange> {
return getSymbolUsesImpl(symbol, from);
diff --git a/mlir/lib/TableGen/CodeGenHelpers.cpp b/mlir/lib/TableGen/CodeGenHelpers.cpp
index 988aff6a4357f..589e99280b4a5 100644
--- a/mlir/lib/TableGen/CodeGenHelpers.cpp
+++ b/mlir/lib/TableGen/CodeGenHelpers.cpp
@@ -77,7 +77,7 @@ StringRef StaticVerifierFunctionEmitter::getTypeConstraintFn(
}
// Find a uniqued attribute constraint. Since not all attribute constraints can
-// be uniqued, return None if one was not found.
+// be uniqued, return std::nullopt if one was not found.
Optional<StringRef> StaticVerifierFunctionEmitter::getAttrConstraintFn(
const Constraint &constraint) const {
auto it = attrConstraints.find(constraint);
diff --git a/mlir/lib/TableGen/Type.cpp b/mlir/lib/TableGen/Type.cpp
index bb65c1bcc8b32..eacfbd4e0f029 100644
--- a/mlir/lib/TableGen/Type.cpp
+++ b/mlir/lib/TableGen/Type.cpp
@@ -40,7 +40,7 @@ StringRef TypeConstraint::getVariadicOfVariadicSegmentSizeAttr() const {
}
// Returns the builder call for this constraint if this is a buildable type,
-// returns None otherwise.
+// returns std::nullopt otherwise.
Optional<StringRef> TypeConstraint::getBuilderCall() const {
const llvm::Record *baseType = def;
if (isVariableLength())
diff --git a/mlir/lib/Tools/lsp-server-support/SourceMgrUtils.h b/mlir/lib/Tools/lsp-server-support/SourceMgrUtils.h
index 69e0584501cd9..75f739d6b064b 100644
--- a/mlir/lib/Tools/lsp-server-support/SourceMgrUtils.h
+++ b/mlir/lib/Tools/lsp-server-support/SourceMgrUtils.h
@@ -29,7 +29,7 @@ namespace lsp {
SMRange convertTokenLocToRange(SMLoc loc);
/// Extract a documentation comment for the given location within the source
-/// manager. Returns None if no comment could be computed.
+/// manager. Returns std::nullopt if no comment could be computed.
Optional<std::string> extractSourceDocComment(llvm::SourceMgr &sourceMgr,
SMLoc loc);
diff --git a/mlir/lib/Tools/lsp-server-support/Transport.cpp b/mlir/lib/Tools/lsp-server-support/Transport.cpp
index 0b4c74e1ce529..b400e75555a46 100644
--- a/mlir/lib/Tools/lsp-server-support/Transport.cpp
+++ b/mlir/lib/Tools/lsp-server-support/Transport.cpp
@@ -286,7 +286,7 @@ LogicalResult readLine(std::FILE *in, SmallVectorImpl<char> &out) {
}
}
-// Returns None when:
+// Returns std::nullopt when:
// - ferror(), feof(), or shutdownRequested() are set.
// - Content-Length is missing or empty (protocol error)
LogicalResult JSONTransport::readStandardMessage(std::string &json) {
diff --git a/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp b/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
index 0c60c7123a9f6..150e731e99e5a 100644
--- a/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
+++ b/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
@@ -153,7 +153,7 @@ static Optional<unsigned> getResultNumberFromLoc(SMLoc loc) {
}
/// Given a source location range, return the text covered by the given range.
-/// If the range is invalid, returns None.
+/// If the range is invalid, returns std::nullopt.
static Optional<StringRef> getTextFromRange(SMRange range) {
if (!range.isValid())
return std::nullopt;
diff --git a/mlir/tools/mlir-tblgen/DialectGenUtilities.h b/mlir/tools/mlir-tblgen/DialectGenUtilities.h
index 80fed9626deb2..e36bf0e0b1d14 100644
--- a/mlir/tools/mlir-tblgen/DialectGenUtilities.h
+++ b/mlir/tools/mlir-tblgen/DialectGenUtilities.h
@@ -15,8 +15,8 @@ namespace mlir {
namespace tblgen {
class Dialect;
-/// Find the dialect selected by the user to generate for. Returns None if no
-/// dialect was found, or if more than one potential dialect was found.
+/// Find the dialect selected by the user to generate for. Returns std::nullopt
+/// if no dialect was found, or if more than one potential dialect was found.
Optional<Dialect> findDialectToGenerate(ArrayRef<Dialect> dialects);
} // namespace tblgen
} // namespace mlir
diff --git a/mlir/tools/mlir-tblgen/EnumsGen.cpp b/mlir/tools/mlir-tblgen/EnumsGen.cpp
index 4543b9db03253..3dbda021c2da0 100644
--- a/mlir/tools/mlir-tblgen/EnumsGen.cpp
+++ b/mlir/tools/mlir-tblgen/EnumsGen.cpp
@@ -226,7 +226,7 @@ static void emitMaxValueFn(const Record &enumDef, raw_ostream &os) {
os << "}\n\n";
}
-// Returns the EnumAttrCase whose value is zero if exists; returns llvm::None
+// Returns the EnumAttrCase whose value is zero if exists; returns std::nullopt
// otherwise.
static llvm::Optional<EnumAttrCase>
getAllBitsUnsetCase(llvm::ArrayRef<EnumAttrCase> cases) {
diff --git a/mlir/tools/mlir-tblgen/OpFormatGen.cpp b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
index 861bfa758cbc2..07a6ab9c2b718 100644
--- a/mlir/tools/mlir-tblgen/OpFormatGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
@@ -2471,7 +2471,7 @@ static Optional<LogicalResult> checkRangeForElement(
// We found a closing element that is valid.
return success();
}
- // Return None to indicate that we reached the end.
+ // Return std::nullopt to indicate that we reached the end.
return std::nullopt;
}
diff --git a/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp b/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp
index b38f137c7c245..ae9df279dd274 100644
--- a/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp
+++ b/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp
@@ -52,8 +52,8 @@ static void dump(ArrayRef<MPInt> vec) {
/// for the IntegerPolyhedron poly. Also check that getIntegerLexmin finds a
/// non-empty lexmin.
///
-/// If hasSample is false, check that findIntegerSample returns None and
-/// findIntegerLexMin returns Empty.
+/// If hasSample is false, check that findIntegerSample returns std::nullopt
+/// and findIntegerLexMin returns Empty.
///
/// If fn is TestFunction::Empty, check that isIntegerEmpty returns the
/// opposite of hasSample.
More information about the Mlir-commits
mailing list