diff --git a/mlir/include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.td b/mlir/include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.td --- a/mlir/include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.td +++ b/mlir/include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.td @@ -37,7 +37,7 @@ operation implementing this interface. If there is no compatible deallocation operation, this method can return ::std::nullopt. }], - "::mlir::Optional<::mlir::Operation*>", "buildDealloc", + "::std::optional<::mlir::Operation*>", "buildDealloc", (ins "::mlir::OpBuilder&":$builder, "::mlir::Value":$alloc), [{}], /*defaultImplementation=*/[{ return std::nullopt; }] >, @@ -48,7 +48,7 @@ implementing this interface. If there is no compatible clone operation, this method can return ::std::nullopt. }], - "::mlir::Optional<::mlir::Value>", "buildClone", + "::std::optional<::mlir::Value>", "buildClone", (ins "::mlir::OpBuilder&":$builder, "::mlir::Value":$alloc), [{}], /*defaultImplementation=*/[{ return std::nullopt; }] > diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVAttributes.h b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVAttributes.h --- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVAttributes.h +++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVAttributes.h @@ -53,7 +53,7 @@ /// Gets a InterfaceVarABIAttr. static InterfaceVarABIAttr get(uint32_t descriptorSet, uint32_t binding, - Optional storageClass, + std::optional storageClass, MLIRContext *context); static InterfaceVarABIAttr get(IntegerAttr descriptorSet, IntegerAttr binding, IntegerAttr storageClass); @@ -68,7 +68,7 @@ uint32_t getBinding(); /// Returns `spirv::StorageClass`. - Optional getStorageClass(); + std::optional getStorageClass(); static LogicalResult verify(function_ref emitError, IntegerAttr descriptorSet, IntegerAttr binding, diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVAttributes.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVAttributes.td --- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVAttributes.td +++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVAttributes.td @@ -35,7 +35,7 @@ def SPIRV_EntryPointABIAttr : SPIRV_Attr<"EntryPointABI", "entry_point_abi"> { let parameters = (ins OptionalParameter<"DenseI32ArrayAttr">:$workgroup_size, - OptionalParameter<"llvm::Optional">:$subgroup_size + OptionalParameter<"std::optional">:$subgroup_size ); let assemblyFormat = "`<` struct(params) `>`"; } @@ -116,9 +116,9 @@ DefaultValuedParameter<"int", "32">:$subgroup_size, // The minimum supported size if the subgroup size is controllable. - OptionalParameter<"mlir::Optional">:$min_subgroup_size, + OptionalParameter<"std::optional">:$min_subgroup_size, // The maximum supported size if the subgroup size is controllable. - OptionalParameter<"mlir::Optional">:$max_subgroup_size, + OptionalParameter<"std::optional">:$max_subgroup_size, // The configurations of cooperative matrix operations // supported. Default is an empty list. diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVAvailability.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVAvailability.td --- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVAvailability.td +++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVAvailability.td @@ -60,7 +60,7 @@ : Availability { let interfaceName = name; - let queryFnRetType = "llvm::Optional<" # scheme.returnType # ">"; + let queryFnRetType = "std::optional<" # scheme.returnType # ">"; let queryFnName = "getMinVersion"; let mergeAction = "{ " @@ -79,7 +79,7 @@ : Availability { let interfaceName = name; - let queryFnRetType = "llvm::Optional<" # scheme.returnType # ">"; + let queryFnRetType = "std::optional<" # scheme.returnType # ">"; let queryFnName = "getMaxVersion"; let mergeAction = "{ " diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td --- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td +++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td @@ -238,11 +238,11 @@ // Remove them once we are able to support dialect-specific contents in ODS. def QueryMinVersionInterface : SPIRVOpInterface<"QueryMinVersionInterface"> { let methods = [InterfaceMethod< - "", "::llvm::Optional<::mlir::spirv::Version>", "getMinVersion">]; + "", "::std::optional<::mlir::spirv::Version>", "getMinVersion">]; } def QueryMaxVersionInterface : SPIRVOpInterface<"QueryMaxVersionInterface"> { let methods = [InterfaceMethod< - "", "::llvm::Optional<::mlir::spirv::Version>", "getMaxVersion">]; + "", "::std::optional<::mlir::spirv::Version>", "getMaxVersion">]; } def QueryExtensionInterface : SPIRVOpInterface<"QueryExtensionInterface"> { let methods = [InterfaceMethod< diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/TargetAndABI.h b/mlir/include/mlir/Dialect/SPIRV/IR/TargetAndABI.h --- a/mlir/include/mlir/Dialect/SPIRV/IR/TargetAndABI.h +++ b/mlir/include/mlir/Dialect/SPIRV/IR/TargetAndABI.h @@ -73,10 +73,10 @@ StringRef getInterfaceVarABIAttrName(); /// Gets the InterfaceVarABIAttr given its fields. -InterfaceVarABIAttr getInterfaceVarABIAttr(unsigned descriptorSet, - unsigned binding, - Optional storageClass, - MLIRContext *context); +InterfaceVarABIAttr +getInterfaceVarABIAttr(unsigned descriptorSet, unsigned binding, + std::optional storageClass, + MLIRContext *context); /// Returns whether the given SPIR-V target (described by TargetEnvAttr) needs /// ABI attributes for interface variables (spirv.interface_var_abi). @@ -88,7 +88,7 @@ /// Gets the EntryPointABIAttr given its fields. EntryPointABIAttr getEntryPointABIAttr(MLIRContext *context, ArrayRef workgroupSize = {}, - llvm::Optional subgroupSize = {}); + std::optional subgroupSize = {}); /// Queries the entry point ABI on the nearest function-like op containing the /// given `op`. Returns null attribute if not found. diff --git a/mlir/include/mlir/IR/DialectImplementation.h b/mlir/include/mlir/IR/DialectImplementation.h --- a/mlir/include/mlir/IR/DialectImplementation.h +++ b/mlir/include/mlir/IR/DialectImplementation.h @@ -108,14 +108,14 @@ /// Parse an Optional integer. template struct FieldParser< - llvm::Optional, - std::enable_if_t::value, Optional>> { - static FailureOr> parse(AsmParser &parser) { + std::optional, + std::enable_if_t::value, std::optional>> { + static FailureOr> parse(AsmParser &parser) { IntT value; OptionalParseResult result = parser.parseOptionalInteger(value); if (result.has_value()) { if (succeeded(*result)) - return {Optional(value)}; + return {std::optional(value)}; return failure(); } return {std::nullopt}; diff --git a/mlir/include/mlir/IR/SymbolInterfaces.td b/mlir/include/mlir/IR/SymbolInterfaces.td --- a/mlir/include/mlir/IR/SymbolInterfaces.td +++ b/mlir/include/mlir/IR/SymbolInterfaces.td @@ -99,7 +99,7 @@ given operation 'from'. Note: See mlir::SymbolTable::getSymbolUses for more details. }], - "::llvm::Optional<::mlir::SymbolTable::UseRange>", "getSymbolUses", + "::std::optional<::mlir::SymbolTable::UseRange>", "getSymbolUses", (ins "::mlir::Operation *":$from), [{}], /*defaultImplementation=*/[{ return ::mlir::SymbolTable::getSymbolUses(this->getOperation(), from); diff --git a/mlir/include/mlir/IR/SymbolTable.h b/mlir/include/mlir/IR/SymbolTable.h --- a/mlir/include/mlir/IR/SymbolTable.h +++ b/mlir/include/mlir/IR/SymbolTable.h @@ -181,17 +181,19 @@ /// within the given operation 'from'. This does not traverse into any nested /// symbol tables. This function returns std::nullopt if there are any unknown /// operations that may potentially be symbol tables. - static Optional getSymbolUses(Operation *from); - static Optional getSymbolUses(Region *from); + static std::optional getSymbolUses(Operation *from); + static std::optional 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 std::nullopt if there are any unknown operations /// that may potentially be symbol tables. - static Optional getSymbolUses(StringAttr symbol, Operation *from); - static Optional getSymbolUses(Operation *symbol, Operation *from); - static Optional getSymbolUses(StringAttr symbol, Region *from); - static Optional getSymbolUses(Operation *symbol, Region *from); + static std::optional getSymbolUses(StringAttr symbol, + Operation *from); + static std::optional getSymbolUses(Operation *symbol, + Operation *from); + static std::optional getSymbolUses(StringAttr symbol, Region *from); + static std::optional getSymbolUses(Operation *symbol, Region *from); /// Return if the given symbol is known to have no uses that are nested /// within the given operation 'from'. This does not traverse into any nested diff --git a/mlir/lib/Analysis/DataFlow/DeadCodeAnalysis.cpp b/mlir/lib/Analysis/DataFlow/DeadCodeAnalysis.cpp --- a/mlir/lib/Analysis/DataFlow/DeadCodeAnalysis.cpp +++ b/mlir/lib/Analysis/DataFlow/DeadCodeAnalysis.cpp @@ -146,7 +146,7 @@ return; // Walk the symbol table to check for non-call uses of symbols. - Optional uses = + std::optional uses = SymbolTable::getSymbolUses(&symbolTableRegion); if (!uses) { // If we couldn't gather the symbol uses, conservatively assume that diff --git a/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp b/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp --- a/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp +++ b/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp @@ -265,7 +265,7 @@ return failure(); // Vulkan's interface variable requirements needs scalars to be wrapped in a // struct. The struct held in storage buffer. - Optional sc; + std::optional sc; if (funcOp.getArgument(argIndex).getType().isIntOrIndexOrFloat()) sc = spirv::StorageClass::StorageBuffer; argABI.push_back(spirv::getInterfaceVarABIAttr(0, argIndex, sc, context)); diff --git a/mlir/lib/Dialect/Bufferization/IR/BufferizationOps.cpp b/mlir/lib/Dialect/Bufferization/IR/BufferizationOps.cpp --- a/mlir/lib/Dialect/Bufferization/IR/BufferizationOps.cpp +++ b/mlir/lib/Dialect/Bufferization/IR/BufferizationOps.cpp @@ -690,12 +690,13 @@ return success(); } -Optional CloneOp::buildDealloc(OpBuilder &builder, Value alloc) { +std::optional CloneOp::buildDealloc(OpBuilder &builder, + Value alloc) { return builder.create(alloc.getLoc(), alloc) .getOperation(); } -Optional CloneOp::buildClone(OpBuilder &builder, Value alloc) { +std::optional CloneOp::buildClone(OpBuilder &builder, Value alloc) { return builder.create(alloc.getLoc(), alloc).getResult(); } diff --git a/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp b/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp --- a/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp +++ b/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp @@ -628,11 +628,12 @@ struct DefaultAllocationInterface : public bufferization::AllocationOpInterface::ExternalModel< DefaultAllocationInterface, memref::AllocOp> { - static Optional buildDealloc(OpBuilder &builder, Value alloc) { + static std::optional buildDealloc(OpBuilder &builder, + Value alloc) { return builder.create(alloc.getLoc(), alloc) .getOperation(); } - static Optional buildClone(OpBuilder &builder, Value alloc) { + static std::optional buildClone(OpBuilder &builder, Value alloc) { return builder.create(alloc.getLoc(), alloc) .getResult(); } diff --git a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp --- a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp +++ b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp @@ -360,7 +360,7 @@ SmallVector symbolDefWorklist = {kernelFunc}; while (!symbolDefWorklist.empty()) { - if (Optional symbolUses = + if (std::optional symbolUses = SymbolTable::getSymbolUses(symbolDefWorklist.pop_back_val())) { for (SymbolTable::SymbolUse symbolUse : *symbolUses) { StringRef symbolName = diff --git a/mlir/lib/Dialect/MemRef/Transforms/NormalizeMemRefs.cpp b/mlir/lib/Dialect/MemRef/Transforms/NormalizeMemRefs.cpp --- a/mlir/lib/Dialect/MemRef/Transforms/NormalizeMemRefs.cpp +++ b/mlir/lib/Dialect/MemRef/Transforms/NormalizeMemRefs.cpp @@ -120,7 +120,8 @@ << " calls or is called by non-normalizable function\n"); normalizableFuncs.erase(funcOp); // Caller of the function. - Optional symbolUses = funcOp.getSymbolUses(moduleOp); + std::optional symbolUses = + funcOp.getSymbolUses(moduleOp); for (SymbolTable::SymbolUse symbolUse : *symbolUses) { // TODO: Extend this for ops that are FunctionOpInterface. This would // require creating an OpInterface for FunctionOpInterface ops. @@ -256,7 +257,8 @@ llvm::SmallDenseSet funcOpsToUpdate; // We iterate over all symbolic uses of the function and update the return // type at the caller site. - Optional symbolUses = funcOp.getSymbolUses(moduleOp); + std::optional symbolUses = + funcOp.getSymbolUses(moduleOp); for (SymbolTable::SymbolUse symbolUse : *symbolUses) { Operation *userOp = symbolUse.getUser(); OpBuilder builder(userOp); diff --git a/mlir/lib/Dialect/SPIRV/IR/SPIRVAttributes.cpp b/mlir/lib/Dialect/SPIRV/IR/SPIRVAttributes.cpp --- a/mlir/lib/Dialect/SPIRV/IR/SPIRVAttributes.cpp +++ b/mlir/lib/Dialect/SPIRV/IR/SPIRVAttributes.cpp @@ -121,7 +121,7 @@ spirv::InterfaceVarABIAttr spirv::InterfaceVarABIAttr::get(uint32_t descriptorSet, uint32_t binding, - Optional storageClass, + std::optional storageClass, MLIRContext *context) { Builder b(context); auto descriptorSetAttr = b.getI32IntegerAttr(descriptorSet); @@ -152,7 +152,8 @@ return getImpl()->descriptorSet.cast().getInt(); } -Optional spirv::InterfaceVarABIAttr::getStorageClass() { +std::optional +spirv::InterfaceVarABIAttr::getStorageClass() { if (getImpl()->storageClass) return static_cast( getImpl()->storageClass.cast().getValue().getZExtValue()); diff --git a/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp b/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp --- a/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp +++ b/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp @@ -4851,11 +4851,11 @@ return success(); } -static Optional getIntegerDotProductMinVersion() { +static std::optional getIntegerDotProductMinVersion() { return spirv::Version::V_1_0; // Available in SPIR-V >= 1.0. } -static Optional getIntegerDotProductMaxVersion() { +static std::optional getIntegerDotProductMaxVersion() { return spirv::Version::V_1_6; // Available in SPIR-V <= 1.6. } @@ -4910,10 +4910,10 @@ SmallVector, 1> OpName::getCapabilities() { \ return getIntegerDotProductCapabilities(*this); \ } \ - Optional OpName::getMinVersion() { \ + std::optional OpName::getMinVersion() { \ return getIntegerDotProductMinVersion(); \ } \ - Optional OpName::getMaxVersion() { \ + std::optional OpName::getMaxVersion() { \ return getIntegerDotProductMaxVersion(); \ } diff --git a/mlir/lib/Dialect/SPIRV/IR/TargetAndABI.cpp b/mlir/lib/Dialect/SPIRV/IR/TargetAndABI.cpp --- a/mlir/lib/Dialect/SPIRV/IR/TargetAndABI.cpp +++ b/mlir/lib/Dialect/SPIRV/IR/TargetAndABI.cpp @@ -101,7 +101,7 @@ spirv::InterfaceVarABIAttr spirv::getInterfaceVarABIAttr(unsigned descriptorSet, unsigned binding, - Optional storageClass, + std::optional storageClass, MLIRContext *context) { return spirv::InterfaceVarABIAttr::get(descriptorSet, binding, storageClass, context); @@ -122,7 +122,7 @@ spirv::EntryPointABIAttr spirv::getEntryPointABIAttr(MLIRContext *context, ArrayRef workgroupSize, - llvm::Optional subgroupSize) { + std::optional subgroupSize) { DenseI32ArrayAttr workgroupSizeAttr; if (!workgroupSize.empty()) { assert(workgroupSize.size() == 3); diff --git a/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp b/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp --- a/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp +++ b/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp @@ -160,7 +160,7 @@ entryPointAttr.getSubgroupSize()); } } - if (Optional subgroupSize = entryPointAttr.getSubgroupSize()) { + if (std::optional subgroupSize = entryPointAttr.getSubgroupSize()) { std::optional> caps = spirv::getCapabilities(spirv::ExecutionMode::SubgroupSize); if (!caps || targetEnv.allows(*caps)) { diff --git a/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp b/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp --- a/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp +++ b/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp @@ -848,7 +848,7 @@ // QueryMinVersionInterface/QueryMaxVersionInterface are available to all // SPIR-V versions. if (auto minVersionIfx = dyn_cast(op)) { - Optional minVersion = minVersionIfx.getMinVersion(); + std::optional minVersion = minVersionIfx.getMinVersion(); if (minVersion && *minVersion > this->targetEnv.getVersion()) { LLVM_DEBUG(llvm::dbgs() << op->getName() << " illegal: requiring min version " @@ -857,7 +857,7 @@ } } if (auto maxVersionIfx = dyn_cast(op)) { - Optional maxVersion = maxVersionIfx.getMaxVersion(); + std::optional maxVersion = maxVersionIfx.getMaxVersion(); if (maxVersion && *maxVersion < this->targetEnv.getVersion()) { LLVM_DEBUG(llvm::dbgs() << op->getName() << " illegal: requiring max version " diff --git a/mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp b/mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp --- a/mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp +++ b/mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp @@ -118,7 +118,7 @@ WalkResult walkResult = module.walk([&](Operation *op) -> WalkResult { // Op min version requirements if (auto minVersionIfx = dyn_cast(op)) { - Optional minVersion = minVersionIfx.getMinVersion(); + std::optional minVersion = minVersionIfx.getMinVersion(); if (minVersion) { deducedVersion = std::max(deducedVersion, *minVersion); if (deducedVersion > allowedVersion) { diff --git a/mlir/lib/IR/SymbolTable.cpp b/mlir/lib/IR/SymbolTable.cpp --- a/mlir/lib/IR/SymbolTable.cpp +++ b/mlir/lib/IR/SymbolTable.cpp @@ -733,14 +733,14 @@ /// The implementation of SymbolTable::getSymbolUses below. template -static Optional getSymbolUsesImpl(FromT from) { +static std::optional getSymbolUsesImpl(FromT from) { std::vector uses; auto walkFn = [&](SymbolTable::SymbolUse symbolUse) { uses.push_back(symbolUse); return WalkResult::advance(); }; auto result = walkSymbolUses(from, walkFn); - return result ? Optional(std::move(uses)) + return result ? std::optional(std::move(uses)) : std::nullopt; } @@ -751,10 +751,10 @@ /// boundary of the symbol table, and not the op itself. This function returns /// std::nullopt if there are any unknown operations that may potentially be /// symbol tables. -auto SymbolTable::getSymbolUses(Operation *from) -> Optional { +auto SymbolTable::getSymbolUses(Operation *from) -> std::optional { return getSymbolUsesImpl(from); } -auto SymbolTable::getSymbolUses(Region *from) -> Optional { +auto SymbolTable::getSymbolUses(Region *from) -> std::optional { return getSymbolUsesImpl(MutableArrayRef(*from)); } @@ -763,8 +763,8 @@ /// The implementation of SymbolTable::getSymbolUses below. template -static Optional getSymbolUsesImpl(SymbolT symbol, - IRUnitT *limit) { +static std::optional getSymbolUsesImpl(SymbolT symbol, + IRUnitT *limit) { std::vector uses; for (SymbolScope &scope : collectSymbolScopes(symbol, limit)) { if (!scope.walk([&](SymbolTable::SymbolUse symbolUse) { @@ -781,19 +781,19 @@ /// 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 { + -> std::optional { return getSymbolUsesImpl(symbol, from); } auto SymbolTable::getSymbolUses(Operation *symbol, Operation *from) - -> Optional { + -> std::optional { return getSymbolUsesImpl(symbol, from); } auto SymbolTable::getSymbolUses(StringAttr symbol, Region *from) - -> Optional { + -> std::optional { return getSymbolUsesImpl(symbol, from); } auto SymbolTable::getSymbolUses(Operation *symbol, Region *from) - -> Optional { + -> std::optional { return getSymbolUsesImpl(symbol, from); } diff --git a/mlir/lib/Transforms/SymbolDCE.cpp b/mlir/lib/Transforms/SymbolDCE.cpp --- a/mlir/lib/Transforms/SymbolDCE.cpp +++ b/mlir/lib/Transforms/SymbolDCE.cpp @@ -120,7 +120,7 @@ } // Collect the uses held by this operation. - Optional uses = SymbolTable::getSymbolUses(op); + std::optional uses = SymbolTable::getSymbolUses(op); if (!uses) { return op->emitError() << "operation contains potentially unknown symbol table, " diff --git a/mlir/test/lib/Dialect/SPIRV/TestAvailability.cpp b/mlir/test/lib/Dialect/SPIRV/TestAvailability.cpp --- a/mlir/test/lib/Dialect/SPIRV/TestAvailability.cpp +++ b/mlir/test/lib/Dialect/SPIRV/TestAvailability.cpp @@ -45,7 +45,7 @@ auto &os = llvm::outs(); if (auto minVersionIfx = dyn_cast(op)) { - Optional minVersion = minVersionIfx.getMinVersion(); + std::optional minVersion = minVersionIfx.getMinVersion(); os << opName << " min version: "; if (minVersion) os << spirv::stringifyVersion(*minVersion) << "\n"; @@ -54,7 +54,7 @@ } if (auto maxVersionIfx = dyn_cast(op)) { - Optional maxVersion = maxVersionIfx.getMaxVersion(); + std::optional maxVersion = maxVersionIfx.getMaxVersion(); os << opName << " max version: "; if (maxVersion) os << spirv::stringifyVersion(*maxVersion) << "\n"; diff --git a/mlir/test/lib/Dialect/Test/TestAttrDefs.td b/mlir/test/lib/Dialect/Test/TestAttrDefs.td --- a/mlir/test/lib/Dialect/Test/TestAttrDefs.td +++ b/mlir/test/lib/Dialect/Test/TestAttrDefs.td @@ -202,13 +202,13 @@ } def TestAttrWithOptionalSigned : Test_Attr<"TestAttrWithOptionalSigned"> { - let parameters = (ins OptionalParameter<"mlir::Optional">:$value); + let parameters = (ins OptionalParameter<"std::optional">:$value); let assemblyFormat = "`<` $value `>`"; let mnemonic = "attr_with_optional_signed"; } def TestAttrWithOptionalUnsigned : Test_Attr<"TestAttrWithOptionalUnsigned"> { - let parameters = (ins OptionalParameter<"mlir::Optional">:$value); + let parameters = (ins OptionalParameter<"std::optional">:$value); let assemblyFormat = "`<` $value `>`"; let mnemonic = "attr_with_optional_unsigned"; } @@ -310,7 +310,7 @@ // Test custom directive as optional group anchor. def TestCustomAnchor : Test_Attr<"TestCustomAnchor"> { - let parameters = (ins "int":$a, OptionalParameter<"mlir::Optional">:$b); + let parameters = (ins "int":$a, OptionalParameter<"std::optional">:$b); let mnemonic = "custom_anchor"; let assemblyFormat = "`<` $a (`>`) : (`,` custom($b)^ `>`)?"; } diff --git a/mlir/test/lib/Dialect/Test/TestAttributes.cpp b/mlir/test/lib/Dialect/Test/TestAttributes.cpp --- a/mlir/test/lib/Dialect/Test/TestAttributes.cpp +++ b/mlir/test/lib/Dialect/Test/TestAttributes.cpp @@ -165,15 +165,15 @@ //===----------------------------------------------------------------------===// static ParseResult parseTrueFalse(AsmParser &p, - FailureOr> &result) { + FailureOr> &result) { bool b; if (p.parseInteger(b)) return failure(); - result = Optional(b); + result = std::optional(b); return success(); } -static void printTrueFalse(AsmPrinter &p, Optional result) { +static void printTrueFalse(AsmPrinter &p, std::optional result) { p << (*result ? "true" : "false"); } diff --git a/mlir/test/lib/IR/TestSymbolUses.cpp b/mlir/test/lib/IR/TestSymbolUses.cpp --- a/mlir/test/lib/IR/TestSymbolUses.cpp +++ b/mlir/test/lib/IR/TestSymbolUses.cpp @@ -26,7 +26,7 @@ WalkResult operateOnSymbol(Operation *symbol, ModuleOp module, SmallVectorImpl &deadFunctions) { // Test computing uses on a non symboltable op. - Optional symbolUses = + std::optional symbolUses = SymbolTable::getSymbolUses(symbol); // Test the conservative failure case.