[Mlir-commits] [mlir] e823aba - [mlir] Use std::nullopt instead of None in comments (NFC)
Kazu Hirata
llvmlistbot at llvm.org
Tue Dec 6 00:03:50 PST 2022
Author: Kazu Hirata
Date: 2022-12-06T00:03:44-08:00
New Revision: e823abab489390a62ae845e9855ebb36e9c447c6
URL: https://github.com/llvm/llvm-project/commit/e823abab489390a62ae845e9855ebb36e9c447c6
DIFF: https://github.com/llvm/llvm-project/commit/e823abab489390a62ae845e9855ebb36e9c447c6.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/DefiningDialects/AttributesAndTypes.md
mlir/docs/DefiningDialects/Operations.md
mlir/examples/toy/Ch1/include/toy/AST.h
mlir/examples/toy/Ch2/include/toy/AST.h
mlir/examples/toy/Ch2/include/toy/Ops.td
mlir/examples/toy/Ch2/mlir/MLIRGen.cpp
mlir/examples/toy/Ch3/include/toy/AST.h
mlir/examples/toy/Ch3/include/toy/Ops.td
mlir/examples/toy/Ch3/mlir/MLIRGen.cpp
mlir/examples/toy/Ch4/include/toy/AST.h
mlir/examples/toy/Ch4/include/toy/Ops.td
mlir/examples/toy/Ch4/mlir/MLIRGen.cpp
mlir/examples/toy/Ch5/include/toy/AST.h
mlir/examples/toy/Ch5/include/toy/Ops.td
mlir/examples/toy/Ch5/mlir/MLIRGen.cpp
mlir/examples/toy/Ch6/include/toy/AST.h
mlir/examples/toy/Ch6/include/toy/Ops.td
mlir/examples/toy/Ch6/mlir/MLIRGen.cpp
mlir/examples/toy/Ch7/include/toy/AST.h
mlir/examples/toy/Ch7/include/toy/Ops.td
mlir/examples/toy/Ch7/mlir/MLIRGen.cpp
mlir/include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.td
mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
mlir/include/mlir/Interfaces/ControlFlowInterfaces.td
mlir/include/mlir/Interfaces/LoopLikeInterface.td
mlir/lib/Bindings/Python/IRCore.cpp
mlir/lib/Bindings/Python/IRModule.cpp
mlir/lib/Bindings/Python/IRTypes.cpp
Removed:
################################################################################
diff --git a/mlir/docs/DefiningDialects/AttributesAndTypes.md b/mlir/docs/DefiningDialects/AttributesAndTypes.md
index d794b942f788c..afceda9f3b501 100644
--- a/mlir/docs/DefiningDialects/AttributesAndTypes.md
+++ b/mlir/docs/DefiningDialects/AttributesAndTypes.md
@@ -653,7 +653,7 @@ operator is used.
When using `OptionalParameter`, the default value is set to the C++
default-constructed value for the C++ storage type. For example, `Optional<int>`
-will be set to `llvm::None` and `Attribute` will be set to `nullptr`. The
+will be set to `std::nullopt` and `Attribute` will be set to `nullptr`. The
presence of these parameters is tested by comparing them to their "null" values.
An optional group is a set of elements optionally printed based on the presence
diff --git a/mlir/docs/DefiningDialects/Operations.md b/mlir/docs/DefiningDialects/Operations.md
index c131047e3978a..2fbc7362b9e06 100644
--- a/mlir/docs/DefiningDialects/Operations.md
+++ b/mlir/docs/DefiningDialects/Operations.md
@@ -1391,13 +1391,13 @@ llvm::Optional<MyIntEnum> ConvertToEnum(llvm::StringRef str) {
return llvm::StringSwitch<llvm::Optional<MyIntEnum>>(str)
.Case("Case15", MyIntEnum::Case15)
.Case("Case20", MyIntEnum::Case20)
- .Default(llvm::None);
+ .Default(std::nullopt);
}
llvm::Optional<MyIntEnum> symbolizeMyIntEnum(uint32_t value) {
switch (value) {
case 15: return MyIntEnum::Case15;
case 20: return MyIntEnum::Case20;
- default: return llvm::None;
+ default: return std::nullopt;
}
}
@@ -1520,8 +1520,8 @@ llvm::Optional<MyBitEnum> symbolizeMyBitEnum(llvm::StringRef str) {
.Case("Bit1", 2)
.Case("Bit2", 4)
.Case("Bit3", 8)
- .Default(llvm::None);
- if (bit) { val |= *bit; } else { return llvm::None; }
+ .Default(std::nullopt);
+ if (bit) { val |= *bit; } else { return std::nullopt; }
}
return static_cast<MyBitEnum>(val);
}
@@ -1530,7 +1530,7 @@ llvm::Optional<MyBitEnum> symbolizeMyBitEnum(uint32_t value) {
// Special case for all bits unset.
if (value == 0) return MyBitEnum::None;
- if (value & ~static_cast<uint32_t>(15u)) return llvm::None;
+ if (value & ~static_cast<uint32_t>(15u)) return std::nullopt;
return static_cast<MyBitEnum>(value);
}
```
diff --git a/mlir/examples/toy/Ch1/include/toy/AST.h b/mlir/examples/toy/Ch1/include/toy/AST.h
index f3a30fc534e96..6b9fdb617bea6 100644
--- a/mlir/examples/toy/Ch1/include/toy/AST.h
+++ b/mlir/examples/toy/Ch1/include/toy/AST.h
@@ -137,7 +137,7 @@ class ReturnExprAST : public ExprAST {
llvm::Optional<ExprAST *> getExpr() {
if (expr.has_value())
return expr->get();
- return llvm::None;
+ return std::nullopt;
}
/// LLVM style RTTI
diff --git a/mlir/examples/toy/Ch2/include/toy/AST.h b/mlir/examples/toy/Ch2/include/toy/AST.h
index f3a30fc534e96..6b9fdb617bea6 100644
--- a/mlir/examples/toy/Ch2/include/toy/AST.h
+++ b/mlir/examples/toy/Ch2/include/toy/AST.h
@@ -137,7 +137,7 @@ class ReturnExprAST : public ExprAST {
llvm::Optional<ExprAST *> getExpr() {
if (expr.has_value())
return expr->get();
- return llvm::None;
+ return std::nullopt;
}
/// LLVM style RTTI
diff --git a/mlir/examples/toy/Ch2/include/toy/Ops.td b/mlir/examples/toy/Ch2/include/toy/Ops.td
index f98915f7cd091..380536bc3f945 100644
--- a/mlir/examples/toy/Ch2/include/toy/Ops.td
+++ b/mlir/examples/toy/Ch2/include/toy/Ops.td
@@ -291,7 +291,7 @@ def ReturnOp : Toy_Op<"return", [Pure, HasParent<"FuncOp">,
// Allow building a ReturnOp with no return operand.
let builders = [
- OpBuilder<(ins), [{ build($_builder, $_state, llvm::None); }]>
+ OpBuilder<(ins), [{ build($_builder, $_state, std::nullopt); }]>
];
// Provide extra utility definitions on the c++ operation class definition.
diff --git a/mlir/examples/toy/Ch2/mlir/MLIRGen.cpp b/mlir/examples/toy/Ch2/mlir/MLIRGen.cpp
index 167c8079d07d8..1790f4b550a6b 100644
--- a/mlir/examples/toy/Ch2/mlir/MLIRGen.cpp
+++ b/mlir/examples/toy/Ch2/mlir/MLIRGen.cpp
@@ -111,7 +111,7 @@ class MLIRGenImpl {
// Arguments type are uniformly unranked tensors.
llvm::SmallVector<mlir::Type, 4> argTypes(proto.getArgs().size(),
getType(VarType{}));
- auto funcType = builder.getFunctionType(argTypes, llvm::None);
+ auto funcType = builder.getFunctionType(argTypes, std::nullopt);
return builder.create<mlir::toy::FuncOp>(location, proto.getName(),
funcType);
}
diff --git a/mlir/examples/toy/Ch3/include/toy/AST.h b/mlir/examples/toy/Ch3/include/toy/AST.h
index f3a30fc534e96..6b9fdb617bea6 100644
--- a/mlir/examples/toy/Ch3/include/toy/AST.h
+++ b/mlir/examples/toy/Ch3/include/toy/AST.h
@@ -137,7 +137,7 @@ class ReturnExprAST : public ExprAST {
llvm::Optional<ExprAST *> getExpr() {
if (expr.has_value())
return expr->get();
- return llvm::None;
+ return std::nullopt;
}
/// LLVM style RTTI
diff --git a/mlir/examples/toy/Ch3/include/toy/Ops.td b/mlir/examples/toy/Ch3/include/toy/Ops.td
index 8525255a1f5d4..e526fe5bdaf51 100644
--- a/mlir/examples/toy/Ch3/include/toy/Ops.td
+++ b/mlir/examples/toy/Ch3/include/toy/Ops.td
@@ -293,7 +293,7 @@ def ReturnOp : Toy_Op<"return", [Pure, HasParent<"FuncOp">,
// Allow building a ReturnOp with no return operand.
let builders = [
- OpBuilder<(ins), [{ build($_builder, $_state, llvm::None); }]>
+ OpBuilder<(ins), [{ build($_builder, $_state, std::nullopt); }]>
];
// Provide extra utility definitions on the c++ operation class definition.
diff --git a/mlir/examples/toy/Ch3/mlir/MLIRGen.cpp b/mlir/examples/toy/Ch3/mlir/MLIRGen.cpp
index 167c8079d07d8..1790f4b550a6b 100644
--- a/mlir/examples/toy/Ch3/mlir/MLIRGen.cpp
+++ b/mlir/examples/toy/Ch3/mlir/MLIRGen.cpp
@@ -111,7 +111,7 @@ class MLIRGenImpl {
// Arguments type are uniformly unranked tensors.
llvm::SmallVector<mlir::Type, 4> argTypes(proto.getArgs().size(),
getType(VarType{}));
- auto funcType = builder.getFunctionType(argTypes, llvm::None);
+ auto funcType = builder.getFunctionType(argTypes, std::nullopt);
return builder.create<mlir::toy::FuncOp>(location, proto.getName(),
funcType);
}
diff --git a/mlir/examples/toy/Ch4/include/toy/AST.h b/mlir/examples/toy/Ch4/include/toy/AST.h
index f3a30fc534e96..6b9fdb617bea6 100644
--- a/mlir/examples/toy/Ch4/include/toy/AST.h
+++ b/mlir/examples/toy/Ch4/include/toy/AST.h
@@ -137,7 +137,7 @@ class ReturnExprAST : public ExprAST {
llvm::Optional<ExprAST *> getExpr() {
if (expr.has_value())
return expr->get();
- return llvm::None;
+ return std::nullopt;
}
/// LLVM style RTTI
diff --git a/mlir/examples/toy/Ch4/include/toy/Ops.td b/mlir/examples/toy/Ch4/include/toy/Ops.td
index bf1d41fade843..4956b0ed2f793 100644
--- a/mlir/examples/toy/Ch4/include/toy/Ops.td
+++ b/mlir/examples/toy/Ch4/include/toy/Ops.td
@@ -325,7 +325,7 @@ def ReturnOp : Toy_Op<"return", [Pure, HasParent<"FuncOp">,
// Allow building a ReturnOp with no return operand.
let builders = [
- OpBuilder<(ins), [{ build($_builder, $_state, llvm::None); }]>
+ OpBuilder<(ins), [{ build($_builder, $_state, std::nullopt); }]>
];
// Provide extra utility definitions on the c++ operation class definition.
diff --git a/mlir/examples/toy/Ch4/mlir/MLIRGen.cpp b/mlir/examples/toy/Ch4/mlir/MLIRGen.cpp
index 0d586e0d07857..d5061d9adf0ae 100644
--- a/mlir/examples/toy/Ch4/mlir/MLIRGen.cpp
+++ b/mlir/examples/toy/Ch4/mlir/MLIRGen.cpp
@@ -111,7 +111,7 @@ class MLIRGenImpl {
// Arguments type are uniformly unranked tensors.
llvm::SmallVector<mlir::Type, 4> argTypes(proto.getArgs().size(),
getType(VarType{}));
- auto funcType = builder.getFunctionType(argTypes, llvm::None);
+ auto funcType = builder.getFunctionType(argTypes, std::nullopt);
return builder.create<mlir::toy::FuncOp>(location, proto.getName(),
funcType);
}
diff --git a/mlir/examples/toy/Ch5/include/toy/AST.h b/mlir/examples/toy/Ch5/include/toy/AST.h
index f3a30fc534e96..6b9fdb617bea6 100644
--- a/mlir/examples/toy/Ch5/include/toy/AST.h
+++ b/mlir/examples/toy/Ch5/include/toy/AST.h
@@ -137,7 +137,7 @@ class ReturnExprAST : public ExprAST {
llvm::Optional<ExprAST *> getExpr() {
if (expr.has_value())
return expr->get();
- return llvm::None;
+ return std::nullopt;
}
/// LLVM style RTTI
diff --git a/mlir/examples/toy/Ch5/include/toy/Ops.td b/mlir/examples/toy/Ch5/include/toy/Ops.td
index 1123dd92baf7a..f4e7b08732ed3 100644
--- a/mlir/examples/toy/Ch5/include/toy/Ops.td
+++ b/mlir/examples/toy/Ch5/include/toy/Ops.td
@@ -326,7 +326,7 @@ def ReturnOp : Toy_Op<"return", [Pure, HasParent<"FuncOp">,
// Allow building a ReturnOp with no return operand.
let builders = [
- OpBuilder<(ins), [{ build($_builder, $_state, llvm::None); }]>
+ OpBuilder<(ins), [{ build($_builder, $_state, std::nullopt); }]>
];
// Provide extra utility definitions on the c++ operation class definition.
diff --git a/mlir/examples/toy/Ch5/mlir/MLIRGen.cpp b/mlir/examples/toy/Ch5/mlir/MLIRGen.cpp
index 0d586e0d07857..d5061d9adf0ae 100644
--- a/mlir/examples/toy/Ch5/mlir/MLIRGen.cpp
+++ b/mlir/examples/toy/Ch5/mlir/MLIRGen.cpp
@@ -111,7 +111,7 @@ class MLIRGenImpl {
// Arguments type are uniformly unranked tensors.
llvm::SmallVector<mlir::Type, 4> argTypes(proto.getArgs().size(),
getType(VarType{}));
- auto funcType = builder.getFunctionType(argTypes, llvm::None);
+ auto funcType = builder.getFunctionType(argTypes, std::nullopt);
return builder.create<mlir::toy::FuncOp>(location, proto.getName(),
funcType);
}
diff --git a/mlir/examples/toy/Ch6/include/toy/AST.h b/mlir/examples/toy/Ch6/include/toy/AST.h
index f3a30fc534e96..6b9fdb617bea6 100644
--- a/mlir/examples/toy/Ch6/include/toy/AST.h
+++ b/mlir/examples/toy/Ch6/include/toy/AST.h
@@ -137,7 +137,7 @@ class ReturnExprAST : public ExprAST {
llvm::Optional<ExprAST *> getExpr() {
if (expr.has_value())
return expr->get();
- return llvm::None;
+ return std::nullopt;
}
/// LLVM style RTTI
diff --git a/mlir/examples/toy/Ch6/include/toy/Ops.td b/mlir/examples/toy/Ch6/include/toy/Ops.td
index 9eab6c2353bed..ea9323ece6259 100644
--- a/mlir/examples/toy/Ch6/include/toy/Ops.td
+++ b/mlir/examples/toy/Ch6/include/toy/Ops.td
@@ -326,7 +326,7 @@ def ReturnOp : Toy_Op<"return", [Pure, HasParent<"FuncOp">,
// Allow building a ReturnOp with no return operand.
let builders = [
- OpBuilder<(ins), [{ build($_builder, $_state, llvm::None); }]>
+ OpBuilder<(ins), [{ build($_builder, $_state, std::nullopt); }]>
];
// Provide extra utility definitions on the c++ operation class definition.
diff --git a/mlir/examples/toy/Ch6/mlir/MLIRGen.cpp b/mlir/examples/toy/Ch6/mlir/MLIRGen.cpp
index 0d586e0d07857..d5061d9adf0ae 100644
--- a/mlir/examples/toy/Ch6/mlir/MLIRGen.cpp
+++ b/mlir/examples/toy/Ch6/mlir/MLIRGen.cpp
@@ -111,7 +111,7 @@ class MLIRGenImpl {
// Arguments type are uniformly unranked tensors.
llvm::SmallVector<mlir::Type, 4> argTypes(proto.getArgs().size(),
getType(VarType{}));
- auto funcType = builder.getFunctionType(argTypes, llvm::None);
+ auto funcType = builder.getFunctionType(argTypes, std::nullopt);
return builder.create<mlir::toy::FuncOp>(location, proto.getName(),
funcType);
}
diff --git a/mlir/examples/toy/Ch7/include/toy/AST.h b/mlir/examples/toy/Ch7/include/toy/AST.h
index 665b8d5aa3eaf..9286f5bee4bf6 100644
--- a/mlir/examples/toy/Ch7/include/toy/AST.h
+++ b/mlir/examples/toy/Ch7/include/toy/AST.h
@@ -157,7 +157,7 @@ class ReturnExprAST : public ExprAST {
llvm::Optional<ExprAST *> getExpr() {
if (expr.has_value())
return expr->get();
- return llvm::None;
+ return std::nullopt;
}
/// LLVM style RTTI
diff --git a/mlir/examples/toy/Ch7/include/toy/Ops.td b/mlir/examples/toy/Ch7/include/toy/Ops.td
index 5a58434f70d62..45ecdd3bc78f9 100644
--- a/mlir/examples/toy/Ch7/include/toy/Ops.td
+++ b/mlir/examples/toy/Ch7/include/toy/Ops.td
@@ -350,7 +350,7 @@ def ReturnOp : Toy_Op<"return", [Pure, HasParent<"FuncOp">,
// Allow building a ReturnOp with no return operand.
let builders = [
- OpBuilder<(ins), [{ build($_builder, $_state, llvm::None); }]>
+ OpBuilder<(ins), [{ build($_builder, $_state, std::nullopt); }]>
];
// Provide extra utility definitions on the c++ operation class definition.
diff --git a/mlir/examples/toy/Ch7/mlir/MLIRGen.cpp b/mlir/examples/toy/Ch7/mlir/MLIRGen.cpp
index 8f2420ccacb3f..93c9bd5997f71 100644
--- a/mlir/examples/toy/Ch7/mlir/MLIRGen.cpp
+++ b/mlir/examples/toy/Ch7/mlir/MLIRGen.cpp
@@ -167,7 +167,7 @@ class MLIRGenImpl {
return nullptr;
argTypes.push_back(type);
}
- auto funcType = builder.getFunctionType(argTypes, llvm::None);
+ auto funcType = builder.getFunctionType(argTypes, std::nullopt);
return builder.create<mlir::toy::FuncOp>(location, proto.getName(),
funcType);
}
@@ -277,19 +277,19 @@ class MLIRGenImpl {
// Lookup the struct node for the LHS.
StructAST *structAST = getStructFor(accessOp.getLHS());
if (!structAST)
- return llvm::None;
+ return std::nullopt;
// Get the name from the RHS.
VariableExprAST *name = llvm::dyn_cast<VariableExprAST>(accessOp.getRHS());
if (!name)
- return llvm::None;
+ return std::nullopt;
auto structVars = structAST->getVariables();
const auto *it = llvm::find_if(structVars, [&](auto &var) {
return var->getName() == name->getName();
});
if (it == structVars.end())
- return llvm::None;
+ return std::nullopt;
return it - structVars.begin();
}
@@ -426,10 +426,10 @@ class MLIRGenImpl {
for (auto &var : lit.getValues()) {
if (auto *number = llvm::dyn_cast<NumberExprAST>(var.get())) {
attrElements.push_back(getConstantAttr(*number));
- typeElements.push_back(getType(llvm::None));
+ typeElements.push_back(getType(std::nullopt));
} else if (auto *lit = llvm::dyn_cast<LiteralExprAST>(var.get())) {
attrElements.push_back(getConstantAttr(*lit));
- typeElements.push_back(getType(llvm::None));
+ typeElements.push_back(getType(std::nullopt));
} else {
auto *structLit = llvm::cast<StructLiteralExprAST>(var.get());
auto attrTypePair = getConstantAttr(*structLit);
diff --git a/mlir/include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.td b/mlir/include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.td
index de63062187a84..eaee9d282929b 100644
--- a/mlir/include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.td
+++ b/mlir/include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.td
@@ -35,7 +35,7 @@ def AllocationOpInterface : OpInterface<"AllocationOpInterface"> {
current allocation value (which refers to the current Op implementing
this interface). The allocation value is a result of the current
operation implementing this interface. If there is no compatible
- deallocation operation, this method can return ::llvm::None.
+ deallocation operation, this method can return ::std::nullopt.
}],
"::mlir::Optional<::mlir::Operation*>", "buildDealloc",
(ins "::mlir::OpBuilder&":$builder, "::mlir::Value":$alloc), [{}],
@@ -46,7 +46,7 @@ def AllocationOpInterface : OpInterface<"AllocationOpInterface"> {
allocation value (which refers to the current Op implementing this
interface). The allocation value is a result of the current operation
implementing this interface. If there is no compatible clone operation,
- this method can return ::llvm::None.
+ this method can return ::std::nullopt.
}],
"::mlir::Optional<::mlir::Value>", "buildClone",
(ins "::mlir::OpBuilder&":$builder, "::mlir::Value":$alloc), [{}],
diff --git a/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td b/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
index 8d8939eb4f115..f035ab3dbc043 100644
--- a/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
+++ b/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
@@ -554,7 +554,7 @@ def Vector_ExtractElementOp :
Note that this instruction resembles vector.extract, but is restricted to
0-D and 1-D vectors and relaxed to dynamic indices.
- If the vector is 0-D, the position must be llvm::None.
+ If the vector is 0-D, the position must be std::nullopt.
It is meant to be closer to LLVM's version:
diff --git a/mlir/include/mlir/Interfaces/ControlFlowInterfaces.td b/mlir/include/mlir/Interfaces/ControlFlowInterfaces.td
index 6e2ed7e76d979..9f5a0a41e65f3 100644
--- a/mlir/include/mlir/Interfaces/ControlFlowInterfaces.td
+++ b/mlir/include/mlir/Interfaces/ControlFlowInterfaces.td
@@ -171,7 +171,7 @@ def RegionBranchOpInterface : OpInterface<"RegionBranchOpInterface"> {
regions yield normally, i.e. do not abort or invoke an infinite loop).
The minimum number of invocations is at least 0. If the maximum number
of invocations cannot be statically determined, then it will not have a
- value (i.e., it is set to `llvm::None`).
+ value (i.e., it is set to `std::nullopt`).
`operands` is a set of optional attributes that either correspond to
constant values for each operand of this operation or null if that
diff --git a/mlir/include/mlir/Interfaces/LoopLikeInterface.td b/mlir/include/mlir/Interfaces/LoopLikeInterface.td
index 6c89c10e8256d..748b668594be5 100644
--- a/mlir/include/mlir/Interfaces/LoopLikeInterface.td
+++ b/mlir/include/mlir/Interfaces/LoopLikeInterface.td
@@ -50,7 +50,7 @@ def LoopLikeOpInterface : OpInterface<"LoopLikeOpInterface"> {
>,
InterfaceMethod<[{
If there is a single induction variable return it, otherwise return
- llvm::None.
+ std::nullopt.
}],
/*retTy=*/"::llvm::Optional<::mlir::Value>",
/*methodName=*/"getSingleInductionVar",
@@ -62,7 +62,7 @@ def LoopLikeOpInterface : OpInterface<"LoopLikeOpInterface"> {
>,
InterfaceMethod<[{
Return the single lower bound value or attribute if it exists, otherwise
- return llvm::None.
+ return std::nullopt.
}],
/*retTy=*/"::llvm::Optional<::mlir::OpFoldResult>",
/*methodName=*/"getSingleLowerBound",
@@ -74,7 +74,7 @@ def LoopLikeOpInterface : OpInterface<"LoopLikeOpInterface"> {
>,
InterfaceMethod<[{
Return the single step value or attribute if it exists, otherwise
- return llvm::None.
+ return std::nullopt.
}],
/*retTy=*/"::llvm::Optional<::mlir::OpFoldResult>",
/*methodName=*/"getSingleStep",
@@ -86,7 +86,7 @@ def LoopLikeOpInterface : OpInterface<"LoopLikeOpInterface"> {
>,
InterfaceMethod<[{
Return the single upper bound value or attribute if it exists, otherwise
- return llvm::None.
+ return std::nullopt.
}],
/*retTy=*/"::llvm::Optional<::mlir::OpFoldResult>",
/*methodName=*/"getSingleUpperBound",
diff --git a/mlir/lib/Bindings/Python/IRCore.cpp b/mlir/lib/Bindings/Python/IRCore.cpp
index a183809a3cf3c..8c25f6e8153d0 100644
--- a/mlir/lib/Bindings/Python/IRCore.cpp
+++ b/mlir/lib/Bindings/Python/IRCore.cpp
@@ -2626,7 +2626,7 @@ void mlir::python::populateIRCore(py::module &m) {
"__str__",
[](PyOperationBase &self) {
return self.getAsm(/*binary=*/false,
- /*largeElementsLimit=*/llvm::None,
+ /*largeElementsLimit=*/std::nullopt,
/*enableDebugInfo=*/false,
/*prettyDebugInfo=*/false,
/*printGenericOpForm=*/false,
diff --git a/mlir/lib/Bindings/Python/IRModule.cpp b/mlir/lib/Bindings/Python/IRModule.cpp
index ba6b2d29f74b3..b6d1df51f44e6 100644
--- a/mlir/lib/Bindings/Python/IRModule.cpp
+++ b/mlir/lib/Bindings/Python/IRModule.cpp
@@ -91,14 +91,14 @@ PyGlobals::lookupDialectClass(const std::string &dialectNamespace) {
const auto foundIt = dialectClassMap.find(dialectNamespace);
if (foundIt != dialectClassMap.end()) {
if (foundIt->second.is_none())
- return llvm::None;
+ return std::nullopt;
assert(foundIt->second && "py::object is defined");
return foundIt->second;
}
// Not found and loading did not yield a registration. Negative cache.
dialectClassMap[dialectNamespace] = py::none();
- return llvm::None;
+ return std::nullopt;
}
llvm::Optional<pybind11::object>
@@ -107,7 +107,7 @@ PyGlobals::lookupRawOpViewClass(llvm::StringRef operationName) {
auto foundIt = rawOpViewClassMapCache.find(operationName);
if (foundIt != rawOpViewClassMapCache.end()) {
if (foundIt->second.is_none())
- return llvm::None;
+ return std::nullopt;
assert(foundIt->second && "py::object is defined");
return foundIt->second;
}
@@ -123,7 +123,7 @@ PyGlobals::lookupRawOpViewClass(llvm::StringRef operationName) {
auto foundIt = rawOpViewClassMap.find(operationName);
if (foundIt != rawOpViewClassMap.end()) {
if (foundIt->second.is_none())
- return llvm::None;
+ return std::nullopt;
assert(foundIt->second && "py::object is defined");
// Positive cache.
rawOpViewClassMapCache[operationName] = foundIt->second;
@@ -131,7 +131,7 @@ PyGlobals::lookupRawOpViewClass(llvm::StringRef operationName) {
}
// Negative cache.
rawOpViewClassMap[operationName] = py::none();
- return llvm::None;
+ return std::nullopt;
}
}
diff --git a/mlir/lib/Bindings/Python/IRTypes.cpp b/mlir/lib/Bindings/Python/IRTypes.cpp
index 379510ce9654e..7a41cb1e8134f 100644
--- a/mlir/lib/Bindings/Python/IRTypes.cpp
+++ b/mlir/lib/Bindings/Python/IRTypes.cpp
@@ -390,7 +390,7 @@ class PyRankedTensorType
[](PyRankedTensorType &self) -> llvm::Optional<PyAttribute> {
MlirAttribute encoding = mlirRankedTensorTypeGetEncoding(self.get());
if (mlirAttributeIsNull(encoding))
- return llvm::None;
+ return std::nullopt;
return PyAttribute(self.getContext(), encoding);
});
}
More information about the Mlir-commits
mailing list