File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
mlir/test/lib/Dialect/Test Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -1637,3 +1637,14 @@ test::TestCreateTensorOp::getBufferType(
16371637
16381638 return convertTensorToBuffer (getOperation (), options, type);
16391639}
1640+
1641+ // Define a custom builder for ManyRegionsOp declared in TestOps.td.
1642+ // OpBuilder<(ins "::std::unique_ptr<::mlir::Region>":$firstRegion,
1643+ // "::std::unique_ptr<::mlir::Region>":$secondRegion)>
1644+ void test::ManyRegionsOp::build (
1645+ mlir::OpBuilder &builder, mlir::OperationState &state,
1646+ llvm::SmallVectorImpl<std::unique_ptr<mlir::Region>> &®ions) {
1647+ for (auto &®ionPtr : std::move (regions))
1648+ state.addRegion (std::move (regionPtr));
1649+ ManyRegionsOp::build (builder, state, {}, regions.size ());
1650+ }
Original file line number Diff line number Diff line change @@ -2352,6 +2352,24 @@ def IsolatedGraphRegionOp : TEST_Op<"isolated_graph_region", [
23522352 let assemblyFormat = "attr-dict-with-keyword $region";
23532353}
23542354
2355+ def ManyRegionsOp : TEST_Op<"many_regions", []> {
2356+ let summary = "operation created with move-only objects";
2357+ let description = [{
2358+ Test op with multiple regions with a `create` function that
2359+ takes parameters containing move-only objects.
2360+ }];
2361+
2362+ let regions = (region VariadicRegion<AnyRegion>:$regions);
2363+ let builders =
2364+ [OpBuilder<(ins "::std::unique_ptr<::mlir::Region>":$singleRegion), [{
2365+ $_state.addRegion(std::move(singleRegion));
2366+ build($_builder, $_state, {}, /*regionsCount=*/1);
2367+ }]>,
2368+ // Define in TestOps.cpp.
2369+ OpBuilder<(ins "::llvm::SmallVectorImpl<::std::unique_ptr<::mlir::"
2370+ "Region>>&&":$regions)>];
2371+ }
2372+
23552373def AffineScopeOp : TEST_Op<"affine_scope", [AffineScope]> {
23562374 let summary = "affine scope operation";
23572375 let description = [{
You can’t perform that action at this time.
0 commit comments