1 // RUN: mlir-opt %s -test-recursive-types | FileCheck %s
3 // CHECK: !testrec = !test.test_rec<type_to_alias, test_rec<type_to_alias>>
4 // CHECK: ![[$NAME:.*]] = !test.test_rec_alias<name, !test.test_rec_alias<name>>
5 // CHECK: ![[$NAME5:.*]] = !test.test_rec_alias<name5, !test.test_rec_alias<name3, !test.test_rec_alias<name4, !test.test_rec_alias<name5>>>>
6 // CHECK: ![[$NAME2:.*]] = !test.test_rec_alias<name2, tuple<!test.test_rec_alias<name2>, i32>>
7 // CHECK: ![[$NAME4:.*]] = !test.test_rec_alias<name4, !name5_>
8 // CHECK: ![[$NAME3:.*]] = !test.test_rec_alias<name3, !name4_>
10 // CHECK-LABEL: @roundtrip
11 func.func @roundtrip() {
12 // CHECK: !test.test_rec<a, test_rec<b, test_type>>
13 "test.dummy_op_for_roundtrip"() : () -> !test.test_rec<a, test_rec<b, test_type>>
14 // CHECK: !test.test_rec<c, test_rec<c>>
15 "test.dummy_op_for_roundtrip"() : () -> !test.test_rec<c, test_rec<c>>
16 // Make sure walkSubElementType, which is used to generate aliases, doesn't go
17 // into inifinite recursion.
19 "test.dummy_op_for_roundtrip"() : () -> !test.test_rec<type_to_alias, test_rec<type_to_alias>>
21 // CHECK: () -> ![[$NAME]]
22 // CHECK: () -> ![[$NAME]]
23 "test.dummy_op_for_roundtrip"() : () -> !test.test_rec_alias<name, !test.test_rec_alias<name>>
24 "test.dummy_op_for_roundtrip"() : () -> !test.test_rec_alias<name, !test.test_rec_alias<name>>
26 // CHECK: () -> ![[$NAME2]]
27 // CHECK: () -> ![[$NAME2]]
28 "test.dummy_op_for_roundtrip"() : () -> !test.test_rec_alias<name2, tuple<!test.test_rec_alias<name2>, i32>>
29 "test.dummy_op_for_roundtrip"() : () -> !test.test_rec_alias<name2, tuple<!test.test_rec_alias<name2>, i32>>
32 // CHECK: () -> ![[$NAME3]]
33 // CHECK: () -> ![[$NAME4]]
34 // CHECK: () -> ![[$NAME5]]
35 "test.dummy_op_for_roundtrip"() : () -> !test.test_rec_alias<name3, !test.test_rec_alias<name4, !test.test_rec_alias<name5, !test.test_rec_alias<name3>>>>
36 "test.dummy_op_for_roundtrip"() : () -> !test.test_rec_alias<name4, !test.test_rec_alias<name5, !test.test_rec_alias<name3, !test.test_rec_alias<name4>>>>
37 "test.dummy_op_for_roundtrip"() : () -> !test.test_rec_alias<name5, !test.test_rec_alias<name3, !test.test_rec_alias<name4, !test.test_rec_alias<name5>>>>
41 // CHECK-LABEL: @create
43 // CHECK: !test.test_rec<some_long_and_unique_name, test_rec<some_long_and_unique_name>>