diff options
author | Kazu Hirata <kazu@google.com> | 2023-04-26 23:29:02 -0700 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2023-04-26 23:29:02 -0700 |
commit | 1b2247d932a95ef75778bf38d0e52cf7ba2e7d5c (patch) | |
tree | 494434ae1159f974d6140732b1d1d557025f3d15 | |
parent | aba32abe2d93133a46f67764937a1c85d455dce8 (diff) | |
download | llvm-1b2247d932a95ef75778bf38d0e52cf7ba2e7d5c.zip llvm-1b2247d932a95ef75778bf38d0e52cf7ba2e7d5c.tar.gz llvm-1b2247d932a95ef75778bf38d0e52cf7ba2e7d5c.tar.bz2 |
[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
-rw-r--r-- | mlir/include/mlir/Analysis/FlatLinearValueConstraints.h | 2 | ||||
-rw-r--r-- | mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h | 4 | ||||
-rw-r--r-- | mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h | 2 | ||||
-rw-r--r-- | mlir/include/mlir/IR/BuiltinTypes.h | 4 | ||||
-rw-r--r-- | mlir/include/mlir/IR/BuiltinTypes.td | 2 | ||||
-rw-r--r-- | mlir/include/mlir/Interfaces/ControlFlowInterfaces.td | 2 | ||||
-rw-r--r-- | mlir/include/mlir/Interfaces/VectorInterfaces.td | 2 | ||||
-rw-r--r-- | mlir/include/mlir/Tools/PDLL/AST/Nodes.h | 3 | ||||
-rw-r--r-- | mlir/lib/Analysis/FlatLinearValueConstraints.cpp | 2 | ||||
-rw-r--r-- | mlir/lib/Dialect/Affine/IR/AffineOps.cpp | 12 |
10 files changed, 18 insertions, 17 deletions
diff --git a/mlir/include/mlir/Analysis/FlatLinearValueConstraints.h b/mlir/include/mlir/Analysis/FlatLinearValueConstraints.h index abebd73..d27c74b 100644 --- a/mlir/include/mlir/Analysis/FlatLinearValueConstraints.h +++ b/mlir/include/mlir/Analysis/FlatLinearValueConstraints.h @@ -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; }; diff --git a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h index 73e830d..4a3a86f 100644 --- a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h +++ b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h @@ -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(); diff --git a/mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h b/mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h index 43a2604..b777611 100644 --- a/mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h +++ b/mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h @@ -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; }; diff --git a/mlir/include/mlir/IR/BuiltinTypes.h b/mlir/include/mlir/IR/BuiltinTypes.h index baee29c..f26465e 100644 --- a/mlir/include/mlir/IR/BuiltinTypes.h +++ b/mlir/include/mlir/IR/BuiltinTypes.h @@ -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; diff --git a/mlir/include/mlir/IR/BuiltinTypes.td b/mlir/include/mlir/IR/BuiltinTypes.td index b6c7b21..c703d6a7 100644 --- a/mlir/include/mlir/IR/BuiltinTypes.td +++ b/mlir/include/mlir/IR/BuiltinTypes.td @@ -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; }]; diff --git a/mlir/include/mlir/Interfaces/ControlFlowInterfaces.td b/mlir/include/mlir/Interfaces/ControlFlowInterfaces.td index 1a331f8..67c6684 100644 --- a/mlir/include/mlir/Interfaces/ControlFlowInterfaces.td +++ b/mlir/include/mlir/Interfaces/ControlFlowInterfaces.td @@ -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", diff --git a/mlir/include/mlir/Interfaces/VectorInterfaces.td b/mlir/include/mlir/Interfaces/VectorInterfaces.td index 27352bd..ce2e096 100644 --- a/mlir/include/mlir/Interfaces/VectorInterfaces.td +++ b/mlir/include/mlir/Interfaces/VectorInterfaces.td @@ -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>>", diff --git a/mlir/include/mlir/Tools/PDLL/AST/Nodes.h b/mlir/include/mlir/Tools/PDLL/AST/Nodes.h index 0a34f80..5e86cda 100644 --- a/mlir/include/mlir/Tools/PDLL/AST/Nodes.h +++ b/mlir/include/mlir/Tools/PDLL/AST/Nodes.h @@ -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. diff --git a/mlir/lib/Analysis/FlatLinearValueConstraints.cpp b/mlir/lib/Analysis/FlatLinearValueConstraints.cpp index b2d8bd9..348ffbf 100644 --- a/mlir/lib/Analysis/FlatLinearValueConstraints.cpp +++ b/mlir/lib/Analysis/FlatLinearValueConstraints.cpp @@ -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); diff --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp index bd98110..8f63b22 100644 --- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp +++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp @@ -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, |