[mlir] Replace None with std::nullopt in comments (NFC)
authorKazu Hirata <kazu@google.com>
Thu, 27 Apr 2023 06:29:02 +0000 (23:29 -0700)
committerKazu Hirata <kazu@google.com>
Thu, 27 Apr 2023 06:29:02 +0000 (23:29 -0700)
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

mlir/include/mlir/Analysis/FlatLinearValueConstraints.h
mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h
mlir/include/mlir/IR/BuiltinTypes.h
mlir/include/mlir/IR/BuiltinTypes.td
mlir/include/mlir/Interfaces/ControlFlowInterfaces.td
mlir/include/mlir/Interfaces/VectorInterfaces.td
mlir/include/mlir/Tools/PDLL/AST/Nodes.h
mlir/lib/Analysis/FlatLinearValueConstraints.cpp
mlir/lib/Dialect/Affine/IR/AffineOps.cpp

index abebd73..d27c74b 100644 (file)
@@ -492,7 +492,7 @@ protected:
   /// Values corresponding to the (column) non-local variables of this
   /// constraint system appearing in the order the variables correspond to
   /// columns. Variables that aren't associated with any Value are set to
-  /// None.
+  /// std::nullopt.
   SmallVector<std::optional<Value>, 8> values;
 };
 
index 73e830d..4a3a86f 100644 (file)
@@ -204,8 +204,8 @@ struct LinalgPromotionOptions {
   /// If ith element of `useFullTiles` is true the full view should be used
   /// for the promoted buffer of the ith operand in `operandsToPromote`.
   /// Otherwise the partial view will be used. The decision is defaulted to
-  /// `useFullTileBuffersDefault` when `useFullTileBuffers` is None and for
-  /// operands missing from `useFullTileBuffers`.
+  /// `useFullTileBuffersDefault` when `useFullTileBuffers` is std::nullopt and
+  /// for operands missing from `useFullTileBuffers`.
   std::optional<llvm::SmallBitVector> useFullTileBuffers;
   LinalgPromotionOptions &setUseFullTileBuffers(ArrayRef<bool> useFullTiles) {
     unsigned size = useFullTiles.size();
index 43a2604..b777611 100644 (file)
@@ -475,7 +475,7 @@ struct CollapseShapeRankReducingSliceSimplificationInfo {
   /// The shape of the output of the rank-reducing slice.
   RankedTensorType sliceResultType;
   /// The reassociation indices for the new collapse shape op, if required. If
-  /// `None`, the slice should replace the collapse shape op.
+  /// `std::nullopt`, the slice should replace the collapse shape op.
   std::optional<SmallVector<ReassociationIndices>> newReassociationIndices;
 };
 
index baee29c..f26465e 100644 (file)
@@ -91,7 +91,7 @@ public:
   ArrayRef<int64_t> getShape() const;
 
   /// Clone this type with the given shape and element type. If the
-  /// provided shape is `None`, the current shape of the type is used.
+  /// provided shape is `std::nullopt`, the current shape of the type is used.
   TensorType cloneWith(std::optional<ArrayRef<int64_t>> shape,
                        Type elementType) const;
 
@@ -127,7 +127,7 @@ public:
   ArrayRef<int64_t> getShape() const;
 
   /// Clone this type with the given shape and element type. If the
-  /// provided shape is `None`, the current shape of the type is used.
+  /// provided shape is `std::nullopt`, the current shape of the type is used.
   BaseMemRefType cloneWith(std::optional<ArrayRef<int64_t>> shape,
                            Type elementType) const;
 
index b6c7b21..c703d6a 100644 (file)
@@ -1089,7 +1089,7 @@ def Builtin_Vector : Builtin_Type<"Vector", [ShapedTypeInterface], "Type"> {
     bool hasRank() const { return true; }
 
     /// Clone this vector type with the given shape and element type. If the
-    /// provided shape is `None`, the current shape of the type is used.
+    /// provided shape is `std::nullopt`, the current shape of the type is used.
     VectorType cloneWith(std::optional<ArrayRef<int64_t>> shape,
                          Type elementType) const;
   }];
index 1a331f8..67c6684 100644 (file)
@@ -67,7 +67,7 @@ def BranchOpInterface : OpInterface<"BranchOpInterface"> {
     >,
     InterfaceMethod<[{
         Returns the `BlockArgument` corresponding to operand `operandIndex` in
-        some successor, or None if `operandIndex` isn't a successor operand
+        some successor, or std::nullopt if `operandIndex` isn't a successor operand
         index.
       }],
       "::std::optional<::mlir::BlockArgument>", "getSuccessorBlockArgument",
index 27352bd..ce2e096 100644 (file)
@@ -25,7 +25,7 @@ def VectorUnrollOpInterface : OpInterface<"VectorUnrollOpInterface"> {
     InterfaceMethod<
       /*desc=*/[{
         Return the shape ratio of unrolling to the target vector shape
-        `targetShape`. Return `None` if the op cannot be unrolled to the target
+        `targetShape`. Return `std::nullopt` if the op cannot be unrolled to the target
         vector shape.
       }],
       /*retTy=*/"::std::optional<::llvm::SmallVector<int64_t, 4>>",
index 0a34f80..5e86cda 100644 (file)
@@ -1052,7 +1052,8 @@ private:
       : Base(loc, name), benefit(benefit),
         hasBoundedRecursion(hasBoundedRecursion), patternBody(body) {}
 
-  /// The benefit of the pattern if it was explicitly specified, None otherwise.
+  /// The benefit of the pattern if it was explicitly specified, std::nullopt
+  /// otherwise.
   std::optional<uint16_t> benefit;
 
   /// If the pattern has properly bounded rewrite recursion or not.
index b2d8bd9..348ffbf 100644 (file)
@@ -917,7 +917,7 @@ unsigned FlatLinearValueConstraints::insertVar(VarKind kind, unsigned pos,
   unsigned num = vals.size();
   unsigned absolutePos = IntegerPolyhedron::insertVar(kind, pos, num);
 
-  // If a Value is provided, insert it; otherwise use None.
+  // If a Value is provided, insert it; otherwise use std::nullopt.
   for (unsigned i = 0; i < num; ++i)
     values.insert(values.begin() + absolutePos + i,
                   vals[i] ? std::optional<Value>(vals[i]) : std::nullopt);
index bd98110..8f63b22 100644 (file)
@@ -701,12 +701,12 @@ static std::optional<int64_t> getUpperBound(Value iv) {
 
 /// Get a lower or upper (depending on `isUpper`) bound for `expr` while using
 /// the constant lower and upper bounds for its inputs provided in
-/// `constLowerBounds` and `constUpperBounds`. Return None if such a bound can't
-/// be computed. This method only handles simple sum of product 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.
+/// `constLowerBounds` and `constUpperBounds`. Return std::nullopt if such a
+/// bound can't be computed. This method only handles simple sum of product
+/// 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.
 static std::optional<int64_t>
 getBoundForExpr(AffineExpr expr, unsigned numDims, unsigned numSymbols,
                 ArrayRef<std::optional<int64_t>> constLowerBounds,