1 // RUN: mlir-opt --pass-pipeline="builtin.module(test-lazy-loading)" %s -o %t | FileCheck %s
2 // RUN: mlir-opt --pass-pipeline="builtin.module(test-lazy-loading{bytecode-version=1})" %s -o %t | FileCheck %s --check-prefix=OLD-BYTECODE
5 func.func @op_with_passthrough_region_args() {
6 %0 = arith.constant 10 : index
8 // Ensure we can handle nested non-isolated/non-lazy regions.
9 "test.one_region_op"() ({
10 "test.consumer"(%0) : (index) -> ()
13 test.isolated_region %0 {
14 "test.consumer"(%0) : (index) -> ()
16 %result:2 = "test.op"() : () -> (index, index)
17 test.isolated_region %result#1 {
18 "test.consumer"(%result#1) : (index) -> ()
21 test.isolated_regions {
22 "test.unknown_op"() : () -> ()
24 "test.unknown_op"() : () -> ()
27 // Ensure operations that aren't tagged as IsolatedFromAbove can
28 // still be lazy loaded if they don't have references to values
30 "test.one_region_op"() ({
31 "test.unknown_op"() : () -> ()
34 // Similar test as above, but check that if one region has a reference
35 // to a value defined above, we don't lazy load the operation.
36 "test.two_region_op"() ({
37 "test.unknown_op"() : () -> ()
39 "test.consumer"(%0) : (index) -> ()
44 // Before version 2, we can't support lazy loading.
45 // OLD-BYTECODE-NOT: Has 1 ops to materialize
46 // OLD-BYTECODE-NOT: Materializing
47 // OLD-BYTECODE: Has 0 ops to materialize
50 // CHECK: Has 1 ops to materialize
52 // CHECK: Before Materializing...
53 // CHECK: "builtin.module"() ({
55 // CHECK: Materializing...
56 // CHECK: "builtin.module"() ({
57 // CHECK: "func.func"() <{function_type = () -> (), sym_name = "op_with_passthrough_region_args"}> ({
59 // CHECK: Has 1 ops to materialize
61 // CHECK: Before Materializing...
62 // CHECK: "func.func"() <{function_type = () -> (), sym_name = "op_with_passthrough_region_args"}> ({
64 // CHECK: Materializing...
65 // CHECK: "func.func"() <{function_type = () -> (), sym_name = "op_with_passthrough_region_args"}> ({
67 // CHECK: one_region_op
68 // CHECK: test.consumer
69 // CHECK: isolated_region
70 // CHECK-NOT: test.consumer
71 // CHECK: test.one_region_op
73 // CHECK: test.two_region_op
74 // CHECK: test.unknown_op
75 // CHECK: test.consumer
76 // CHECK: Has 4 ops to materialize
78 // CHECK: Before Materializing...
79 // CHECK: test.isolated_region
80 // CHECK-NOT: test.consumer
81 // CHECK: Materializing...
82 // CHECK: test.isolated_region
83 // CHECK: ^bb0(%arg0: index):
84 // CHECK: test.consumer
85 // CHECK: Has 3 ops to materialize
87 // CHECK: Before Materializing...
88 // CHECK: test.isolated_region
89 // CHECK-NOT: test.consumer
90 // CHECK: Materializing...
91 // CHECK: test.isolated_region
92 // CHECK: test.consumer
93 // CHECK: Has 2 ops to materialize
95 // CHECK: Before Materializing...
96 // CHECK: test.isolated_regions
97 // CHECK-NOT: test.unknown_op
98 // CHECK: Materializing...
99 // CHECK: test.isolated_regions
100 // CHECK: test.unknown_op
101 // CHECK: test.unknown_op
102 // CHECK: Has 1 ops to materialize
104 // CHECK: Before Materializing...
105 // CHECK: test.one_region_op
106 // CHECK-NOT: test.unknown_op
107 // CHECK: Materializing...
108 // CHECK: test.one_region_op
109 // CHECK: test.unknown_op
110 // CHECK: Has 0 ops to materialize