[Mlir-commits] [mlir] [mlir] Add dialect hooks for registering custom type and attribute alias printers (PR #173091)

Fabian Mora llvmlistbot at llvm.org
Mon Dec 22 08:28:25 PST 2025


================
@@ -0,0 +1,14 @@
+// RUN: mlir-opt %s | FileCheck %s
+
+// Check that attr and type aliases are properly printed.
+
+// CHECK: {types = [!test.tuple_i7_from_attr, !test.tuple_i6_from_attr, tuple<!test.int<signed, 5>>]} : () -> (!test.tuple_i7, !test.tuple_i6, tuple<!test.int<signed, 5>>)
+"test.op"() {types = [
----------------
fabianmcg wrote:

No. To avoid further confusion, take the following input:
```mlir
// Input
"test.op"() {types = [
    tuple<!test.int<s, 7>>,
    tuple<!test.int<s, 6>>,
    tuple<!test.int<s, 5>>
  ]} : () -> (
    tuple<!test.int<s, 7>>,
    tuple<!test.int<s, 6>>,
    tuple<!test.int<s, 5>>
  )

// Full output of: `mlir-opt`
module {
  %0:3 = "test.op"() {types = [!test.tuple_i7_from_attr, !test.tuple_i6_from_attr, tuple<!test.int<signed, 5>>]} : () -> (!test.tuple_i7, !test.tuple_i6, tuple<!test.int<signed, 5>>)
}

// Full output of: `mlir-opt --mlir-disable-dialect-aliases`
module {
  %0:3 = "test.op"() {types = [tuple<!test.int<signed, 7>>, tuple<!test.int<signed, 6>>, tuple<!test.int<signed, 5>>]} : () -> (tuple<!test.int<signed, 7>>, tuple<!test.int<signed, 6>>, tuple<!test.int<signed, 5>>)
}
```

https://github.com/llvm/llvm-project/pull/173091


More information about the Mlir-commits mailing list