xref: /llvm-project/mlir/test/IR/print-op-custom-or-generic.mlir (revision 2cdd246a39076379b1678782f99872f918fa358c)
1// # RUN: mlir-opt %s -split-input-file | FileCheck %s
2// # RUN: mlir-opt %s -mlir-print-op-generic -split-input-file  | FileCheck %s --check-prefix=GENERIC
3
4// Check that `printCustomOrGenericOp` and `printGenericOp` print the right
5// assembly format. For operations without custom format, both should print the
6// generic format.
7
8// CHECK-LABEL: func @op_with_custom_printer
9// CHECK-GENERIC-LABEL: "func"()
10func.func @op_with_custom_printer() {
11  %x = test.string_attr_pretty_name
12  // CHECK: %x = test.string_attr_pretty_name
13  // GENERIC: %0 = "test.string_attr_pretty_name"()
14  return
15  // CHECK: return
16  // GENERIC: "func.return"()
17}
18
19// -----
20
21// CHECK-LABEL: func @op_without_custom_printer
22// CHECK-GENERIC: "func"()
23func.func @op_without_custom_printer() {
24  // CHECK: "test.result_type_with_trait"() : () -> !test.test_type_with_trait
25  // GENERIC: "test.result_type_with_trait"() : () -> !test.test_type_with_trait
26  "test.result_type_with_trait"() : () -> !test.test_type_with_trait
27  return
28}
29