[Mlir-commits] [mlir] 192d9dd - [mlir] Use std::nullopt instead of None in comments (NFC)

Kazu Hirata llvmlistbot at llvm.org
Sun Dec 4 19:58:38 PST 2022


Author: Kazu Hirata
Date: 2022-12-04T19:58:32-08:00
New Revision: 192d9dd731921a377bc538fc2b13871815fac87d

URL: https://github.com/llvm/llvm-project/commit/192d9dd731921a377bc538fc2b13871815fac87d
DIFF: https://github.com/llvm/llvm-project/commit/192d9dd731921a377bc538fc2b13871815fac87d.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/docs/DialectConversion.md
    mlir/include/mlir/Analysis/Presburger/Simplex.h
    mlir/include/mlir/Dialect/Affine/Analysis/Utils.h
    mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h
    mlir/include/mlir/Dialect/Linalg/Analysis/DependenceAnalysis.h
    mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
    mlir/include/mlir/Dialect/Linalg/Utils/Utils.h
    mlir/include/mlir/Dialect/SPIRV/IR/SPIRVTypes.h
    mlir/include/mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h
    mlir/include/mlir/IR/AffineMap.h
    mlir/include/mlir/IR/SubElementInterfaces.h
    mlir/include/mlir/Interfaces/ControlFlowInterfaces.h
    mlir/include/mlir/Interfaces/SideEffectInterfaceBase.td
    mlir/include/mlir/Pass/Pass.h
    mlir/include/mlir/Pass/PassInstrumentation.h
    mlir/include/mlir/Pass/PassManager.h
    mlir/include/mlir/Support/Timing.h
    mlir/include/mlir/TableGen/AttrOrTypeDef.h
    mlir/include/mlir/TableGen/Constraint.h
    mlir/include/mlir/TableGen/Pattern.h
    mlir/include/mlir/Tools/PDLL/AST/Nodes.h
    mlir/include/mlir/Tools/PDLL/AST/Types.h
    mlir/include/mlir/Transforms/DialectConversion.h
    mlir/lib/Analysis/AliasAnalysis/LocalAliasAnalysis.cpp
    mlir/lib/Analysis/Presburger/Simplex.cpp
    mlir/lib/AsmParser/Token.cpp
    mlir/lib/AsmParser/Token.h
    mlir/lib/Bytecode/Reader/BytecodeReader.cpp
    mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp
    mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
    mlir/lib/Dialect/Affine/Analysis/Utils.cpp
    mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
    mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
    mlir/lib/IR/AsmPrinter.cpp
    mlir/lib/Interfaces/ControlFlowInterfaces.cpp
    mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
    mlir/lib/Tools/mlir-lsp-server/MLIRServer.h
    mlir/lib/Tools/mlir-pdll-lsp-server/PDLLServer.h
    mlir/lib/Tools/tblgen-lsp-server/TableGenServer.h
    mlir/tools/mlir-tblgen/OpFormatGen.cpp
    mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/docs/DialectConversion.md b/mlir/docs/DialectConversion.md
