1 // RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -verify-diagnostics | FileCheck %s
3 //===----------------------------------------------------------------------===//
4 // Test the number of regions
5 //===----------------------------------------------------------------------===//
7 func.func @correct_number_of_regions() {
8 // CHECK: test.two_region_op
9 "test.two_region_op"()(
10 {"work"() : () -> ()},
18 func.func @missing_regions() {
19 // expected-error@+1 {{expected 2 regions}}
20 "test.two_region_op"()(
28 func.func @extra_regions() {
29 // expected-error@+1 {{expected 2 regions}}
30 "test.two_region_op"()(
31 {"work"() : () -> ()},
32 {"work"() : () -> ()},
40 //===----------------------------------------------------------------------===//
42 //===----------------------------------------------------------------------===//
44 func.func @unnamed_region_has_wrong_number_of_blocks() {
45 // expected-error@+1 {{region #1 failed to verify constraint: region with 1 blocks}}
46 "test.sized_region_op"() (
64 // Test region name in error message
65 func.func @named_region_has_wrong_number_of_blocks() {
66 // expected-error@+1 {{region #0 ('my_region') failed to verify constraint: region with 2 blocks}}
67 "test.sized_region_op"() (
79 // Region with single block and not terminator.
80 // CHECK: unregistered_without_terminator
81 "test.unregistered_without_terminator"() ({
87 // CHECK: test.single_no_terminator_op
88 "test.single_no_terminator_op"() (
90 %foo = arith.constant 1 : i32
94 // CHECK: test.variadic_no_terminator_op
95 "test.variadic_no_terminator_op"() (
97 %foo = arith.constant 1 : i32
100 %bar = arith.constant 1 : i32
104 // CHECK: test.single_no_terminator_custom_asm_op
105 // CHECK-NEXT: important_dont_drop
106 test.single_no_terminator_custom_asm_op {
107 "important_dont_drop"() : () -> ()