xref: /llvm-project/mlir/test/IR/print-ir-nesting.mlir (revision 6b8edc9f7933d59ababd34ff040fab3d16cb3e3b)
1// RUN: mlir-opt -test-print-nesting  -allow-unregistered-dialect %s | FileCheck %s
2
3// CHECK: visiting op: 'builtin.module' with 0 operands and 0 results
4// CHECK:  1 nested regions:
5// CHECK:   Region with 1 blocks:
6// CHECK:     Block with 0 arguments, 0 successors, and 2 operations
7"builtin.module"() ( {
8
9
10// CHECK:       visiting op: 'dialect.op1' with 0 operands and 4 results
11// CHECK:       1 attributes:
12// CHECK:        - 'attribute name' : '42 : i32'
13// CHECK:        0 nested regions:
14  %results:4 = "dialect.op1"() { "attribute name" = 42 : i32 } : () -> (i1, i16, i32, i64)
15
16
17// CHECK:       visiting op: 'dialect.op2' with 0 operands and 0 results
18// CHECK:       1 attributes:
19// CHECK:        - 'other attribute' : '42 : i64'
20// CHECK:        2 nested regions:
21  "dialect.op2"() ({
22
23// CHECK:         Region with 1 blocks:
24// CHECK:           Block with 0 arguments, 0 successors, and 1 operations
25// CHECK:             visiting op: 'dialect.innerop1' with 2 operands and 0 results
26// CHECK:              0 nested regions:
27    "dialect.innerop1"(%results#0, %results#1) : (i1, i16) -> ()
28
29// CHECK:         Region with 3 blocks:
30  },{
31
32// CHECK:           Block with 0 arguments, 2 successors, and 2 operations
33// CHECK:             visiting op: 'dialect.innerop2' with 0 operands and 0 results
34// CHECK:              0 nested regions:
35    "dialect.innerop2"() : () -> ()
36// CHECK:             visiting op: 'dialect.innerop3' with 3 operands and 0 results
37// CHECK:              0 nested regions:
38    "dialect.innerop3"(%results#0, %results#2, %results#3)[^bb1, ^bb2] : (i1, i32, i64) -> ()
39// CHECK:           Block with 1 arguments, 0 successors, and 2 operations
40  ^bb1(%arg1 : i32):
41// CHECK:             visiting op: 'dialect.innerop4' with 0 operands and 0 results
42// CHECK:              0 nested regions:
43    "dialect.innerop4"() : () -> ()
44// CHECK:             visiting op: 'dialect.innerop5' with 0 operands and 0 results
45// CHECK:              0 nested regions:
46    "dialect.innerop5"() : () -> ()
47// CHECK:           Block with 1 arguments, 0 successors, and 2 operations
48  ^bb2(%arg2 : i64):
49// CHECK:             visiting op: 'dialect.innerop6' with 0 operands and 0 results
50// CHECK:              0 nested regions:
51    "dialect.innerop6"() : () -> ()
52// CHECK:             visiting op: 'dialect.innerop7' with 0 operands and 0 results
53// CHECK:              0 nested regions:
54    "dialect.innerop7"() : () -> ()
55  }) {"other attribute" = 42 : i64} : () -> ()
56}) : () -> ()
57