1 // RUN: mlir-opt -allow-unregistered-dialect -split-input-file %s | FileCheck %s --check-prefixes=CHECK-CUSTOM,CHECK
2 // RUN: mlir-opt -allow-unregistered-dialect -mlir-print-op-generic -split-input-file %s | FileCheck %s --check-prefixes=CHECK,CHECK-GENERIC
3 // RUN: mlir-opt -allow-unregistered-dialect -split-input-file --mlir-print-op-generic --mlir-print-debuginfo -mlir-print-local-scope %s | FileCheck %s --check-prefixes=CHECK-LOCATION
7 func.func @pretty_printed_region_op(%arg0 : f32, %arg1 : f32) -> (f32) {
8 // CHECK-CUSTOM: test.pretty_printed_region %arg1, %arg0 start test.special.op end : (f32, f32) -> f32
9 // CHECK-GENERIC: "test.pretty_printed_region"(%arg1, %arg0)
10 // CHECK-GENERIC: ^bb0(%arg[[x:[0-9]+]]: f32, %arg[[y:[0-9]+]]: f32
11 // CHECK-GENERIC: %[[RES:.*]] = "test.special.op"(%arg[[x]], %arg[[y]]) : (f32, f32) -> f32
12 // CHECK-GENERIC: "test.return"(%[[RES]]) : (f32) -> ()
13 // CHECK-GENERIC: : (f32, f32) -> f32
15 %res = test.pretty_printed_region %arg1, %arg0 start test.special.op end : (f32, f32) -> (f32) loc("some_NameLoc")
21 func.func @pretty_printed_region_op(%arg0 : f32, %arg1 : f32) -> (f32) {
22 // CHECK-CUSTOM: test.pretty_printed_region %arg1, %arg0
23 // CHECK-GENERIC: "test.pretty_printed_region"(%arg1, %arg0)
24 // CHECK: ^bb0(%arg[[x:[0-9]+]]: f32, %arg[[y:[0-9]+]]: f32):
25 // CHECK: %[[RES:.*]] = "test.non.special.op"(%arg[[x]], %arg[[y]]) : (f32, f32) -> f32
26 // CHECK: "test.return"(%[[RES]]) : (f32) -> ()
27 // CHECK: : (f32, f32) -> f32
29 %0 = test.pretty_printed_region %arg1, %arg0 ({
30 ^bb0(%arg2: f32, %arg3: f32):
31 %1 = "test.non.special.op"(%arg2, %arg3) : (f32, f32) -> f32
32 "test.return"(%1) : (f32) -> ()
33 }) : (f32, f32) -> f32
39 func.func @pretty_printed_region_op_deferred_loc(%arg0 : f32, %arg1 : f32) -> (f32) {
40 // CHECK-LOCATION: "test.pretty_printed_region"(%arg1, %arg0)
41 // CHECK-LOCATION: ^bb0(%arg[[x:[0-9]+]]: f32 loc("foo"), %arg[[y:[0-9]+]]: f32 loc("foo")
42 // CHECK-LOCATION: %[[RES:.*]] = "test.special.op"(%arg[[x]], %arg[[y]]) : (f32, f32) -> f32
43 // CHECK-LOCATION: "test.return"(%[[RES]]) : (f32) -> ()
44 // CHECK-LOCATION: : (f32, f32) -> f32
46 %res = test.pretty_printed_region %arg1, %arg0 start test.special.op end : (f32, f32) -> (f32) loc("foo")
52 // This tests the behavior of custom block names:
53 // operations like `test.block_names` can define custom names for blocks in
55 // CHECK-CUSTOM-LABEL: func @block_names
56 func.func @block_names(%bool : i1) {
57 // CHECK: test.block_names
59 // CHECK-CUSTOM: br ^foo1
60 // CHECK-GENERIC: cf.br{{.*}}^bb1
62 // CHECK-CUSTOM: ^foo1:
63 // CHECK-GENERIC: ^bb1:
65 // CHECK-CUSTOM: br ^foo2
66 // CHECK-GENERIC: cf.br{{.*}}^bb2
68 // CHECK-CUSTOM: ^foo2:
69 // CHECK-GENERIC: ^bb2:
71 "test.return"() : () -> ()