diff --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp --- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp +++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp @@ -1578,6 +1578,7 @@ printBlockTerminators = true; } + p << ' '; p.printRegion(op.region(), /*printEntryBlockArgs=*/false, printBlockTerminators); p.printOptionalAttrDict(op->getAttrs(), @@ -2142,6 +2143,7 @@ printDimAndSymbolList(op.operand_begin(), op.operand_end(), conditionAttr.getValue().getNumDims(), p); p.printOptionalArrowTypeList(op.getResultTypes()); + p << ' '; p.printRegion(op.thenRegion(), /*printEntryBlockArgs=*/false, /*printBlockTerminators=*/op.getNumResults()); @@ -2149,7 +2151,7 @@ // Print the 'else' regions if it has any blocks. auto &elseRegion = op.elseRegion(); if (!elseRegion.empty()) { - p << " else"; + p << " else "; p.printRegion(elseRegion, /*printEntryBlockArgs=*/false, /*printBlockTerminators=*/op.getNumResults()); @@ -3157,6 +3159,7 @@ p << ") -> (" << op.getResultTypes() << ")"; } + p << ' '; p.printRegion(op.region(), /*printEntryBlockArgs=*/false, /*printBlockTerminators=*/op.getNumResults()); p.printOptionalAttrDict( diff --git a/mlir/lib/Dialect/Async/IR/Async.cpp b/mlir/lib/Dialect/Async/IR/Async.cpp --- a/mlir/lib/Dialect/Async/IR/Async.cpp +++ b/mlir/lib/Dialect/Async/IR/Async.cpp @@ -150,6 +150,7 @@ p.printOptionalArrowTypeList(llvm::drop_begin(op.getResultTypes())); p.printOptionalAttrDictWithKeyword(op->getAttrs(), {kOperandSegmentSizesAttr}); + p << ' '; p.printRegion(op.body(), /*printEntryBlockArgs=*/false); } diff --git a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp --- a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp +++ b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp @@ -475,6 +475,7 @@ p << ' ' << op.getDynamicSharedMemorySizeKeyword() << ' ' << op.dynamicSharedMemorySize(); + p << ' '; p.printRegion(op.body(), /*printEntryBlockArgs=*/false); p.printOptionalAttrDict(op->getAttrs()); } @@ -881,6 +882,7 @@ p, op.getOperation(), type.getNumInputs(), type.getNumResults(), {op.getNumWorkgroupAttributionsAttrName(), GPUDialect::getKernelFuncAttrName()}); + p << ' '; p.printRegion(op.getBody(), /*printEntryBlockArgs=*/false); } @@ -1005,6 +1007,7 @@ p.printSymbolName(op.getName()); p.printOptionalAttrDictWithKeyword(op->getAttrs(), {SymbolTable::getSymbolAttrName()}); + p << ' '; p.printRegion(op->getRegion(0), /*printEntryBlockArgs=*/false, /*printBlockTerminators=*/false); } diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp --- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp +++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp @@ -1661,8 +1661,10 @@ p << " : " << op.getType(); Region &initializer = op.getInitializerRegion(); - if (!initializer.empty()) + if (!initializer.empty()) { + p << ' '; p.printRegion(initializer, /*printEntryBlockArgs=*/false); + } } // Parses one of the keywords provided in the list `keywords` and returns the @@ -2092,9 +2094,11 @@ // Print the body if this is not an external function. Region &body = op.getBody(); - if (!body.empty()) + if (!body.empty()) { + p << ' '; p.printRegion(body, /*printEntryBlockArgs=*/false, /*printBlockTerminators=*/true); + } } // Hook for OpTrait::FunctionLike, called after verifying that the 'type' diff --git a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp --- a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp +++ b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp @@ -650,8 +650,10 @@ } // Print region. - if (!op.region().empty()) + if (!op.region().empty()) { + p << ' '; p.printRegion(op.region()); + } // Print results. printNamedStructuredOpResults(p, op.result_tensors().getTypes()); @@ -1805,11 +1807,12 @@ return attr.cast().getValue() != getParallelIteratorTypeName(); })) - p << " iterators" << op.iterator_types() << ""; + p << " iterators" << op.iterator_types(); if (op.distribution_types().hasValue()) - p << " distribution" << op.distribution_types().getValue() << ""; + p << " distribution" << op.distribution_types().getValue(); + p << ' '; p.printRegion(op.region(), /*printEntryBlockArgs=*/false); p.printOptionalAttrDict( op->getAttrs(), /*elidedAttrs=*/{TiledLoopOp::getOperandSegmentSizeAttr(), diff --git a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp --- a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp +++ b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp @@ -211,11 +211,12 @@ static void print(OpAsmPrinter &p, AllocaScopeOp &op) { bool printBlockTerminators = false; - p << " "; + p << ' '; if (!op.results().empty()) { p << " -> (" << op.getResultTypes() << ")"; printBlockTerminators = true; } + p << ' '; p.printRegion(op.bodyRegion(), /*printEntryBlockArgs=*/false, /*printBlockTerminators=*/printBlockTerminators); diff --git a/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp b/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp --- a/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp +++ b/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp @@ -469,6 +469,7 @@ printOperandList(op.gangFirstPrivateOperands(), ParallelOp::getFirstPrivateKeyword(), printer); + printer << ' '; printer.printRegion(op.region(), /*printEntryBlockArgs=*/false, /*printBlockTerminators=*/true); @@ -649,6 +650,7 @@ if (op.getNumResults() > 0) printer << " -> (" << op.getResultTypes() << ")"; + printer << ' '; printer.printRegion(op.region(), /*printEntryBlockArgs=*/false, /*printBlockTerminators=*/true); diff --git a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp --- a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp +++ b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp @@ -189,6 +189,7 @@ if (auto bind = op.proc_bind_val()) p << "proc_bind(" << bind << ") "; + p << ' '; p.printRegion(op.getRegion()); } @@ -960,8 +961,9 @@ printAllocateAndAllocator(p, op.allocate_vars(), op.allocators_vars()); if (op.nowait()) - p << "nowait "; + p << "nowait"; + p << ' '; p.printRegion(op.region()); } @@ -1094,6 +1096,7 @@ if (!op.reduction_vars().empty()) printReductionVarList(p, op.reductions(), op.reduction_vars()); + p << ' '; p.printRegion(op.region(), /*printEntryBlockArgs=*/false); } diff --git a/mlir/lib/Dialect/PDLInterp/IR/PDLInterp.cpp b/mlir/lib/Dialect/PDLInterp/IR/PDLInterp.cpp --- a/mlir/lib/Dialect/PDLInterp/IR/PDLInterp.cpp +++ b/mlir/lib/Dialect/PDLInterp/IR/PDLInterp.cpp @@ -122,7 +122,7 @@ static void print(OpAsmPrinter &p, ForEachOp op) { BlockArgument arg = op.getLoopVariable(); - p << ' ' << arg << " : " << arg.getType() << " in " << op.values(); + p << ' ' << arg << " : " << arg.getType() << " in " << op.values() << ' '; p.printRegion(op.region(), /*printEntryBlockArgs=*/false); p.printOptionalAttrDict(op->getAttrs()); p << " -> "; diff --git a/mlir/lib/Dialect/SCF/SCF.cpp b/mlir/lib/Dialect/SCF/SCF.cpp --- a/mlir/lib/Dialect/SCF/SCF.cpp +++ b/mlir/lib/Dialect/SCF/SCF.cpp @@ -118,6 +118,7 @@ static void print(OpAsmPrinter &p, ExecuteRegionOp op) { p.printOptionalArrowTypeList(op.getResultTypes()); + p << ' '; p.printRegion(op.getRegion(), /*printEntryBlockArgs=*/false, /*printBlockTerminators=*/true); @@ -347,6 +348,7 @@ " iter_args"); if (!op.getIterOperands().empty()) p << " -> (" << op.getIterOperands().getTypes() << ')'; + p << ' '; p.printRegion(op.getRegion(), /*printEntryBlockArgs=*/false, /*printBlockTerminators=*/op.hasIterOperands()); @@ -1130,6 +1132,7 @@ // Print yield explicitly if the op defines values. printBlockTerminators = true; } + p << ' '; p.printRegion(op.getThenRegion(), /*printEntryBlockArgs=*/false, /*printBlockTerminators=*/printBlockTerminators); @@ -1137,7 +1140,7 @@ // Print the 'else' regions if it exists and has a block. auto &elseRegion = op.getElseRegion(); if (!elseRegion.empty()) { - p << " else"; + p << " else "; p.printRegion(elseRegion, /*printEntryBlockArgs=*/false, /*printBlockTerminators=*/printBlockTerminators); @@ -1881,6 +1884,7 @@ if (!op.getInitVals().empty()) p << " init (" << op.getInitVals() << ")"; p.printOptionalArrowTypeList(op.getResultTypes()); + p << ' '; p.printRegion(op.getRegion(), /*printEntryBlockArgs=*/false); p.printOptionalAttrDict( op->getAttrs(), /*elidedAttrs=*/ParallelOp::getOperandSegmentSizeAttr()); @@ -2137,7 +2141,7 @@ static void print(OpAsmPrinter &p, ReduceOp op) { p << "(" << op.getOperand() << ") "; - p << " : " << op.getOperand().getType(); + p << " : " << op.getOperand().getType() << ' '; p.printRegion(op.getReductionOperator()); } @@ -2252,8 +2256,9 @@ op.getInits(), " "); p << " : "; p.printFunctionalType(op.getInits().getTypes(), op.getResults().getTypes()); + p << ' '; p.printRegion(op.getBefore(), /*printEntryBlockArgs=*/false); - p << " do"; + p << " do "; p.printRegion(op.getAfter()); p.printOptionalAttrDictWithKeyword(op->getAttrs()); } 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 @@ -2004,9 +2004,11 @@ // Print the body if this is not an external function. Region &body = fnOp.body(); - if (!body.empty()) + if (!body.empty()) { + printer << ' '; printer.printRegion(body, /*printEntryBlockArgs=*/false, /*printBlockTerminators=*/true); + } } LogicalResult spirv::FuncOp::verifyType() { @@ -2485,6 +2487,7 @@ auto control = loopOp.loop_control(); if (control != spirv::LoopControl::None) printer << " control(" << spirv::stringifyLoopControl(control) << ")"; + printer << ' '; printer.printRegion(op->getRegion(0), /*printEntryBlockArgs=*/false, /*printBlockTerminators=*/true); } @@ -2726,6 +2729,7 @@ } printer.printOptionalAttrDictWithKeyword(moduleOp->getAttrs(), elidedAttrs); + printer << ' '; printer.printRegion(moduleOp.getRegion()); } @@ -2875,6 +2879,7 @@ auto control = selectionOp.selection_control(); if (control != spirv::SelectionControl::None) printer << " control(" << spirv::stringifySelectionControl(control) << ")"; + printer << ' '; printer.printRegion(op->getRegion(0), /*printEntryBlockArgs=*/false, /*printBlockTerminators=*/true); } diff --git a/mlir/lib/Dialect/Shape/IR/Shape.cpp b/mlir/lib/Dialect/Shape/IR/Shape.cpp --- a/mlir/lib/Dialect/Shape/IR/Shape.cpp +++ b/mlir/lib/Dialect/Shape/IR/Shape.cpp @@ -287,9 +287,9 @@ bool yieldsResults = !op.getResults().empty(); p << " " << op.getWitness(); - if (yieldsResults) { + if (yieldsResults) p << " -> (" << op.getResultTypes() << ")"; - } + p << ' '; p.printRegion(op.getDoRegion(), /*printEntryBlockArgs=*/false, /*printBlockTerminators=*/yieldsResults); @@ -1114,6 +1114,7 @@ p.printSymbolName(op.getName()); p.printOptionalAttrDictWithKeyword( op->getAttrs(), {SymbolTable::getSymbolAttrName(), "mapping"}); + p << ' '; p.printRegion(op.getOperation()->getRegion(0), /*printEntryBlockArgs=*/false, /*printBlockTerminators=*/false); p << " mapping "; @@ -1711,6 +1712,7 @@ p << '(' << op.getShape() << ", " << op.getInitVals() << ") : " << op.getShape().getType(); p.printOptionalArrowTypeList(op.getResultTypes()); + p << ' '; p.printRegion(op.getRegion()); p.printOptionalAttrDict(op->getAttrs()); } diff --git a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp --- a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp +++ b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp @@ -195,7 +195,7 @@ static void print(OpAsmPrinter &p, GenericAtomicRMWOp op) { p << ' ' << op.getMemref() << "[" << op.getIndices() - << "] : " << op.getMemref().getType(); + << "] : " << op.getMemref().getType() << ' '; p.printRegion(op.getRegion()); p.printOptionalAttrDict(op->getAttrs()); } diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp --- a/mlir/lib/IR/AsmPrinter.cpp +++ b/mlir/lib/IR/AsmPrinter.cpp @@ -2716,7 +2716,7 @@ void OperationPrinter::printRegion(Region ®ion, bool printEntryBlockArgs, bool printBlockTerminators, bool printEmptyBlock) { - os << " {" << newLine; + os << "{" << newLine; if (!region.empty()) { auto restoreDefaultDialect = llvm::make_scope_exit([&]() { defaultDialectStack.pop_back(); }); diff --git a/mlir/lib/IR/FunctionImplementation.cpp b/mlir/lib/IR/FunctionImplementation.cpp --- a/mlir/lib/IR/FunctionImplementation.cpp +++ b/mlir/lib/IR/FunctionImplementation.cpp @@ -371,7 +371,9 @@ {visibilityAttrName}); // Print the body if this is not an external function. Region &body = op->getRegion(0); - if (!body.empty()) + if (!body.empty()) { + p << ' '; p.printRegion(body, /*printEntryBlockArgs=*/false, /*printBlockTerminators=*/true); + } } diff --git a/mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir b/mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir --- a/mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir +++ b/mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir @@ -50,7 +50,7 @@ // CHECK: omp.parallel omp.parallel { // CHECK: omp.wsloop (%[[ARG6:.*]], %[[ARG7:.*]]) : i64 = (%[[ARG0]], %[[ARG1]]) to (%[[ARG2]], %[[ARG3]]) step (%[[ARG4]], %[[ARG5]]) { - "omp.wsloop"(%arg0, %arg1, %arg2, %arg3, %arg4, %arg5) ( { + "omp.wsloop"(%arg0, %arg1, %arg2, %arg3, %arg4, %arg5) ({ ^bb0(%arg6: index, %arg7: index): // no predecessors // CHECK-DAG: %[[CAST_ARG6:.*]] = builtin.unrealized_conversion_cast %[[ARG6]] : i64 to index // CHECK-DAG: %[[CAST_ARG7:.*]] = builtin.unrealized_conversion_cast %[[ARG7]] : i64 to index diff --git a/mlir/test/Conversion/TosaToSCF/tosa-to-scf.mlir b/mlir/test/Conversion/TosaToSCF/tosa-to-scf.mlir --- a/mlir/test/Conversion/TosaToSCF/tosa-to-scf.mlir +++ b/mlir/test/Conversion/TosaToSCF/tosa-to-scf.mlir @@ -4,7 +4,7 @@ // CHECK-SAME: ([[ARG0:%.+]]: tensor) func @while_test(%arg0 : tensor) -> (tensor) { // CHECK: [[WHILE:%.+]] = scf.while ([[ARG1:%.+]] = [[ARG0]]) - %1 = "tosa.while_loop"(%arg0) ( { + %1 = "tosa.while_loop"(%arg0) ({ ^bb0(%arg2: tensor): // CHECK: "tosa.const" %2 = "tosa.const"() {value = dense<3> : tensor} : () -> tensor diff --git a/mlir/test/Dialect/Affine/ops.mlir b/mlir/test/Dialect/Affine/ops.mlir --- a/mlir/test/Dialect/Affine/ops.mlir +++ b/mlir/test/Dialect/Affine/ops.mlir @@ -49,7 +49,7 @@ // CHECK: affine.for // CHECK-NEXT: } // - // GENERIC: "affine.for"() ( { + // GENERIC: "affine.for"() ({ // GENERIC-NEXT: ^bb0(%{{.*}}: index): // no predecessors // GENERIC-NEXT: "affine.yield"() : () -> () // GENERIC-NEXT: }) {lower_bound = #map0, step = 1 : index, upper_bound = #map1} : () -> () diff --git a/mlir/test/Dialect/Bufferization/Transforms/buffer-deallocation.mlir b/mlir/test/Dialect/Bufferization/Transforms/buffer-deallocation.mlir --- a/mlir/test/Dialect/Bufferization/Transforms/buffer-deallocation.mlir +++ b/mlir/test/Dialect/Bufferization/Transforms/buffer-deallocation.mlir @@ -1198,9 +1198,9 @@ func @noRegionBranchOpInterface() { // expected-error@+1 {{All operations with attached regions need to implement the RegionBranchOpInterface.}} - %0 = "test.bar"() ( { + %0 = "test.bar"() ({ // expected-error@+1 {{All operations with attached regions need to implement the RegionBranchOpInterface.}} - %1 = "test.bar"() ( { + %1 = "test.bar"() ({ "test.yield"() : () -> () }) : () -> (i32) "test.yield"() : () -> () diff --git a/mlir/test/Dialect/GPU/invalid.mlir b/mlir/test/Dialect/GPU/invalid.mlir --- a/mlir/test/Dialect/GPU/invalid.mlir +++ b/mlir/test/Dialect/GPU/invalid.mlir @@ -430,7 +430,7 @@ module { gpu.module @gpu_funcs { // expected-error @+1 {{'gpu.func' op expected at least 5 arguments to body region}} - "gpu.func"() ( { + "gpu.func"() ({ ^bb0(%arg0: f32, %arg1: memref, %arg2: memref<5xf32, 3>, %arg3: memref<5xf32, 5>): "gpu.return"() : () -> () } ) {gpu.kernel, sym_name = "kernel_1", type = (f32, memref) -> (), workgroup_attributions = 3: i64} : () -> () diff --git a/mlir/test/Dialect/GPU/ops.mlir b/mlir/test/Dialect/GPU/ops.mlir --- a/mlir/test/Dialect/GPU/ops.mlir +++ b/mlir/test/Dialect/GPU/ops.mlir @@ -155,7 +155,7 @@ gpu.module @explicit_attributions { // CHECK-LABEL: gpu.func @kernel_1({{.*}}: f32, {{.*}}: memref) workgroup({{.*}}: memref<5xf32, 3>) private({{.*}}: memref<5xf32, 5>) - "gpu.func"() ( { + "gpu.func"() ({ ^bb0(%arg0: f32, %arg1: memref, %arg2: memref<5xf32, 3>, %arg3: memref<5xf32, 5>): "gpu.return"() : () -> () } ) {gpu.kernel, sym_name = "kernel_1", type = (f32, memref) -> (), workgroup_attributions = 1: i64} : () -> () diff --git a/mlir/test/Dialect/Linalg/invalid.mlir b/mlir/test/Dialect/Linalg/invalid.mlir --- a/mlir/test/Dialect/Linalg/invalid.mlir +++ b/mlir/test/Dialect/Linalg/invalid.mlir @@ -542,7 +542,7 @@ %c0 = arith.constant 0 : index %c192 = arith.constant 192 : index // expected-error @+1 {{expected iterator types array attribute size = 1 to match the number of loops = 2}} - %0 = "linalg.tiled_loop"(%c0, %c0, %c192, %c192, %c24, %c24, %A, %B, %C_tensor, %C) ( { + %0 = "linalg.tiled_loop"(%c0, %c0, %c192, %c192, %c24, %c24, %A, %B, %C_tensor, %C) ({ ^bb0(%arg4: index, %arg5: index, %A_: memref<192x192xf32>, %B_: memref<192x192xf32>, %CT_: tensor<192x192xf32>, %C_: memref<192x192xf32>): @@ -567,7 +567,7 @@ %c192 = arith.constant 192 : index %c24 = arith.constant 24 : index // expected-error @+1 {{expected output arg 0 with type = 'memref<192xf32>' to match region arg 1 type = 'memref<100xf32>'}} - "linalg.tiled_loop"(%c0, %c192, %c24, %A) ( { + "linalg.tiled_loop"(%c0, %c192, %c24, %A) ({ ^bb0(%arg4: index, %A_: memref<100xf32>): call @foo(%A_) : (memref<100xf32>)-> () linalg.yield diff --git a/mlir/test/Dialect/Linalg/named-ops.mlir b/mlir/test/Dialect/Linalg/named-ops.mlir --- a/mlir/test/Dialect/Linalg/named-ops.mlir +++ b/mlir/test/Dialect/Linalg/named-ops.mlir @@ -565,7 +565,7 @@ func @conv_interface_wrong_input_indexing_map( %arg0 : tensor, %arg2 : tensor, %arg1 : tensor) -> tensor { // expected-error @+1 {{unexpected input index map for convolutions}} - %0 = "linalg.conv_2d_nhwc_hwcf"(%arg0, %arg1, %arg2) ( { + %0 = "linalg.conv_2d_nhwc_hwcf"(%arg0, %arg1, %arg2) ({ ^bb0(%arg3: f32, %arg4: f32, %arg5 : f32): // no predecessors %1 = "arith.mulf"(%arg3, %arg4) : (f32, f32) -> f32 %2 = "arith.addf"(%arg5, %1) : (f32, f32) -> f32 @@ -582,7 +582,7 @@ func @conv_interface_wrong_num_operands( %arg0 : tensor, %arg1 : tensor, %arg2 : tensor) -> tensor { // expected-error @+1 {{expected output/filter indexing maps to be projected permutations}} - %0 = "linalg.conv_2d_nhwc_hwcf"(%arg0, %arg1, %arg2) ( { + %0 = "linalg.conv_2d_nhwc_hwcf"(%arg0, %arg1, %arg2) ({ ^bb0(%arg3: f32, %arg4: f32, %arg5 : f32): // no predecessors %1 = "arith.mulf"(%arg3, %arg4) : (f32, f32) -> f32 %2 = "arith.addf"(%arg5, %1) : (f32, f32) -> f32 diff --git a/mlir/test/Dialect/MemRef/invalid.mlir b/mlir/test/Dialect/MemRef/invalid.mlir --- a/mlir/test/Dialect/MemRef/invalid.mlir +++ b/mlir/test/Dialect/MemRef/invalid.mlir @@ -814,7 +814,7 @@ // ----- -"alloca_without_scoped_alloc_parent"() ( { +"alloca_without_scoped_alloc_parent"() ({ memref.alloca() : memref<1xf32> // expected-error@-1 {{requires an ancestor op with AutomaticAllocationScope trait}} return diff --git a/mlir/test/Dialect/Tosa/inlining.mlir b/mlir/test/Dialect/Tosa/inlining.mlir --- a/mlir/test/Dialect/Tosa/inlining.mlir +++ b/mlir/test/Dialect/Tosa/inlining.mlir @@ -8,7 +8,7 @@ // CHECK-NOT: @add // CHECK-NOT: @sub func @inlined_if_fn(%arg0: tensor, %arg1: tensor, %arg2: tensor) -> tensor { - %0 = "tosa.cond_if"(%arg2, %arg0, %arg1) ( { + %0 = "tosa.cond_if"(%arg2, %arg0, %arg1) ({ ^bb0(%arg3: tensor, %arg4: tensor): // no predecessors %1 = call @add(%arg3, %arg4) : (tensor, tensor) -> tensor "tosa.yield"(%1) : (tensor) -> () @@ -34,7 +34,7 @@ func @inlined_while_fn(%arg0: tensor, %arg1: tensor, %arg2: tensor, %arg3: tensor<10xi32>) -> tensor<10xi32> { // Check that calls are inlined and functions eliminated: // CHECK-NOT: @while - %1:4 = "tosa.while_loop"(%arg0, %arg1, %arg2, %arg3) ( { + %1:4 = "tosa.while_loop"(%arg0, %arg1, %arg2, %arg3) ({ ^bb0(%arg4: tensor, %arg5: tensor, %arg6: tensor, %arg7: tensor<10xi32>): // no predecessors %2 = call @while_cond_40(%arg4, %arg5, %arg6, %arg7) : (tensor, tensor, tensor, tensor<10xi32>) -> tensor "tosa.yield"(%2) : (tensor) -> () diff --git a/mlir/test/Dialect/Tosa/ops.mlir b/mlir/test/Dialect/Tosa/ops.mlir --- a/mlir/test/Dialect/Tosa/ops.mlir +++ b/mlir/test/Dialect/Tosa/ops.mlir @@ -505,7 +505,7 @@ // ----- // CHECK-LABEL: cond_if func @test_cond_if(%arg0: tensor, %arg1: tensor, %arg2: tensor) -> tensor { - %0 = "tosa.cond_if"(%arg2, %arg0, %arg1) ( { + %0 = "tosa.cond_if"(%arg2, %arg0, %arg1) ({ ^bb0(%arg3: tensor, %arg4: tensor): // no predecessors %1 = "tosa.add"(%arg3, %arg4) : (tensor, tensor) -> tensor "tosa.yield"(%1) : (tensor) -> () @@ -521,7 +521,7 @@ // CHECK-LABEL: while_loop func @test_while_loop(%arg0: tensor<10xi32>, %arg1: tensor) { %0 = "tosa.const"() {value = dense<0> : tensor} : () -> tensor - %1:3 = "tosa.while_loop"(%0, %0, %arg0) ( { + %1:3 = "tosa.while_loop"(%0, %0, %arg0) ({ ^bb0(%arg2: tensor, %arg3: tensor, %arg4: tensor<10xi32>): // no predecessors %2 = "tosa.greater_equal"(%arg3, %arg1) : (tensor, tensor) -> tensor %3 = "tosa.logical_not"(%2) : (tensor) -> tensor diff --git a/mlir/test/Dialect/Tosa/tosa-infer-shapes.mlir b/mlir/test/Dialect/Tosa/tosa-infer-shapes.mlir --- a/mlir/test/Dialect/Tosa/tosa-infer-shapes.mlir +++ b/mlir/test/Dialect/Tosa/tosa-infer-shapes.mlir @@ -1130,7 +1130,7 @@ %0 = "tosa.add"(%arg0, %arg0) : (tensor, tensor) -> tensor<*xi32> // CHECK: "tosa.while_loop" - %1 = "tosa.while_loop"(%0) ( { + %1 = "tosa.while_loop"(%0) ({ // CHECK: ^bb0 // CHECK-SAME: tensor @@ -1168,7 +1168,7 @@ // CHECK-LABEL: @while_test func @while_test(%arg0 : tensor, %arg1 : tensor<1xi32>) -> () { // CHECK: "tosa.while_loop" - %1:2 = "tosa.while_loop"(%arg0, %arg1) ( { + %1:2 = "tosa.while_loop"(%arg0, %arg1) ({ // CHECK: ^bb0 // CHECK-SAME: tensor diff --git a/mlir/test/IR/invalid-ops.mlir b/mlir/test/IR/invalid-ops.mlir --- a/mlir/test/IR/invalid-ops.mlir +++ b/mlir/test/IR/invalid-ops.mlir @@ -156,7 +156,7 @@ func @generic_atomic_rmw_result_type_mismatch(%I: memref<10xf32>, %i : index) { // expected-error@+1 {{failed to verify that result type matches element type of memref}} - %0 = "std.generic_atomic_rmw"(%I, %i) ( { + %0 = "std.generic_atomic_rmw"(%I, %i) ({ ^bb0(%old_value: f32): %c1 = arith.constant 1.0 : f32 atomic_yield %c1 : f32 diff --git a/mlir/test/IR/parser.mlir b/mlir/test/IR/parser.mlir --- a/mlir/test/IR/parser.mlir +++ b/mlir/test/IR/parser.mlir @@ -864,7 +864,7 @@ // CHECK-LABEL: func @terminator_with_regions func @terminator_with_regions() { // Combine successors and regions in the same operation. - // CHECK: "region"()[^bb1] ( { + // CHECK: "region"()[^bb1] ({ // CHECK: }) : () -> () "region"()[^bb2] ({}) : () -> () ^bb2: @@ -1132,7 +1132,7 @@ // CHECK-LABEL: func @op_with_region_args func @op_with_region_args() { - // CHECK: "test.polyfor"() ( { + // CHECK: "test.polyfor"() ({ // CHECK-NEXT: ^bb{{.*}}(%{{.*}}: index, %{{.*}}: index, %{{.*}}: index): test.polyfor %i, %j, %k { "foo"() : () -> () @@ -1399,7 +1399,7 @@ // CHECK: test.graph_region { test.graph_region { // CHECK: [[VAL1:%.*]] = "op1"([[VAL3:%.*]]) : (i32) -> i32 -// CHECK: [[VAL2:%.*]] = "test.ssacfg_region"([[VAL1]], [[VAL2]], [[VAL3]], [[VAL4:%.*]]) ( { +// CHECK: [[VAL2:%.*]] = "test.ssacfg_region"([[VAL1]], [[VAL2]], [[VAL3]], [[VAL4:%.*]]) ({ // CHECK: [[VAL5:%.*]] = "op2"([[VAL1]], [[VAL2]], [[VAL3]], [[VAL4]]) : (i32, i32, i32, i32) -> i32 // CHECK: }) : (i32, i32, i32, i32) -> i32 // CHECK: [[VAL3]] = "op2"([[VAL1]], [[VAL4]]) : (i32, i32) -> i32 @@ -1413,10 +1413,10 @@ %4 = "op3"(%1) : (i32) -> (i32) } -// CHECK: "unregistered_func_might_have_graph_region"() ( { +// CHECK: "unregistered_func_might_have_graph_region"() ({ // CHECK: [[VAL1:%.*]] = "foo"([[VAL1]], [[VAL2:%.*]]) : (i64, i64) -> i64 // CHECK: [[VAL2]] = "bar"([[VAL1]]) -"unregistered_func_might_have_graph_region"() ( { +"unregistered_func_might_have_graph_region"() ({ %1 = "foo"(%1, %2) : (i64, i64) -> i64 %2 = "bar"(%1) : (i64) -> i64 "unregistered_terminator"() : () -> () diff --git a/mlir/test/IR/pretty-region-args.mlir b/mlir/test/IR/pretty-region-args.mlir --- a/mlir/test/IR/pretty-region-args.mlir +++ b/mlir/test/IR/pretty-region-args.mlir @@ -2,7 +2,7 @@ // CHECK-LABEL: func @custom_region_names func @custom_region_names() -> () { - "test.polyfor"() ( { + "test.polyfor"() ({ ^bb0(%arg0: index, %arg1: index, %arg2: index): "foo"() : () -> () }) { arg_names = ["i", "j", "k"] } : () -> () @@ -14,7 +14,7 @@ // CHECK-LABEL: func @weird_names // Make sure the asmprinter handles weird names correctly. func @weird_names() -> () { - "test.polyfor"() ( { + "test.polyfor"() ({ ^bb0(%arg0: i32, %arg1: i32, %arg2: index): "foo"() : () -> i32 }) { arg_names = ["a .^x", "0"] } : () -> () diff --git a/mlir/test/IR/pretty_printed_region_op.mlir b/mlir/test/IR/pretty_printed_region_op.mlir --- a/mlir/test/IR/pretty_printed_region_op.mlir +++ b/mlir/test/IR/pretty_printed_region_op.mlir @@ -25,7 +25,7 @@ // CHECK: "test.return"(%[[RES]]) : (f32) -> () // CHECK: : (f32, f32) -> f32 - %0 = test.pretty_printed_region %arg1, %arg0 ( { + %0 = test.pretty_printed_region %arg1, %arg0 ({ ^bb0(%arg2: f32, %arg3: f32): %1 = "non.special.op"(%arg2, %arg3) : (f32, f32) -> f32 "test.return"(%1) : (f32) -> () diff --git a/mlir/test/IR/region.mlir b/mlir/test/IR/region.mlir --- a/mlir/test/IR/region.mlir +++ b/mlir/test/IR/region.mlir @@ -78,7 +78,7 @@ // Region with single block and not terminator. // CHECK: unregistered_without_terminator -"test.unregistered_without_terminator"() ( { +"test.unregistered_without_terminator"() ({ ^bb0: // no predecessors }) : () -> () diff --git a/mlir/test/IR/wrapping_op.mlir b/mlir/test/IR/wrapping_op.mlir --- a/mlir/test/IR/wrapping_op.mlir +++ b/mlir/test/IR/wrapping_op.mlir @@ -5,7 +5,7 @@ // CHECK-GENERIC: "builtin.func" func @wrapping_op(%arg0 : i32, %arg1 : f32) -> (i3, i2, i1) { // CHECK: %0:3 = test.wrapping_region wraps "some.op"(%arg1, %arg0) {test.attr = "attr"} : (f32, i32) -> (i1, i2, i3) -// CHECK-GENERIC: "test.wrapping_region"() ( { +// CHECK-GENERIC: "test.wrapping_region"() ({ // CHECK-GENERIC: %[[NESTED_RES:.*]]:3 = "some.op"(%arg1, %arg0) {test.attr = "attr"} : (f32, i32) -> (i1, i2, i3) loc("some_NameLoc") // CHECK-GENERIC: "test.return"(%[[NESTED_RES]]#0, %[[NESTED_RES]]#1, %[[NESTED_RES]]#2) : (i1, i2, i3) -> () loc("some_NameLoc") // CHECK-GENERIC: }) : () -> (i1, i2, i3) loc("some_NameLoc") diff --git a/mlir/test/Target/LLVMIR/openmp-llvm.mlir b/mlir/test/Target/LLVMIR/openmp-llvm.mlir --- a/mlir/test/Target/LLVMIR/openmp-llvm.mlir +++ b/mlir/test/Target/LLVMIR/openmp-llvm.mlir @@ -368,7 +368,7 @@ %1 = llvm.mlir.constant(10 : index) : i64 %2 = llvm.mlir.constant(1 : index) : i64 omp.parallel { - "omp.wsloop"(%1, %0, %2) ( { + "omp.wsloop"(%1, %0, %2) ({ ^bb0(%arg1: i64): // The form of the emitted IR is controlled by OpenMPIRBuilder and // tested there. Just check that the right functions are called. @@ -393,7 +393,7 @@ %1 = llvm.mlir.constant(10 : index) : i64 %2 = llvm.mlir.constant(1 : index) : i64 // CHECK: store i64 31, i64* %{{.*}}upperbound - "omp.wsloop"(%1, %0, %2) ( { + "omp.wsloop"(%1, %0, %2) ({ ^bb0(%arg1: i64): %3 = llvm.mlir.constant(2.000000e+00 : f32) : f32 %4 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr @@ -411,7 +411,7 @@ %1 = llvm.mlir.constant(10 : index) : i64 %2 = llvm.mlir.constant(1 : index) : i64 // CHECK: store i64 32, i64* %{{.*}}upperbound - "omp.wsloop"(%1, %0, %2) ( { + "omp.wsloop"(%1, %0, %2) ({ ^bb0(%arg1: i64): %3 = llvm.mlir.constant(2.000000e+00 : f32) : f32 %4 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr diff --git a/mlir/test/Transforms/test-merge-blocks.mlir b/mlir/test/Transforms/test-merge-blocks.mlir --- a/mlir/test/Transforms/test-merge-blocks.mlir +++ b/mlir/test/Transforms/test-merge-blocks.mlir @@ -2,7 +2,7 @@ // CHECK-LABEL: @merge_blocks func @merge_blocks(%arg0: i32, %arg1 : i32) -> () { - // CHECK: "test.merge_blocks"() ( { + // CHECK: "test.merge_blocks"() ({ // CHECK-NEXT: "test.return" // CHECK-NEXT: }) // CHECK-NEXT: "test.return" diff --git a/mlir/test/lib/Dialect/Test/TestDialect.cpp b/mlir/test/lib/Dialect/Test/TestDialect.cpp --- a/mlir/test/lib/Dialect/Test/TestDialect.cpp +++ b/mlir/test/lib/Dialect/Test/TestDialect.cpp @@ -603,6 +603,7 @@ p << "test.isolated_region "; p.printOperand(op.getOperand()); p.shadowRegionArgs(op.getRegion(), op.getOperand()); + p << ' '; p.printRegion(op.getRegion(), /*printEntryBlockArgs=*/false); } diff --git a/mlir/test/mlir-lsp-server/hover.test b/mlir/test/mlir-lsp-server/hover.test --- a/mlir/test/mlir-lsp-server/hover.test +++ b/mlir/test/mlir-lsp-server/hover.test @@ -114,7 +114,7 @@ // CHECK-NEXT: "result": { // CHECK-NEXT: "contents": { // CHECK-NEXT: "kind": "markdown", -// CHECK-NEXT: "value": "\"builtin.func\" : public @foo\n\nGeneric Form:\n\n```mlir\n\"builtin.func\"() ( {\n}) {sym_name = \"foo\", type = (i1) -> ()} : () -> ()\n```\n" +// CHECK-NEXT: "value": "\"builtin.func\" : public @foo\n\nGeneric Form:\n\n```mlir\n\"builtin.func\"() ({\n}) {sym_name = \"foo\", type = (i1) -> ()} : () -> ()\n```\n" // CHECK-NEXT: }, // CHECK-NEXT: "range": { // CHECK-NEXT: "end": { @@ -138,7 +138,7 @@ // CHECK-NEXT: "result": { // CHECK-NEXT: "contents": { // CHECK-NEXT: "kind": "markdown", -// CHECK-NEXT: "value": "\"builtin.func\" : public @foo\n\nGeneric Form:\n\n```mlir\n\"builtin.func\"() ( {\n}) {sym_name = \"foo\", type = (i1) -> ()} : () -> ()\n```\n" +// CHECK-NEXT: "value": "\"builtin.func\" : public @foo\n\nGeneric Form:\n\n```mlir\n\"builtin.func\"() ({\n}) {sym_name = \"foo\", type = (i1) -> ()} : () -> ()\n```\n" // CHECK-NEXT: }, // CHECK-NEXT: "range": { // CHECK-NEXT: "end": { diff --git a/mlir/test/mlir-tblgen/op-format.mlir b/mlir/test/mlir-tblgen/op-format.mlir --- a/mlir/test/mlir-tblgen/op-format.mlir +++ b/mlir/test/mlir-tblgen/op-format.mlir @@ -161,7 +161,7 @@ // Format successors //===----------------------------------------------------------------------===// -"foo.successor_test_region"() ( { +"foo.successor_test_region"() ({ ^bb0: // CHECK: test.format_successor_a_op ^bb1 {attr} test.format_successor_a_op ^bb1 {attr} diff --git a/mlir/test/python/ir/operation.py b/mlir/test/python/ir/operation.py --- a/mlir/test/python/ir/operation.py +++ b/mlir/test/python/ir/operation.py @@ -306,7 +306,7 @@ "foo": StringAttr.get("foo_value"), "bar": StringAttr.get("bar_value"), }) - # CHECK: %0:2 = "custom.op1"() ( { + # CHECK: %0:2 = "custom.op1"() ({ # CHECK: }) {bar = "bar_value", foo = "foo_value"} : () -> (si32, si32) print(op1) @@ -360,7 +360,7 @@ i32 = IntegerType.get_signed(32) op1 = Operation.create("custom.op1", regions=1) block = op1.regions[0].blocks.append(i32, i32) - # CHECK: "custom.op1"() ( { + # CHECK: "custom.op1"() ({ # CHECK: ^bb0(%arg0: si32, %arg1: si32): // no predecessors # CHECK: "custom.terminator"() : () -> () # CHECK: }) : () -> () @@ -645,7 +645,7 @@ invalid_op = create_invalid_operation() # Verify that we fallback to the generic printer for safety. # CHECK: // Verification failed, printing generic form - # CHECK: "builtin.module"() ( { + # CHECK: "builtin.module"() ({ # CHECK: }) : () -> () print(invalid_op) # CHECK: .verify = False