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 3 4 5func.func @op_with_passthrough_region_args() { 6 %0 = arith.constant 10 : index 7 8 // Ensure we can handle nested non-isolated/non-lazy regions. 9 "test.one_region_op"() ({ 10 "test.consumer"(%0) : (index) -> () 11 }) : () -> () 12 13 test.isolated_region %0 { 14 "test.consumer"(%0) : (index) -> () 15 } 16 %result:2 = "test.op"() : () -> (index, index) 17 test.isolated_region %result#1 { 18 "test.consumer"(%result#1) : (index) -> () 19 } 20 21 test.isolated_regions { 22 "test.unknown_op"() : () -> () 23 }, { 24 "test.unknown_op"() : () -> () 25 } 26 27 // Ensure operations that aren't tagged as IsolatedFromAbove can 28 // still be lazy loaded if they don't have references to values 29 // defined above. 30 "test.one_region_op"() ({ 31 "test.unknown_op"() : () -> () 32 }) : () -> () 33 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"() : () -> () 38 }, { 39 "test.consumer"(%0) : (index) -> () 40 }) : () -> () 41 return 42} 43 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 48 49 50// CHECK: Has 1 ops to materialize 51 52// CHECK: Before Materializing... 53// CHECK: "builtin.module"() ({ 54// CHECK-NOT: func 55// CHECK: Materializing... 56// CHECK: "builtin.module"() ({ 57// CHECK: "func.func"() <{function_type = () -> (), sym_name = "op_with_passthrough_region_args"}> ({ 58// CHECK-NOT: arith 59// CHECK: Has 1 ops to materialize 60 61// CHECK: Before Materializing... 62// CHECK: "func.func"() <{function_type = () -> (), sym_name = "op_with_passthrough_region_args"}> ({ 63// CHECK-NOT: arith 64// CHECK: Materializing... 65// CHECK: "func.func"() <{function_type = () -> (), sym_name = "op_with_passthrough_region_args"}> ({ 66// CHECK: arith 67// CHECK: one_region_op 68// CHECK: test.consumer 69// CHECK: isolated_region 70// CHECK-NOT: test.consumer 71// CHECK: test.one_region_op 72// CHECK-NOT: test.op 73// CHECK: test.two_region_op 74// CHECK: test.unknown_op 75// CHECK: test.consumer 76// CHECK: Has 4 ops to materialize 77 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 86 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 94 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 103 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 111