diff --git a/flang/include/flang/Optimizer/Dialect/FIROps.td b/flang/include/flang/Optimizer/Dialect/FIROps.td --- a/flang/include/flang/Optimizer/Dialect/FIROps.td +++ b/flang/include/flang/Optimizer/Dialect/FIROps.td @@ -2049,8 +2049,8 @@ class region_Op traits = []> : fir_Op { + !listconcat(traits, [SingleBlock, FirRegionTerminator, + RecursivelySpeculatable, RecursiveMemoryEffects])> { let hasCustomAssemblyFormat = 1; let hasVerifier = 1; } @@ -2810,7 +2810,7 @@ def ImplicitFirTerminator : SingleBlockImplicitTerminator<"FirEndOp">; def fir_DispatchTableOp : fir_Op<"dispatch_table", - [IsolatedFromAbove, Symbol, ImplicitFirTerminator]> { + [IsolatedFromAbove, Symbol, SingleBlock, ImplicitFirTerminator]> { let summary = "Dispatch table definition"; let description = [{ diff --git a/flang/include/flang/Optimizer/HLFIR/HLFIROps.td b/flang/include/flang/Optimizer/HLFIR/HLFIROps.td --- a/flang/include/flang/Optimizer/HLFIR/HLFIROps.td +++ b/flang/include/flang/Optimizer/HLFIR/HLFIROps.td @@ -1184,7 +1184,7 @@ def hlfir_YieldOp : hlfir_Op<"yield", [Terminator, ParentOneOf<["RegionAssignOp", "ElementalAddrOp", "ForallOp", "ForallMaskOp", "WhereOp", "ElseWhereOp"]>, - SingleBlockImplicitTerminator<"fir::FirEndOp">, RecursivelySpeculatable, + SingleBlock, SingleBlockImplicitTerminator<"fir::FirEndOp">, RecursivelySpeculatable, RecursiveMemoryEffects]> { let summary = "Yield a value or variable inside a forall, where or region assignment"; diff --git a/mlir/include/mlir/Dialect/Affine/IR/AffineOps.td b/mlir/include/mlir/Dialect/Affine/IR/AffineOps.td --- a/mlir/include/mlir/Dialect/Affine/IR/AffineOps.td +++ b/mlir/include/mlir/Dialect/Affine/IR/AffineOps.td @@ -118,7 +118,8 @@ } def AffineForOp : Affine_Op<"for", - [AutomaticAllocationScope, ImplicitAffineTerminator, ConditionallySpeculatable, + [AutomaticAllocationScope, SingleBlock, ImplicitAffineTerminator, + ConditionallySpeculatable, RecursiveMemoryEffects, DeclareOpInterfaceMethods, @@ -365,7 +366,8 @@ } def AffineIfOp : Affine_Op<"if", - [ImplicitAffineTerminator, RecursivelySpeculatable, + [SingleBlock, ImplicitAffineTerminator, + RecursivelySpeculatable, RecursiveMemoryEffects, NoRegionArguments, DeclareOpInterfaceMethods ]> { @@ -634,7 +636,8 @@ } def AffineParallelOp : Affine_Op<"parallel", - [AutomaticAllocationScope, ImplicitAffineTerminator, RecursivelySpeculatable, + [AutomaticAllocationScope, SingleBlock, ImplicitAffineTerminator, + RecursivelySpeculatable, RecursiveMemoryEffects, DeclareOpInterfaceMethods, MemRefsNormalizable]> { let summary = "multi-index parallel band operation"; diff --git a/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td b/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td --- a/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td +++ b/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td @@ -33,7 +33,7 @@ Op; def Async_ExecuteOp : - Async_Op<"execute", [SingleBlockImplicitTerminator<"YieldOp">, + Async_Op<"execute", [SingleBlock, SingleBlockImplicitTerminator<"YieldOp">, DeclareOpInterfaceMethods, diff --git a/mlir/include/mlir/Dialect/GPU/IR/GPUOps.td b/mlir/include/mlir/Dialect/GPU/IR/GPUOps.td --- a/mlir/include/mlir/Dialect/GPU/IR/GPUOps.td +++ b/mlir/include/mlir/Dialect/GPU/IR/GPUOps.td @@ -1012,7 +1012,8 @@ def GPU_GPUModuleOp : GPU_Op<"module", [ DataLayoutOpInterface, HasDefaultDLTIDataLayout, IsolatedFromAbove, - SymbolTable, Symbol, SingleBlockImplicitTerminator<"ModuleEndOp"> + SymbolTable, Symbol, SingleBlock, + SingleBlockImplicitTerminator<"ModuleEndOp"> ]>, Arguments<(ins OptionalAttr:$targets)> { let summary = "A top level compilation unit containing code to be run on a GPU."; let description = [{ diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td --- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td +++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td @@ -1075,7 +1075,8 @@ } def LLVM_GlobalOp : LLVM_Op<"mlir.global", - [IsolatedFromAbove, SingleBlockImplicitTerminator<"ReturnOp">, Symbol]> { + [IsolatedFromAbove, SingleBlock, SingleBlockImplicitTerminator<"ReturnOp">, + Symbol]> { let arguments = (ins TypeAttr:$global_type, UnitAttr:$constant, diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td b/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td --- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td +++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td @@ -27,7 +27,7 @@ // depending on the specific Linalg op. class LinalgStructuredBase_Op props> : Op, + SingleBlock, SingleBlockImplicitTerminator<"YieldOp">, DeclareOpInterfaceMethods, DestinationStyleOpInterface, LinalgStructuredInterface, @@ -230,7 +230,7 @@ def MapOp : LinalgStructuredBase_Op<"map", [ DeclareOpInterfaceMethods, DeclareOpInterfaceMethods, - SingleBlockImplicitTerminator<"YieldOp">]> { + SingleBlock, SingleBlockImplicitTerminator<"YieldOp">]> { let summary = "Elementwise operations"; let description = [{ Models elementwise operations on tensors in terms of arithmetic operations @@ -316,7 +316,7 @@ DeclareOpInterfaceMethods, DeclareOpInterfaceMethods, SameVariadicOperandSize, - SingleBlockImplicitTerminator<"YieldOp">]> { + SingleBlock, SingleBlockImplicitTerminator<"YieldOp">]> { let summary = "Reduce operator"; let description = [{ Executes `combiner` on the `dimensions` of `inputs` and returns the @@ -398,7 +398,7 @@ def TransposeOp : LinalgStructuredBase_Op<"transpose", [ DeclareOpInterfaceMethods, SameVariadicOperandSize, - SingleBlockImplicitTerminator<"YieldOp">]> { + SingleBlock, SingleBlockImplicitTerminator<"YieldOp">]> { let summary = "Transpose operator"; let description = [{ Permutes the dimensions of `input` according to the given `permutation`. @@ -473,7 +473,7 @@ def BroadcastOp : LinalgStructuredBase_Op<"broadcast", [ DeclareOpInterfaceMethods, SameVariadicOperandSize, - SingleBlockImplicitTerminator<"YieldOp">]> { + SingleBlock, SingleBlockImplicitTerminator<"YieldOp">]> { let summary = "Static broadcast operator"; let description = [{ Broadcast the input into the given shape by adding `dimensions`. diff --git a/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgMatchOps.td b/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgMatchOps.td --- a/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgMatchOps.td +++ b/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgMatchOps.td @@ -24,6 +24,7 @@ MatchOpInterface, DeclareOpInterfaceMethods, SingleOpMatcher, + SingleBlock, SingleBlockImplicitTerminator<"::mlir::transform::MatchStructuredYieldOp">]> { let summary = "Matches a structured (linalg) operation with additional conditions"; diff --git a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td --- a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td +++ b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td @@ -359,7 +359,7 @@ def MemRef_AllocaScopeOp : MemRef_Op<"alloca_scope", [AutomaticAllocationScope, DeclareOpInterfaceMethods, - SingleBlockImplicitTerminator<"AllocaScopeReturnOp">, + SingleBlock, SingleBlockImplicitTerminator<"AllocaScopeReturnOp">, RecursiveMemoryEffects, NoRegionArguments]> { let summary = "explicitly delimited scope for stack allocation"; @@ -989,7 +989,7 @@ //===----------------------------------------------------------------------===// def GenericAtomicRMWOp : MemRef_Op<"generic_atomic_rmw", [ - SingleBlockImplicitTerminator<"AtomicYieldOp">, + SingleBlock, SingleBlockImplicitTerminator<"AtomicYieldOp">, TypesMatchWith<"result type matches element type of memref", "memref", "result", "::llvm::cast($_self).getElementType()"> diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td --- a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td +++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td @@ -1462,8 +1462,8 @@ } def AtomicUpdateOp : OpenMP_Op<"atomic.update", - [SingleBlockImplicitTerminator<"YieldOp">, - RecursiveMemoryEffects]> { + [SingleBlock, SingleBlockImplicitTerminator<"YieldOp">, + RecursiveMemoryEffects]> { let summary = "performs an atomic update"; diff --git a/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td b/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td --- a/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td +++ b/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td @@ -127,7 +127,7 @@ ConditionallySpeculatable, DeclareOpInterfaceMethods, - SingleBlockImplicitTerminator<"scf::YieldOp">, + SingleBlock, SingleBlockImplicitTerminator<"scf::YieldOp">, RecursiveMemoryEffects]> { let summary = "for operation"; let description = [{ @@ -360,7 +360,7 @@ DeclareOpInterfaceMethods, RecursiveMemoryEffects, - SingleBlockImplicitTerminator<"scf::InParallelOp">, + SingleBlock, SingleBlockImplicitTerminator<"scf::InParallelOp">, DeclareOpInterfaceMethods, ]> { let summary = "evaluate a block multiple times in parallel"; @@ -710,7 +710,8 @@ def IfOp : SCF_Op<"if", [DeclareOpInterfaceMethods, - InferTypeOpAdaptor, SingleBlockImplicitTerminator<"scf::YieldOp">, + InferTypeOpAdaptor, + SingleBlock, SingleBlockImplicitTerminator<"scf::YieldOp">, RecursiveMemoryEffects, NoRegionArguments]> { let summary = "if-then-else operation"; let description = [{ @@ -814,7 +815,7 @@ DeclareOpInterfaceMethods, RecursiveMemoryEffects, DeclareOpInterfaceMethods, - SingleBlockImplicitTerminator<"scf::YieldOp">]> { + SingleBlock, SingleBlockImplicitTerminator<"scf::YieldOp">]> { let summary = "parallel for operation"; let description = [{ The "scf.parallel" operation represents a loop nest taking 4 groups of SSA @@ -1124,7 +1125,7 @@ //===----------------------------------------------------------------------===// def IndexSwitchOp : SCF_Op<"index_switch", [RecursiveMemoryEffects, - SingleBlockImplicitTerminator<"scf::YieldOp">, + SingleBlock, SingleBlockImplicitTerminator<"scf::YieldOp">, DeclareOpInterfaceMethods]> { diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td --- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td @@ -674,7 +674,7 @@ // ----- def SPIRV_SpecConstantOperationOp : SPIRV_Op<"SpecConstantOperation", [ - Pure, InFunctionScope, + Pure, InFunctionScope, SingleBlock, SingleBlockImplicitTerminator<"YieldOp">]> { let summary = [{ Declare a new specialization constant that results from doing an operation. diff --git a/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td b/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td --- a/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td +++ b/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td @@ -505,7 +505,7 @@ } def Shape_ReduceOp : Shape_Op<"reduce", - [SingleBlockImplicitTerminator<"YieldOp">]> { + [SingleBlock, SingleBlockImplicitTerminator<"YieldOp">]> { let summary = "Returns an expression reduced over a shape or extent tensor"; let description = [{ An operation that takes as input a shape or extent tensor, and a number of @@ -825,7 +825,7 @@ } def Shape_AssumingOp : Shape_Op<"assuming", [ - SingleBlockImplicitTerminator<"AssumingYieldOp">, + SingleBlock, SingleBlockImplicitTerminator<"AssumingYieldOp">, DeclareOpInterfaceMethods, RecursiveMemoryEffects]> { let summary = "Execute the region"; diff --git a/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td b/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td --- a/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td +++ b/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td @@ -1219,7 +1219,7 @@ } def SparseTensor_ForeachOp : SparseTensor_Op<"foreach", - [SingleBlockImplicitTerminator<"YieldOp">]>, + [SingleBlock, SingleBlockImplicitTerminator<"YieldOp">]>, Arguments<(ins AnyTensor:$tensor, Variadic:$initArgs, OptionalAttr:$order)>, diff --git a/mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td b/mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td --- a/mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td +++ b/mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td @@ -669,7 +669,7 @@ DeclareOpInterfaceMethods, RecursiveMemoryEffects, DeclareOpInterfaceMethods, - SingleBlockImplicitTerminator<"mlir::tensor::YieldOp">]> { + SingleBlock, SingleBlockImplicitTerminator<"mlir::tensor::YieldOp">]> { let summary = "Creates a dynamically sized tensor from elements"; let description = [{ This operation creates a dynamically sized tensor with elements of any type. @@ -1162,7 +1162,7 @@ DeclareOpInterfaceMethods, AttrSizedOperandSegments, Pure, - SingleBlockImplicitTerminator<"mlir::tensor::YieldOp">]> { + SingleBlock, SingleBlockImplicitTerminator<"mlir::tensor::YieldOp">]> { let summary = "tensor pad operation"; let description = [{ `tensor.pad` is an operation that pads the `source` tensor diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td --- a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td +++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td @@ -1936,7 +1936,7 @@ //===----------------------------------------------------------------------===// def Tosa_IfOp : Tosa_Op<"cond_if", [InferShapedTypeOpAdaptor, - SingleBlockImplicitTerminator<"YieldOp">, + SingleBlock, SingleBlockImplicitTerminator<"YieldOp">, RecursiveMemoryEffects]> { let summary = "Conditional if operator"; @@ -1971,7 +1971,7 @@ def Tosa_WhileOp : Tosa_Op<"while_loop", [ DeclareOpInterfaceMethods, InferShapedTypeOpAdaptor, - SingleBlockImplicitTerminator<"YieldOp">, + SingleBlock, SingleBlockImplicitTerminator<"YieldOp">, RecursiveMemoryEffects]> { let summary = "output = input; While (Cond(output)) {output = Body(output)}"; diff --git a/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td b/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td --- a/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td +++ b/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td @@ -30,6 +30,7 @@ DeclareOpInterfaceMethods, DeclareOpInterfaceMethods, IsolatedFromAbove, PossibleTopLevelTransformOpTrait, + SingleBlock, SingleBlockImplicitTerminator<"::mlir::transform::YieldOp">]> { let summary = "Attempts sequences of transforms until one succeeds"; let description = [{ @@ -507,7 +508,7 @@ DeclareOpInterfaceMethods, DeclareOpInterfaceMethods, - SingleBlockImplicitTerminator<"::mlir::transform::YieldOp"> + SingleBlock, SingleBlockImplicitTerminator<"::mlir::transform::YieldOp"> ]> { let summary = "Executes the body for each payload op"; let description = [{ @@ -1021,7 +1022,7 @@ DeclareOpInterfaceMethods, DeclareOpInterfaceMethods, OpAsmOpInterface, PossibleTopLevelTransformOpTrait, - SingleBlockImplicitTerminator<"::mlir::transform::YieldOp">, + SingleBlock, SingleBlockImplicitTerminator<"::mlir::transform::YieldOp">, AttrSizedOperandSegments]> { let summary = "Contains a sequence of other transform ops to apply"; let description = [{ diff --git a/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td b/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td --- a/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td +++ b/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td @@ -2322,7 +2322,7 @@ } def Vector_MaskOp : Vector_Op<"mask", [ - SingleBlockImplicitTerminator<"vector::YieldOp">, + SingleBlock, SingleBlockImplicitTerminator<"vector::YieldOp">, DeclareOpInterfaceMethods, RecursiveMemoryEffects, NoRegionArguments ]> { @@ -2801,7 +2801,7 @@ def Vector_WarpExecuteOnLane0Op : Vector_Op<"warp_execute_on_lane_0", [DeclareOpInterfaceMethods, - SingleBlockImplicitTerminator<"vector::YieldOp">, + SingleBlock, SingleBlockImplicitTerminator<"vector::YieldOp">, RecursiveMemoryEffects]> { let summary = "Executes operations in the associated region on thread #0 of a" "SPMD program"; diff --git a/mlir/include/mlir/IR/OpBase.td b/mlir/include/mlir/IR/OpBase.td --- a/mlir/include/mlir/IR/OpBase.td +++ b/mlir/include/mlir/IR/OpBase.td @@ -122,7 +122,8 @@ // Op's regions have a single block. def SingleBlock : NativeOpTrait<"SingleBlock">, StructuralOpTrait; -// Op's regions have a single block with the specified terminator. +// Op's regions have a single block with the specified terminator. SingleBlock +// must be attached to the op. class SingleBlockImplicitTerminator : ParamNativeOpTrait<"SingleBlockImplicitTerminator", op>, StructuralOpTrait; diff --git a/mlir/include/mlir/IR/OpDefinition.h b/mlir/include/mlir/IR/OpDefinition.h --- a/mlir/include/mlir/IR/OpDefinition.h +++ b/mlir/include/mlir/IR/OpDefinition.h @@ -942,10 +942,9 @@ /// block that must terminate with `TerminatorOpType`. template struct SingleBlockImplicitTerminator { - template - class Impl : public SingleBlock { + template class Impl { + private: - using Base = SingleBlock; /// Builds a terminator operation without relying on OpBuilder APIs to avoid /// cyclic header inclusion. static Operation *buildTerminator(OpBuilder &builder, Location loc) { @@ -959,7 +958,7 @@ using ImplicitTerminatorOpT = TerminatorOpType; static LogicalResult verifyRegionTrait(Operation *op) { - if (failed(Base::verifyTrait(op))) + if (failed(SingleBlock::verifyTrait(op))) return failure(); for (unsigned i = 0, e = op->getNumRegions(); i < e; ++i) { Region ®ion = op->getRegion(i); @@ -1002,7 +1001,6 @@ //===------------------------------------------------------------------===// // Single Region Utilities //===------------------------------------------------------------------===// - using Base::getBody; template using enable_if_single_region = @@ -1011,7 +1009,11 @@ /// Insert the operation into the back of the body, before the terminator. template enable_if_single_region push_back(Operation *op) { - insert(Block::iterator(getBody()->getTerminator()), op); + static_assert( + std::is_base_of, ConcreteType>::value, + "SingleBlockImplicitTerminator requires SingleBlock"); + Block *body = static_cast *>(this)->getBody(); + insert(Block::iterator(body->getTerminator()), op); } /// Insert the operation at the given insertion point. Note: The operation @@ -1024,7 +1026,10 @@ template enable_if_single_region insert(Block::iterator insertPt, Operation *op) { - auto *body = getBody(); + static_assert( + std::is_base_of, ConcreteType>::value, + "SingleBlockImplicitTerminator requires SingleBlock"); + Block *body = static_cast *>(this)->getBody(); if (insertPt == body->end()) insertPt = Block::iterator(body->getTerminator()); body->getOperations().insert(insertPt, op); diff --git a/mlir/test/lib/Dialect/Test/TestOps.td b/mlir/test/lib/Dialect/Test/TestOps.td --- a/mlir/test/lib/Dialect/Test/TestOps.td +++ b/mlir/test/lib/Dialect/Test/TestOps.td @@ -113,7 +113,7 @@ } def SymbolScopeOp : TEST_Op<"symbol_scope", - [SymbolTable, SingleBlockImplicitTerminator<"TerminatorOp">]> { + [SymbolTable, SingleBlock, SingleBlockImplicitTerminator<"TerminatorOp">]> { let summary = "operation which defines a new symbol table"; let regions = (region SizedRegion<1>:$region); } @@ -758,7 +758,7 @@ def TerminatorOp : TEST_Op<"finish", [Terminator]>; def SingleBlockImplicitTerminatorOp : TEST_Op<"SingleBlockImplicitTerminator", - [SingleBlockImplicitTerminator<"TerminatorOp">]> { + [SingleBlock, SingleBlockImplicitTerminator<"TerminatorOp">]> { let regions = (region SizedRegion<1>:$region); } @@ -2041,7 +2041,7 @@ } def RegionBufferBasedOp : BufferBasedOpBase<"region_buffer_based", - [SingleBlockImplicitTerminator<"RegionYieldOp">]> { + [SingleBlock, SingleBlockImplicitTerminator<"RegionYieldOp">]> { let regions = (region AnyRegion:$region); let assemblyFormat = [{ `in` `(` $input`:` type($input) `)` `out` `(` $output`:` type($output) `)` @@ -2077,7 +2077,7 @@ [DeclareOpInterfaceMethods, - SingleBlockImplicitTerminator<"RegionIfYieldOp">, + SingleBlock, SingleBlockImplicitTerminator<"RegionIfYieldOp">, RecursiveMemoryEffects]> { let description =[{ Represents an abstract if-then-else-join pattern. In this context, the then @@ -2623,7 +2623,7 @@ //===---------------------------------------------------------------------===// def TestCSEOfSingleBlockOp : TEST_Op<"cse_of_single_block_op", - [SingleBlockImplicitTerminator<"RegionYieldOp">, Pure]> { + [SingleBlock, SingleBlockImplicitTerminator<"RegionYieldOp">, Pure]> { let arguments = (ins Variadic:$inputs); let results = (outs Variadic:$outputs); let regions = (region SizedRegion<1>:$region); diff --git a/mlir/test/lib/Dialect/Test/TestOpsSyntax.td b/mlir/test/lib/Dialect/Test/TestOpsSyntax.td --- a/mlir/test/lib/Dialect/Test/TestOpsSyntax.td +++ b/mlir/test/lib/Dialect/Test/TestOpsSyntax.td @@ -20,7 +20,7 @@ Op; def WrappingRegionOp : TEST_Op<"wrapping_region", - [SingleBlockImplicitTerminator<"TestReturnOp">]> { + [SingleBlock, SingleBlockImplicitTerminator<"TestReturnOp">]> { let summary = "wrapping region operation"; let description = [{ Test op wrapping another op in a region, to test calling @@ -33,7 +33,7 @@ } def PrettyPrintedRegionOp : TEST_Op<"pretty_printed_region", - [SingleBlockImplicitTerminator<"TestReturnOp">]> { + [SingleBlock, SingleBlockImplicitTerminator<"TestReturnOp">]> { let summary = "pretty_printed_region operation"; let description = [{ Test-op can be printed either in a "pretty" or "non-pretty" way based on @@ -232,7 +232,7 @@ }]>; class FormatRegionImplicitTerminatorBase : TEST_Op<"format_implicit_terminator_region_" # suffix # "_op", - [SingleBlockImplicitTerminator<"TestReturnOp">]> { + [SingleBlock, SingleBlockImplicitTerminator<"TestReturnOp">]> { let regions = (region AnyRegion:$region); let assemblyFormat = fmt; } diff --git a/mlir/test/mlir-tblgen/gen-dialect-doc.td b/mlir/test/mlir-tblgen/gen-dialect-doc.td --- a/mlir/test/mlir-tblgen/gen-dialect-doc.td +++ b/mlir/test/mlir-tblgen/gen-dialect-doc.td @@ -21,8 +21,8 @@ } let opDocGroup = OpGroupA in { -def ADOp : Op]>; -def AAOp : Op]>; +def ADOp : Op]>; +def AAOp : Op]>; } def OpGroupB : OpDocGroup { @@ -31,11 +31,11 @@ } let opDocGroup = OpGroupB in { -def ACOp : Op]>; -def ABOp : Op]>; +def ACOp : Op]>; +def ABOp : Op]>; } -def AEOp : Op]>; +def AEOp : Op]>; def TestAttr : DialectAttr> { let summary = "attribute summary"; @@ -81,7 +81,7 @@ // CHECK: Other group // CHECK: test.b // CHECK: test.c -// CHECK: Traits: SingleBlockImplicitTerminator +// CHECK: Traits: SingleBlock, SingleBlockImplicitTerminator // CHECK: Interfaces: NoMemoryEffect (MemoryEffectOpInterface) // CHECK: Effects: MemoryEffects::Effect{}