index 3de7a897a3b84..9485064375b5b 100644
--- a/mlir/docs/DialectConversion.md
+++ b/mlir/docs/DialectConversion.md
@@ -301,15 +301,15 @@ class TypeConverter {
   /// to any of the following forms(where `T` is a class derived from `Type`:
   ///   * Optional<Type>(T)
   ///     - This form represents a 1-1 type conversion. It should return nullptr
-  ///       or `llvm::None` to signify failure. If `llvm::None` is returned, the
+  ///       or `std::nullopt` to signify failure. If `std::nullopt` is returned, the
   ///       converter is allowed to try another conversion function to perform
   ///       the conversion.
   ///   * Optional<LogicalResult>(T, SmallVectorImpl<Type> &)
   ///     - This form represents a 1-N type conversion. It should return
-  ///       `failure` or `llvm::None` to signify a failed conversion. If the new
+  ///       `failure` or `std::nullopt` to signify a failed conversion. If the new
   ///       set of types is empty, the type is removed and any usages of the
   ///       existing value are expected to be removed during conversion. If
-  ///       `llvm::None` is returned, the converter is allowed to try another
+  ///       `std::nullopt` is returned, the converter is allowed to try another
   ///       conversion function to perform the conversion.
   ///   * Optional<LogicalResult>(T, SmallVectorImpl<Type> &, ArrayRef<Type>)
   ///     - This form represents a 1-N type conversion supporting recursive
@@ -334,7 +334,7 @@ class TypeConverter {
   /// This function is responsible for creating an operation, using the
   /// OpBuilder and Location provided, that "converts" a range of values into a
   /// single value of the given type `T`. It must return a Value of the
-  /// converted type on success, an `llvm::None` if it failed but other
+  /// converted type on success, an `std::nullopt` if it failed but other
   /// materialization can be attempted, and `nullptr` on unrecoverable failure.
   /// It will only be called for (sub)types of `T`.
   ///

diff  --git a/mlir/include/mlir/Analysis/Presburger/Simplex.h b/mlir/include/mlir/Analysis/Presburger/Simplex.h
index 34b77a029af04..bcbec8ce5a819 100644
--- a/mlir/include/mlir/Analysis/Presburger/Simplex.h
+++ b/mlir/include/mlir/Analysis/Presburger/Simplex.h
@@ -779,7 +779,7 @@ class Simplex : public SimplexBase {
   /// tableau A and one in B.
   static Simplex makeProduct(const Simplex &a, const Simplex &b);
 
-  /// Returns an integer sample point if one exists, or None
+  /// Returns an integer sample point if one exists, or std::nullopt
   /// otherwise. This should only be called for bounded sets.
   Optional<SmallVector<MPInt, 8>> findIntegerSample();
 

diff  --git a/mlir/include/mlir/Dialect/Affine/Analysis/Utils.h b/mlir/include/mlir/Dialect/Affine/Analysis/Utils.h
index b75cabb70b36c..961827d1f171f 100644
--- a/mlir/include/mlir/Dialect/Affine/Analysis/Utils.h
+++ b/mlir/include/mlir/Dialect/Affine/Analysis/Utils.h
@@ -139,7 +139,7 @@ struct ComputationSliceState {
   /// if each slice dimension maps to an existing dst dimension and both the src
   /// and the dst loops for those dimensions have the same bounds. Returns false
   /// if both the src and the dst loops don't have the same bounds. Returns
-  /// llvm::None if none of the above can be proven.
+  /// std::nullopt if none of the above can be proven.
   Optional<bool> isSliceMaximalFastCheck() const;
 };
 

diff  --git a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h
index b3bdb43603636..78f73870a6ba7 100644
--- a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h
+++ b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h
@@ -230,7 +230,7 @@ struct BufferizationOptions {
   bool bufferizeFunctionBoundaries = false;
 
   /// The default memory space that should be used when it cannot be inferred
-  /// from the context. If case of llvm::None, bufferization fails when the
+  /// from the context. If case of std::nullopt, bufferization fails when the
   /// memory space cannot be inferred at any point.
   Optional<Attribute> defaultMemorySpace = Attribute();
 

diff  --git a/mlir/include/mlir/Dialect/Linalg/Analysis/DependenceAnalysis.h b/mlir/include/mlir/Dialect/Linalg/Analysis/DependenceAnalysis.h
index ff043dbc14088..b65db9fbf67d8 100644
--- a/mlir/include/mlir/Dialect/Linalg/Analysis/DependenceAnalysis.h
+++ b/mlir/include/mlir/Dialect/Linalg/Analysis/DependenceAnalysis.h
@@ -94,7 +94,7 @@ class LinalgDependenceGraph {
       return std::nullopt;
     }
     // Return the result number if the `opView` is an OpResult. Otherwise return
-    // llvm::None.
+    // std::nullopt.
     static Optional<unsigned> getResultNumber(OpView opView) {
       if (OpResult result = opView.dyn_cast<Value>().cast<OpResult>())
         return result.getResultNumber();
@@ -114,13 +114,13 @@ class LinalgDependenceGraph {
     Value getIndexingValue() const { return getValue(indexingOpView); }
 
     // If the dependent OpView is an operand, return operand number. Return
-    // llvm::None otherwise.
+    // std::nullopt otherwise.
     Optional<unsigned> getDependentOpViewOperandNum() const {
       return getOperandNumber(dependentOpView);
     }
 
     // If the indexing OpView is an operand, return operand number. Return
-    // llvm::None otherwise.
+    // std::nullopt otherwise.
     Optional<unsigned> getIndexingOpViewOperandNum() const {
       return getOperandNumber(indexingOpView);
     }

diff  --git a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
index 7c48782f0492c..f8473151c009e 100644
--- a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
+++ b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
@@ -184,7 +184,7 @@ std::pair<TilingInterface, TilingInterface> splitOp(RewriterBase &rewriter,
 /// transformation returns early.
 ///
 /// Return a struct containing the tiled loops in the specified order
-/// and the cloned op if successful, llvm::None otherwise.
+/// and the cloned op if successful, std::nullopt otherwise.
 ///
 /// E.g. the permutation `(i,j,k) -> (j,k,i)` is expressed by
 /// `interchangeVector = [1,2,0]`. All values in `interchangeVector` must be

diff  --git a/mlir/include/mlir/Dialect/Linalg/Utils/Utils.h b/mlir/include/mlir/Dialect/Linalg/Utils/Utils.h
index 4f9dd71857f95..3152061e6cbc2 100644
--- a/mlir/include/mlir/Dialect/Linalg/Utils/Utils.h
+++ b/mlir/include/mlir/Dialect/Linalg/Utils/Utils.h
@@ -138,7 +138,7 @@ Optional<SmallVector<ReassociationIndices>>
 getReassociationMapForFoldingUnitDims(ArrayRef<OpFoldResult> mixedSizes);
 
 /// Return the identity numeric value associated to the give op. Return
-/// llvm::None if there is no known neutral element.
+/// std::nullopt if there is no known neutral element.
 Optional<Attribute> getNeutralElement(Operation *op);
 
 //===----------------------------------------------------------------------===//
@@ -222,7 +222,7 @@ computeSliceParameters(OpBuilder &builder, Location loc, Value valueToTile,
 /// number of values in `ivs`.
 ///
 /// Some of the `valuesToTile` won't be affected by tiling. For these values,
-/// llvm::None will be returned.
+/// std::nullopt will be returned.
 SmallVector<Optional<SliceParameters>>
 computeAllSliceParameters(OpBuilder &builder, Location loc, LinalgOp linalgOp,
                           ValueRange valuesToTile, ArrayRef<OpFoldResult> ivs,

diff  --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVTypes.h b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVTypes.h
index 6218b62f075b9..33a0f577f9ca5 100644
--- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVTypes.h
+++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVTypes.h
@@ -71,7 +71,7 @@ class SPIRVType : public Type {
                        Optional<StorageClass> storage = std::nullopt);
 
   /// Returns the size in bytes for each type. If no size can be calculated,
-  /// returns `llvm::None`. Note that if the type has explicit layout, it is
+  /// returns `std::nullopt`. Note that if the type has explicit layout, it is
   /// also taken into account in calculation.
   Optional<int64_t> getSizeInBytes();
 };

diff  --git a/mlir/include/mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h b/mlir/include/mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h
index 0ab03085f5ae1..e4606f9b428ff 100644
--- a/mlir/include/mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h
+++ b/mlir/include/mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h
@@ -113,7 +113,8 @@ struct UnrollVectorOptions {
   using NativeShapeFnType =
       std::function<Optional<SmallVector<int64_t>>(Operation *op)>;
   /// Function that returns the shape of the vector to unroll to for a given
-  /// operation. The unrolling is aborted if the function returns `llvm::None`.
+  /// operation. The unrolling is aborted if the function returns
+  /// `std::nullopt`.
   NativeShapeFnType nativeShape = nullptr;
   UnrollVectorOptions &setNativeShapeFn(NativeShapeFnType fn) {
     nativeShape = std::move(fn);

diff  --git a/mlir/include/mlir/IR/AffineMap.h b/mlir/include/mlir/IR/AffineMap.h
index 74cc3b1eb17a2..3f484ba63e800 100644
--- a/mlir/include/mlir/IR/AffineMap.h
+++ b/mlir/include/mlir/IR/AffineMap.h
@@ -167,8 +167,8 @@ class AffineMap {
   unsigned getDimPosition(unsigned idx) const;
 
   /// Extracts the first result position where `input` dimension resides.
-  /// Returns `llvm::None` if `input` is not a dimension expression or cannot be
-  /// found in results.
+  /// Returns `std::nullopt` if `input` is not a dimension expression or cannot
+  /// be found in results.
   Optional<unsigned> getResultPosition(AffineExpr input) const;
 
   /// Return true if any affine expression involves AffineDimExpr `position`.

diff  --git a/mlir/include/mlir/IR/SubElementInterfaces.h b/mlir/include/mlir/IR/SubElementInterfaces.h
index 9b14b1790ee5b..e284c043a8c1a 100644
--- a/mlir/include/mlir/IR/SubElementInterfaces.h
+++ b/mlir/include/mlir/IR/SubElementInterfaces.h
@@ -71,7 +71,7 @@ class AttrTypeReplacer {
   ///
   ///   * Optional<BaseT>(T)
   ///     - This either returns a valid Attribute/Type in the case of success,
-  ///       nullptr in the case of failure, or `llvm::None` to signify that
+  ///       nullptr in the case of failure, or `std::nullopt` to signify that
   ///       additional replacement functions may be applied (i.e. this function
   ///       doesn't handle that instance).
   ///

diff  --git a/mlir/include/mlir/Interfaces/ControlFlowInterfaces.h b/mlir/include/mlir/Interfaces/ControlFlowInterfaces.h
index 416fcc354cdb0..b390586201962 100644
--- a/mlir/include/mlir/Interfaces/ControlFlowInterfaces.h
+++ b/mlir/include/mlir/Interfaces/ControlFlowInterfaces.h
@@ -126,8 +126,8 @@ class SuccessorOperands {
 
 namespace detail {
 /// Return the `BlockArgument` corresponding to operand `operandIndex` in some
-/// successor if `operandIndex` is within the range of `operands`, or None if
-/// `operandIndex` isn't a successor operand index.
+/// successor if `operandIndex` is within the range of `operands`, or
+/// std::nullopt if `operandIndex` isn't a successor operand index.
 Optional<BlockArgument>
 getBranchSuccessorArgument(const SuccessorOperands &operands,
                            unsigned operandIndex, Block *successor);
@@ -237,9 +237,9 @@ bool isRegionReturnLike(Operation *operation);
 /// Returns the mutable operands that are passed to the region with the given
 /// `regionIndex`. If the operation does not implement the
 /// `RegionBranchTerminatorOpInterface` and is not marked as `ReturnLike`, the
-/// result will be `llvm::None`. In all other cases, the resulting
+/// result will be `std::nullopt`. In all other cases, the resulting
 /// `OperandRange` represents all operands that are passed to the specified
-/// successor region. If `regionIndex` is `llvm::None`, all operands that are
+/// successor region. If `regionIndex` is `std::nullopt`, all operands that are
 /// passed to the parent operation will be returned.
 Optional<MutableOperandRange>
 getMutableRegionBranchSuccessorOperands(Operation *operation,

diff  --git a/mlir/include/mlir/Interfaces/SideEffectInterfaceBase.td b/mlir/include/mlir/Interfaces/SideEffectInterfaceBase.td
index 842b7ff6d50b2..e821c9e03abd8 100644
--- a/mlir/include/mlir/Interfaces/SideEffectInterfaceBase.td
+++ b/mlir/include/mlir/Interfaces/SideEffectInterfaceBase.td
@@ -104,7 +104,7 @@ class EffectOpInterfaceBase<string name, string baseEffect>
     }
 
     /// Return the effect of the given type `Effect` that is applied to the
-    /// given value, or None if no effect exists.
+    /// given value, or std::nullopt if no effect exists.
     template <typename Effect>
     ::llvm::Optional<::mlir::SideEffects::EffectInstance<}] # baseEffect # [{>>
     getEffectOnValue(::mlir::Value value) {

diff  --git a/mlir/include/mlir/Pass/Pass.h b/mlir/include/mlir/Pass/Pass.h
index 5953e9d02493e..aa22fce5c0396 100644
--- a/mlir/include/mlir/Pass/Pass.h
+++ b/mlir/include/mlir/Pass/Pass.h
@@ -80,8 +80,8 @@ class Pass {
   /// Return an empty string if one does not exist.
   virtual StringRef getDescription() const { return ""; }
 
-  /// Returns the name of the operation that this pass operates on, or None if
-  /// this is a generic OperationPass.
+  /// Returns the name of the operation that this pass operates on, or
+  /// std::nullopt if this is a generic OperationPass.
   Optional<StringRef> getOpName() const { return opName; }
 
   //===--------------------------------------------------------------------===//
@@ -300,8 +300,8 @@ class Pass {
   /// Represents a unique identifier for the pass.
   TypeID passID;
 
-  /// The name of the operation that this pass operates on, or None if this is a
-  /// generic OperationPass.
+  /// The name of the operation that this pass operates on, or std::nullopt if
+  /// this is a generic OperationPass.
   Optional<StringRef> opName;
 
   /// The current execution state for the pass.

diff  --git a/mlir/include/mlir/Pass/PassInstrumentation.h b/mlir/include/mlir/Pass/PassInstrumentation.h
index a99cafbf26864..8cb6b708ec7ac 100644
--- a/mlir/include/mlir/Pass/PassInstrumentation.h
+++ b/mlir/include/mlir/Pass/PassInstrumentation.h
@@ -41,16 +41,16 @@ class PassInstrumentation {
   virtual ~PassInstrumentation() = 0;
 
   /// A callback to run before a pass pipeline is executed. This function takes
-  /// the name of the operation type being operated on, or None if the pipeline
-  /// is op-agnostic, and information related to the parent that spawned this
-  /// pipeline.
+  /// the name of the operation type being operated on, or std::nullopt if the
+  /// pipeline is op-agnostic, and information related to the parent that
+  /// spawned this pipeline.
   virtual void runBeforePipeline(Optional<OperationName> name,
                                  const PipelineParentInfo &parentInfo);
 
   /// A callback to run after a pass pipeline has executed. This function takes
-  /// the name of the operation type being operated on, or None if the pipeline
-  /// is op-agnostic, and information related to the parent that spawned this
-  /// pipeline.
+  /// the name of the operation type being operated on, or std::nullopt if the
+  /// pipeline is op-agnostic, and information related to the parent that
+  /// spawned this pipeline.
   virtual void runAfterPipeline(Optional<OperationName> name,
                                 const PipelineParentInfo &parentInfo);
 

diff  --git a/mlir/include/mlir/Pass/PassManager.h b/mlir/include/mlir/Pass/PassManager.h
index 058e2d738b388..d7c354ec6fb97 100644
--- a/mlir/include/mlir/Pass/PassManager.h
+++ b/mlir/include/mlir/Pass/PassManager.h
@@ -125,12 +125,12 @@ class OpPassManager {
   /// Returns the number of passes held by this manager.
   size_t size() const;
 
-  /// Return the operation name that this pass manager operates on, or None if
-  /// this is an op-agnostic pass manager.
+  /// Return the operation name that this pass manager operates on, or
+  /// std::nullopt if this is an op-agnostic pass manager.
   Optional<OperationName> getOpName(MLIRContext &context) const;
 
-  /// Return the operation name that this pass manager operates on, or None if
-  /// this is an op-agnostic pass manager.
+  /// Return the operation name that this pass manager operates on, or
+  /// std::nullopt if this is an op-agnostic pass manager.
   Optional<StringRef> getOpName() const;
 
   /// Return the name used to anchor this pass manager. This is either the name

diff  --git a/mlir/include/mlir/Support/Timing.h b/mlir/include/mlir/Support/Timing.h
index 180559c912439..f9d877e070798 100644
--- a/mlir/include/mlir/Support/Timing.h
+++ b/mlir/include/mlir/Support/Timing.h
@@ -136,7 +136,7 @@ class TimingManager {
   //
   // See the corresponding functions in `Timer` for additional details.
 
-  /// Return the root timer. Implementations should return `llvm::None` if the
+  /// Return the root timer. Implementations should return `std::nullopt` if the
   /// collection of timing samples is disabled. This will cause the timers
   /// constructed from the manager to be tombstones which can be skipped
   /// quickly.

diff  --git a/mlir/include/mlir/TableGen/AttrOrTypeDef.h b/mlir/include/mlir/TableGen/AttrOrTypeDef.h
index 1abaf64b878e8..6a03e3426152c 100644
--- a/mlir/include/mlir/TableGen/AttrOrTypeDef.h
+++ b/mlir/include/mlir/TableGen/AttrOrTypeDef.h
@@ -252,8 +252,8 @@ class AttrDef : public AttrOrTypeDef {
 public:
   using AttrOrTypeDef::AttrOrTypeDef;
 
-  /// Returns the attributes value type builder code block, or None if it
-  /// doesn't have one.
+  /// Returns the attributes value type builder code block, or std::nullopt if
+  /// it doesn't have one.
   Optional<StringRef> getTypeBuilder() const;
 
   static bool classof(const AttrOrTypeDef *def);

diff  --git a/mlir/include/mlir/TableGen/Constraint.h b/mlir/include/mlir/TableGen/Constraint.h
index c0765739016e5..92999be9cf587 100644
--- a/mlir/include/mlir/TableGen/Constraint.h
+++ b/mlir/include/mlir/TableGen/Constraint.h
@@ -79,7 +79,8 @@ class Constraint {
   const llvm::Record *def;
 
 private:
-  /// Return the name of the base def if there is one, or None otherwise.
+  /// Return the name of the base def if there is one, or std::nullopt
+  /// otherwise.
   Optional<StringRef> getBaseDefName() const;
 
   // What kind of constraint this is.

diff  --git a/mlir/include/mlir/TableGen/Pattern.h b/mlir/include/mlir/TableGen/Pattern.h
index bdd01ed8a3673..8f6cdf7623633 100644
--- a/mlir/include/mlir/TableGen/Pattern.h
+++ b/mlir/include/mlir/TableGen/Pattern.h
@@ -282,7 +282,7 @@ class SymbolInfoMap {
     enum class Kind : uint8_t { Attr, Operand, Result, Value, MultipleValues };
 
     // Creates a SymbolInfo instance. `dagAndConstant` is only used for `Attr`
-    // and `Operand` so should be llvm::None for `Result` and `Value` kind.
+    // and `Operand` so should be std::nullopt for `Result` and `Value` kind.
     SymbolInfo(const Operator *op, Kind kind,
                Optional<DagAndConstant> dagAndConstant);
 

diff  --git a/mlir/include/mlir/Tools/PDLL/AST/Nodes.h b/mlir/include/mlir/Tools/PDLL/AST/Nodes.h
index 6e6d6160ab335..af8a05e072d62 100644
--- a/mlir/include/mlir/Tools/PDLL/AST/Nodes.h
+++ b/mlir/include/mlir/Tools/PDLL/AST/Nodes.h
@@ -508,7 +508,7 @@ class OperationExpr final
                                ArrayRef<Expr *> resultTypes,
                                ArrayRef<NamedAttributeDecl *> attributes);
 
-  /// Return the name of the operation, or None if there isn't one.
+  /// Return the name of the operation, or std::nullopt if there isn't one.
   Optional<StringRef> getName() const;
 
   /// Return the declaration of the operation name.
@@ -764,7 +764,7 @@ class OpConstraintDecl
   static OpConstraintDecl *create(Context &ctx, SMRange loc,
                                   const OpNameDecl *nameDecl = nullptr);
 
-  /// Return the name of the operation, or None if there isn't one.
+  /// Return the name of the operation, or std::nullopt if there isn't one.
   Optional<StringRef> getName() const;
 
   /// Return the declaration of the operation name.
@@ -1028,7 +1028,7 @@ class PatternDecl : public Node::NodeBase<PatternDecl, Decl> {
                              bool hasBoundedRecursion,
                              const CompoundStmt *body);
 
-  /// Return the benefit of this pattern if specified, or None.
+  /// Return the benefit of this pattern if specified, or std::nullopt.
   Optional<uint16_t> getBenefit() const { return benefit; }
 
   /// Return if this pattern has bounded rewrite recursion.

diff  --git a/mlir/include/mlir/Tools/PDLL/AST/Types.h b/mlir/include/mlir/Tools/PDLL/AST/Types.h
index d51f3290e6389..22cdf8333f98c 100644
--- a/mlir/include/mlir/Tools/PDLL/AST/Types.h
+++ b/mlir/include/mlir/Tools/PDLL/AST/Types.h
@@ -164,7 +164,8 @@ class OperationType : public Type::TypeBase<detail::OperationTypeStorage> {
                            Optional<StringRef> name = std::nullopt,
                            const ods::Operation *odsOp = nullptr);
 
-  /// Return the name of this operation type, or None if it doesn't have on.
+  /// Return the name of this operation type, or std::nullopt if it doesn't have
+  /// on.
   Optional<StringRef> getName() const;
 
   /// Return the ODS operation that this type refers to, or nullptr if the ODS

diff  --git a/mlir/include/mlir/Transforms/DialectConversion.h b/mlir/include/mlir/Transforms/DialectConversion.h
index 307b126c23065..11a53206c2095 100644
--- a/mlir/include/mlir/Transforms/DialectConversion.h
+++ b/mlir/include/mlir/Transforms/DialectConversion.h
@@ -91,15 +91,15 @@ class TypeConverter {
   /// to any of the following forms(where `T` is a class derived from `Type`:
   ///   * Optional<Type>(T)
   ///     - This form represents a 1-1 type conversion. It should return nullptr
-  ///       or `llvm::None` to signify failure. If `llvm::None` is returned, the
-  ///       converter is allowed to try another conversion function to perform
-  ///       the conversion.
+  ///       or `std::nullopt` to signify failure. If `std::nullopt` is returned,
+  ///       the converter is allowed to try another conversion function to
+  ///       perform the conversion.
   ///   * Optional<LogicalResult>(T, SmallVectorImpl<Type> &)
   ///     - This form represents a 1-N type conversion. It should return
-  ///       `failure` or `llvm::None` to signify a failed conversion. If the new
-  ///       set of types is empty, the type is removed and any usages of the
+  ///       `failure` or `std::nullopt` to signify a failed conversion. If the
+  ///       new set of types is empty, the type is removed and any usages of the
   ///       existing value are expected to be removed during conversion. If
-  ///       `llvm::None` is returned, the converter is allowed to try another
+  ///       `std::nullopt` is returned, the converter is allowed to try another
   ///       conversion function to perform the conversion.
   ///   * Optional<LogicalResult>(T, SmallVectorImpl<Type> &, ArrayRef<Type>)
   ///     - This form represents a 1-N type conversion supporting recursive
@@ -123,7 +123,7 @@ class TypeConverter {
   /// where `T` is any subclass of `Type`. This function is responsible for
   /// creating an operation, using the OpBuilder and Location provided, that
   /// "casts" a range of values into a single value of the given type `T`. It
-  /// must return a Value of the converted type on success, an `llvm::None` if
+  /// must return a Value of the converted type on success, an `std::nullopt` if
   /// it failed but other materialization can be attempted, and `nullptr` on
   /// unrecoverable failure. It will only be called for (sub)types of `T`.
   /// Materialization functions must be provided when a type conversion may
@@ -834,8 +834,9 @@ 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, std::nullopt 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 std::nullopt if 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/AliasAnalysis/LocalAliasAnalysis.cpp b/mlir/lib/Analysis/AliasAnalysis/LocalAliasAnalysis.cpp
index caefd1c77962d..0c9beeaaf3016 100644
--- a/mlir/lib/Analysis/AliasAnalysis/LocalAliasAnalysis.cpp
+++ b/mlir/lib/Analysis/AliasAnalysis/LocalAliasAnalysis.cpp
@@ -39,10 +39,10 @@ static void collectUnderlyingAddressValues(RegionBranchOpInterface branch,
                                            unsigned maxDepth,
                                            DenseSet<Value> &visited,
                                            SmallVectorImpl<Value> &output) {
-  // Given the index of a region of the branch (`predIndex`), or None to
+  // Given the index of a region of the branch (`predIndex`), or std::nullopt to
   // represent the parent operation, try to return the index into the outputs of
   // this region predecessor that correspond to the input values of `region`. If
-  // an index could not be found, None is returned instead.
+  // an index could not be found, std::nullopt is returned instead.
   auto getOperandIndexIfPred =
       [&](Optional<unsigned> predIndex) -> Optional<unsigned> {
     SmallVector<RegionSuccessor, 2> successors;

diff  --git a/mlir/lib/Analysis/Presburger/Simplex.cpp b/mlir/lib/Analysis/Presburger/Simplex.cpp
index 98ea8653c135f..5c9d42019e8a1 100644
--- a/mlir/lib/Analysis/Presburger/Simplex.cpp
+++ b/mlir/lib/Analysis/Presburger/Simplex.cpp
@@ -1338,7 +1338,7 @@ MaybeOptimum<Fraction> Simplex::computeRowOptimum(Direction direction,
 }
 
 /// Compute the optimum of the specified expression in the specified direction,
-/// or None if it is unbounded.
+/// or std::nullopt if it is unbounded.
 MaybeOptimum<Fraction> Simplex::computeOptimum(Direction direction,
                                                ArrayRef<MPInt> coeffs) {
   if (empty)

diff  --git a/mlir/lib/AsmParser/Token.cpp b/mlir/lib/AsmParser/Token.cpp
index 7000c1419e60d..120a810ee6e52 100644
--- a/mlir/lib/AsmParser/Token.cpp
+++ b/mlir/lib/AsmParser/Token.cpp
@@ -124,8 +124,8 @@ std::string Token::getStringValue() const {
   return result;
 }
 
-/// Given a token containing a hex string literal, return its value or None if
-/// the token does not contain a valid hex string.
+/// Given a token containing a hex string literal, return its value or
+/// std::nullopt if the token does not contain a valid hex string.
 Optional<std::string> Token::getHexStringValue() const {
   assert(getKind() == string);
 

diff  --git a/mlir/lib/AsmParser/Token.h b/mlir/lib/AsmParser/Token.h
index 9f5cf1f837888..5f712b8937938 100644
--- a/mlir/lib/AsmParser/Token.h
+++ b/mlir/lib/AsmParser/Token.h
@@ -91,9 +91,9 @@ class Token {
   /// For an inttype token, return its bitwidth.
   Optional<unsigned> getIntTypeBitwidth() const;
 
-  /// For an inttype token, return its signedness semantics: llvm::None means no
-  /// signedness semantics; true means signed integer type; false means unsigned
-  /// integer type.
+  /// For an inttype token, return its signedness semantics: std::nullopt means
+  /// no signedness semantics; true means signed integer type; false means
+  /// unsigned integer type.
   Optional<bool> getIntTypeSignedness() const;
 
   /// Given a hash_identifier token like #123, try to parse the number out of
@@ -105,9 +105,10 @@ class Token {
   /// removing the quote characters and unescaping the contents of the string.
   std::string getStringValue() const;
 
-  /// Given a token containing a hex string literal, return its value or None if
-  /// the token does not contain a valid hex string. A hex string literal is a
-  /// string starting with `0x` and only containing hex digits.
+  /// Given a token containing a hex string literal, return its value or
+  /// std::nullopt if the token does not contain a valid hex string. A hex
+  /// string literal is a string starting with `0x` and only containing hex
+  /// digits.
   Optional<std::string> getHexStringValue() const;
 
   /// Given a token containing a symbol reference, return the unescaped string

diff  --git a/mlir/lib/Bytecode/Reader/BytecodeReader.cpp b/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
index 4ea8759615fcb..8c08ca7bb7d15 100644
--- a/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
+++ b/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
@@ -451,7 +451,8 @@ struct BytecodeOperationName {
   BytecodeOperationName(BytecodeDialect *dialect, StringRef name)
       : dialect(dialect), name(name) {}
 
-  /// The loaded operation name, or None if it hasn't been processed yet.
+  /// The loaded operation name, or std::nullopt if it hasn't been processed
+  /// yet.
   Optional<OperationName> opName;
 
   /// The dialect that owns this operation name.

diff  --git a/mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp b/mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp
index e06da8030539e..6be4a356e9671 100644
--- a/mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp
+++ b/mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp
@@ -179,7 +179,7 @@ static bool isConstantOne(Value value) {
 // mapping a loop nest of depth "numLoops" rooted at "forOp" to a GPU kernel.
 // This may fail if the IR for computing loop bounds cannot be constructed, for
 // example if an affine loop uses semi-affine maps. Return the last loop to be
-// mapped on success, llvm::None on failure.
+// mapped on success, std::nullopt on failure.
 Optional<AffineForOp>
 AffineLoopToGpuConverter::collectBounds(AffineForOp forOp, unsigned numLoops) {
   OpBuilder builder(forOp.getOperation());

diff  --git a/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp b/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
index 416a193ffc937..c168765458b5d 100644
--- a/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
+++ b/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
@@ -184,7 +184,7 @@ static bool broadcastSupportsMMAMatrixType(vector::BroadcastOp broadcastOp) {
 }
 
 /// Return the MMA elementwise enum associated with `op` if it is supported.
-/// Return `llvm::None` otherwise.
+/// Return `std::nullopt` otherwise.
 static std::optional<gpu::MMAElementwiseOp>
 convertElementwiseOpToMMA(Operation *op) {
   if (isa<arith::AddFOp>(op))

diff  --git a/mlir/lib/Dialect/Affine/Analysis/Utils.cpp b/mlir/lib/Dialect/Affine/Analysis/Utils.cpp
index ca78601af3032..33c0f207a1895 100644
--- a/mlir/lib/Dialect/Affine/Analysis/Utils.cpp
+++ b/mlir/lib/Dialect/Affine/Analysis/Utils.cpp
@@ -146,7 +146,7 @@ void ComputationSliceState::dump() const {
 /// each slice dimension maps to an existing dst dimension and both the src
 /// and the dst loops for those dimensions have the same bounds. Returns false
 /// if both the src and the dst loops don't have the same bounds. Returns
-/// llvm::None if none of the above can be proven.
+/// std::nullopt if none of the above can be proven.
 Optional<bool> ComputationSliceState::isSliceMaximalFastCheck() const {
   assert(lbs.size() == ubs.size() && !lbs.empty() && !ivs.empty() &&
          "Unexpected number of lbs, ubs and ivs in slice");

diff  --git a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
index 43d01205dfad5..7039c71faddb5 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
@@ -960,9 +960,9 @@ struct FoldReshapeWithGenericOpByExpansion
 //===---------------------------------------------------------------------===//
 
 /// For a given list of indices in the range of the `indexingMap` that are
-/// folded, return the indices of the corresponding domain. Return `llvm::None`
-/// on failure. Ensures that all the elements of the returned reassociation are
-/// distinct.
+/// folded, return the indices of the corresponding domain. Return
+/// `std::nullopt` on failure. Ensures that all the elements of the returned
+/// reassociation are distinct.
 static ReassociationIndices
 getDomainReassociation(AffineMap indexingMap,
                        ReassociationIndicesRef rangeReassociation) {

diff  --git a/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
index 592697d1e58e3..fda709303b99e 100644
--- a/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
@@ -190,7 +190,7 @@ static SmallVector<int64_t> getReductionIndex(AffineMap map,
 }
 
 /// Look for a given dimension in an affine map and return its position. Return
-/// llvm::None if the dimension is not in the map results.
+/// std::nullopt if the dimension is not in the map results.
 static llvm::Optional<unsigned> getDimPosition(AffineMap map, unsigned dim) {
   for (unsigned i = 0, e = map.getNumResults(); i < e; i++) {
     if (map.getDimPosition(i) == dim)

diff  --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp
index 8f9ec2476663a..3f7442d4e306e 100644
--- a/mlir/lib/IR/AsmPrinter.cpp
+++ b/mlir/lib/IR/AsmPrinter.cpp
@@ -529,7 +529,8 @@ class AliasInitializer {
       return alias < rhs.alias;
     }
 
-    /// The alias for the attribute or type, or None if the value has no alias.
+    /// The alias for the attribute or type, or std::nullopt if the value has no
+    /// alias.
     Optional<StringRef> alias;
     /// The alias depth of this attribute or type, i.e. an indication of the
     /// relative ordering of when to print this alias.

diff  --git a/mlir/lib/Interfaces/ControlFlowInterfaces.cpp b/mlir/lib/Interfaces/ControlFlowInterfaces.cpp
index 77b57bc4a8922..e87724eee796c 100644
--- a/mlir/lib/Interfaces/ControlFlowInterfaces.cpp
+++ b/mlir/lib/Interfaces/ControlFlowInterfaces.cpp
@@ -34,8 +34,8 @@ SuccessorOperands::SuccessorOperands(unsigned int producedOperandCount,
 //===----------------------------------------------------------------------===//
 
 /// Returns the `BlockArgument` corresponding to operand `operandIndex` in some
-/// successor if 'operandIndex' is within the range of 'operands', or None if
-/// `operandIndex` isn't a successor operand index.
+/// successor if 'operandIndex' is within the range of 'operands', or
+/// std::nullopt if `operandIndex` isn't a successor operand index.
 Optional<BlockArgument>
 detail::getBranchSuccessorArgument(const SuccessorOperands &operands,
                                    unsigned operandIndex, Block *successor) {
@@ -85,9 +85,9 @@ detail::verifyBranchSuccessorOperands(Operation *op, unsigned succNo,
 //===----------------------------------------------------------------------===//
 
 /// Verify that types match along all region control flow edges originating from
-/// `sourceNo` (region # if source is a region, llvm::None if source is parent
+/// `sourceNo` (region # if source is a region, std::nullopt if source is parent
 /// op). `getInputsTypesForRegion` is a function that returns the types of the
-/// inputs that flow from `sourceIndex' to the given region, or llvm::None if
+/// inputs that flow from `sourceIndex' to the given region, or std::nullopt if
 /// the exact type match verification is not necessary (e.g., if the Op verifies
 /// the match itself).
 static LogicalResult
@@ -363,9 +363,9 @@ bool mlir::isRegionReturnLike(Operation *operation) {
 /// Returns the mutable operands that are passed to the region with the given
 /// `regionIndex`. If the operation does not implement the
 /// `RegionBranchTerminatorOpInterface` and is not marked as `ReturnLike`, the
-/// result will be `llvm::None`. In all other cases, the resulting
+/// result will be `std::nullopt`. In all other cases, the resulting
 /// `OperandRange` represents all operands that are passed to the specified
-/// successor region. If `regionIndex` is `llvm::None`, all operands that are
+/// successor region. If `regionIndex` is `std::nullopt`, all operands that are
 /// passed to the parent operation will be returned.
 Optional<MutableOperandRange>
 mlir::getMutableRegionBranchSuccessorOperands(Operation *operation,

diff  --git a/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp b/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
index 150e731e99e5a..f93861e064457 100644
--- a/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
+++ b/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
@@ -41,10 +41,10 @@ static Optional<lsp::Location> getLocationFromLoc(StringRef uriScheme,
   return lsp::Location{*sourceURI, lsp::Range(position)};
 }
 
-/// Returns a language server location from the given MLIR location, or None if
-/// one couldn't be created. `uriScheme` is the scheme to use when building new
-/// uris. `uri` is an optional additional filter that, when present, is used to
-/// filter sub locations that do not share the same uri.
+/// Returns a language server location from the given MLIR location, or
+/// std::nullopt if one couldn't be created. `uriScheme` is the scheme to use
+/// when building new uris. `uri` is an optional additional filter that, when
+/// present, is used to filter sub locations that do not share the same uri.
 static Optional<lsp::Location>
 getLocationFromLoc(llvm::SourceMgr &sourceMgr, Location loc,
                    StringRef uriScheme, const lsp::URIForFile *uri = nullptr) {
@@ -126,7 +126,7 @@ static bool isDefOrUse(const AsmParserState::SMDefinition &def, SMLoc loc,
 }
 
 /// Given a location pointing to a result, return the result number it refers
-/// to or None if it refers to all of the results.
+/// to or std::nullopt if it refers to all of the results.
 static Optional<unsigned> getResultNumberFromLoc(SMLoc loc) {
   // Skip all of the identifier characters.
   auto isIdentifierChar = [](char c) {

diff  --git a/mlir/lib/Tools/mlir-lsp-server/MLIRServer.h b/mlir/lib/Tools/mlir-lsp-server/MLIRServer.h
index ee6c2cd25bd57..f7978708385c1 100644
--- a/mlir/lib/Tools/mlir-lsp-server/MLIRServer.h
+++ b/mlir/lib/Tools/mlir-lsp-server/MLIRServer.h
@@ -46,8 +46,8 @@ class MLIRServer {
                            std::vector<Diagnostic> &diagnostics);
 
   /// Remove the document with the given uri. Returns the version of the removed
-  /// document, or None if the uri did not have a corresponding document within
-  /// the server.
+  /// document, or std::nullopt if the uri did not have a corresponding document
+  /// within the server.
   Optional<int64_t> removeDocument(const URIForFile &uri);
 
   /// Return the locations of the object pointed at by the given position.
@@ -58,8 +58,8 @@ class MLIRServer {
   void findReferencesOf(const URIForFile &uri, const Position &pos,
                         std::vector<Location> &references);
 
-  /// Find a hover description for the given hover position, or None if one
-  /// couldn't be found.
+  /// Find a hover description for the given hover position, or std::nullopt if
+  /// one couldn't be found.
   Optional<Hover> findHover(const URIForFile &uri, const Position &hoverPos);
 
   /// Find all of the document symbols within the given file.

diff  --git a/mlir/lib/Tools/mlir-pdll-lsp-server/PDLLServer.h b/mlir/lib/Tools/mlir-pdll-lsp-server/PDLLServer.h
index e6d117c6ec30a..2542354d0e2ca 100644
--- a/mlir/lib/Tools/mlir-pdll-lsp-server/PDLLServer.h
+++ b/mlir/lib/Tools/mlir-pdll-lsp-server/PDLLServer.h
@@ -65,8 +65,8 @@ class PDLLServer {
                       int64_t version, std::vector<Diagnostic> &diagnostics);
 
   /// Remove the document with the given uri. Returns the version of the removed
-  /// document, or None if the uri did not have a corresponding document within
-  /// the server.
+  /// document, or std::nullopt if the uri did not have a corresponding document
+  /// within the server.
   Optional<int64_t> removeDocument(const URIForFile &uri);
 
   /// Return the locations of the object pointed at by the given position.
@@ -81,8 +81,8 @@ class PDLLServer {
   void getDocumentLinks(const URIForFile &uri,
                         std::vector<DocumentLink> &documentLinks);
 
-  /// Find a hover description for the given hover position, or None if one
-  /// couldn't be found.
+  /// Find a hover description for the given hover position, or std::nullopt if
+  /// one couldn't be found.
   Optional<Hover> findHover(const URIForFile &uri, const Position &hoverPos);
 
   /// Find all of the document symbols within the given file.
@@ -101,8 +101,8 @@ class PDLLServer {
   void getInlayHints(const URIForFile &uri, const Range &range,
                      std::vector<InlayHint> &inlayHints);
 
-  /// Get the output of the given PDLL file, or None if there is no valid
-  /// output.
+  /// Get the output of the given PDLL file, or std::nullopt if there is no
+  /// valid output.
   Optional<PDLLViewOutputResult> getPDLLViewOutput(const URIForFile &uri,
                                                    PDLLViewOutputKind kind);
 

diff  --git a/mlir/lib/Tools/tblgen-lsp-server/TableGenServer.h b/mlir/lib/Tools/tblgen-lsp-server/TableGenServer.h
index 4ae73e352d48b..0565c27ef6ca0 100644
--- a/mlir/lib/Tools/tblgen-lsp-server/TableGenServer.h
+++ b/mlir/lib/Tools/tblgen-lsp-server/TableGenServer.h
@@ -57,8 +57,8 @@ class TableGenServer {
                       int64_t version, std::vector<Diagnostic> &diagnostics);
 
   /// Remove the document with the given uri. Returns the version of the removed
-  /// document, or None if the uri did not have a corresponding document within
-  /// the server.
+  /// document, or std::nullopt if the uri did not have a corresponding document
+  /// within the server.
   Optional<int64_t> removeDocument(const URIForFile &uri);
 
   /// Return the locations of the object pointed at by the given position.
@@ -73,8 +73,8 @@ class TableGenServer {
   void getDocumentLinks(const URIForFile &uri,
                         std::vector<DocumentLink> &documentLinks);
 
-  /// Find a hover description for the given hover position, or None if one
-  /// couldn't be found.
+  /// Find a hover description for the given hover position, or std::nullopt if
+  /// one couldn't be found.
   Optional<Hover> findHover(const URIForFile &uri, const Position &hoverPos);
 
 private:

diff  --git a/mlir/tools/mlir-tblgen/OpFormatGen.cpp b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
index 07a6ab9c2b718..daa4e9de70539 100644
--- a/mlir/tools/mlir-tblgen/OpFormatGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
@@ -57,8 +57,8 @@ struct AttributeVariable
     : public OpVariableElement<NamedAttribute, VariableElement::Attribute> {
   using Base::Base;
 
-  /// Return the constant builder call for the type of this attribute, or None
-  /// if it doesn't have one.
+  /// Return the constant builder call for the type of this attribute, or
+  /// std::nullopt if it doesn't have one.
   llvm::Optional<StringRef> getTypeBuilder() const {
     llvm::Optional<Type> attrType = var->attr.getValueType();
     return attrType ? attrType->getBuilderCall() : std::nullopt;
@@ -251,7 +251,7 @@ struct OperationFormat {
   public:
     TypeResolution() = default;
 
-    /// Get the index into the buildable types for this type, or None.
+    /// Get the index into the buildable types for this type, or std::nullopt.
     Optional<int> getBuilderIdx() const { return builderIdx; }
     void setBuilderIdx(int idx) { builderIdx = idx; }
 
@@ -263,7 +263,7 @@ struct OperationFormat {
     const NamedAttribute *getAttribute() const {
       return resolver.dyn_cast<const NamedAttribute *>();
     }
-    /// Get the transformer for the type of the variable, or None.
+    /// Get the transformer for the type of the variable, or std::nullopt.
     Optional<StringRef> getVarTransformer() const {
       return variableTransformer;
     }

diff  --git a/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp b/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp
index f83908c368383..a5ffcc44519f2 100644
--- a/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp
@@ -71,7 +71,7 @@ class {0}(_ods_ir.OpView):
 /// Each segment spec is either None (default) or an array of integers
 /// where:
 ///   1 = single element (expect non sequence operand/result)
-///   0 = optional element (expect a value or None)
+///   0 = optional element (expect a value or std::nullopt)
 ///   -1 = operand/result is a sequence corresponding to a variadic
 constexpr const char *opClassSizedSegmentsTemplate = R"Py(
   _ODS_{0}_SEGMENTS = {1}


        


More information about the Mlir-commits mailing list