36 changes: 18 additions & 18 deletions mlir/test/Transforms/loop-invariant-code-motion.mlir
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: mlir-opt %s -split-input-file -loop-invariant-code-motion | FileCheck %s

func @nested_loops_both_having_invariant_code() {
func.func @nested_loops_both_having_invariant_code() {
%m = memref.alloc() : memref<10xf32>
%cf7 = arith.constant 7.0 : f32
%cf8 = arith.constant 8.0 : f32
Expand All @@ -27,7 +27,7 @@ func @nested_loops_both_having_invariant_code() {

// -----

func @nested_loops_code_invariant_to_both() {
func.func @nested_loops_code_invariant_to_both() {
%m = memref.alloc() : memref<10xf32>
%cf7 = arith.constant 7.0 : f32
%cf8 = arith.constant 8.0 : f32
Expand All @@ -48,7 +48,7 @@ func @nested_loops_code_invariant_to_both() {

// -----

func @single_loop_nothing_invariant() {
func.func @single_loop_nothing_invariant() {
%m1 = memref.alloc() : memref<10xf32>
%m2 = memref.alloc() : memref<10xf32>
affine.for %arg0 = 0 to 10 {
Expand All @@ -71,7 +71,7 @@ func @single_loop_nothing_invariant() {

// -----

func @invariant_code_inside_affine_if() {
func.func @invariant_code_inside_affine_if() {
%m = memref.alloc() : memref<10xf32>
%cf8 = arith.constant 8.0 : f32

Expand Down Expand Up @@ -99,7 +99,7 @@ func @invariant_code_inside_affine_if() {

// -----

func @invariant_affine_if() {
func.func @invariant_affine_if() {
%m = memref.alloc() : memref<10xf32>
%cf8 = arith.constant 8.0 : f32
affine.for %arg0 = 0 to 10 {
Expand All @@ -124,7 +124,7 @@ func @invariant_affine_if() {

// -----

func @invariant_affine_if2() {
func.func @invariant_affine_if2() {
%m = memref.alloc() : memref<10xf32>
%cf8 = arith.constant 8.0 : f32
affine.for %arg0 = 0 to 10 {
Expand All @@ -151,7 +151,7 @@ func @invariant_affine_if2() {

// -----

func @invariant_affine_nested_if() {
func.func @invariant_affine_nested_if() {
%m = memref.alloc() : memref<10xf32>
%cf8 = arith.constant 8.0 : f32
affine.for %arg0 = 0 to 10 {
Expand Down Expand Up @@ -183,7 +183,7 @@ func @invariant_affine_nested_if() {

// -----

func @invariant_affine_nested_if_else() {
func.func @invariant_affine_nested_if_else() {
%m = memref.alloc() : memref<10xf32>
%cf8 = arith.constant 8.0 : f32
affine.for %arg0 = 0 to 10 {
Expand Down Expand Up @@ -221,7 +221,7 @@ func @invariant_affine_nested_if_else() {

// -----

func @invariant_loop_dialect() {
func.func @invariant_loop_dialect() {
%ci0 = arith.constant 0 : index
%ci10 = arith.constant 10 : index
%ci1 = arith.constant 1 : index
Expand All @@ -244,7 +244,7 @@ func @invariant_loop_dialect() {

// -----

func @variant_loop_dialect() {
func.func @variant_loop_dialect() {
%ci0 = arith.constant 0 : index
%ci10 = arith.constant 10 : index
%ci1 = arith.constant 1 : index
Expand All @@ -265,7 +265,7 @@ func @variant_loop_dialect() {

// -----

func @parallel_loop_with_invariant() {
func.func @parallel_loop_with_invariant() {
%c0 = arith.constant 0 : index
%c10 = arith.constant 10 : index
%c1 = arith.constant 1 : index
Expand Down Expand Up @@ -294,10 +294,10 @@ func @parallel_loop_with_invariant() {

// -----

func private @make_val() -> (index)
func.func private @make_val() -> (index)

// CHECK-LABEL: func @nested_uses_inside
func @nested_uses_inside(%lb: index, %ub: index, %step: index) {
func.func @nested_uses_inside(%lb: index, %ub: index, %step: index) {
%true = arith.constant true

// Check that ops that contain nested uses to values not defiend outside
Expand Down Expand Up @@ -328,7 +328,7 @@ func @nested_uses_inside(%lb: index, %ub: index, %step: index) {
// dominance in non-graph regions.
// CHECK-LABEL: func @invariant_subgraph
// CHECK-SAME: %{{.*}}: index, %{{.*}}: index, %{{.*}}: index, %[[ARG:.*]]: i32
func @invariant_subgraph(%lb: index, %ub: index, %step: index, %arg: i32) {
func.func @invariant_subgraph(%lb: index, %ub: index, %step: index, %arg: i32) {
// CHECK: %[[V0:.*]] = arith.addi %[[ARG]], %[[ARG]]
// CHECK-NEXT: %[[V1:.*]] = arith.addi %[[ARG]], %[[V0]]
// CHECK-NEXT: scf.for
Expand All @@ -345,7 +345,7 @@ func @invariant_subgraph(%lb: index, %ub: index, %step: index, %arg: i32) {

// Test invariant nested loop is hoisted.
// CHECK-LABEL: func @test_invariant_nested_loop
func @test_invariant_nested_loop() {
func.func @test_invariant_nested_loop() {
// CHECK: %[[C:.*]] = arith.constant
%0 = arith.constant 5 : i32
// CHECK: %[[V0:.*]] = arith.addi %[[C]], %[[C]]
Expand Down Expand Up @@ -374,7 +374,7 @@ func @test_invariant_nested_loop() {

// Test ops in a graph region are hoisted.
// CHECK-LABEL: func @test_invariants_in_graph_region
func @test_invariants_in_graph_region() {
func.func @test_invariants_in_graph_region() {
// CHECK: test.single_no_terminator_op
test.single_no_terminator_op : {
// CHECK-NEXT: %[[C:.*]] = arith.constant
Expand All @@ -395,7 +395,7 @@ func @test_invariants_in_graph_region() {
// Test ops in a graph region are hoisted in topological order into non-graph
// regions and that dominance is preserved.
// CHECK-LABEL: func @test_invariant_backedge
func @test_invariant_backedge() {
func.func @test_invariant_backedge() {
// CHECK-NEXT: %[[C:.*]] = arith.constant
// CHECK-NEXT: %[[V1:.*]] = arith.addi %[[C]], %[[C]]
// CHECK-NEXT: %[[V0:.*]] = arith.addi %[[C]], %[[V1]]
Expand All @@ -414,7 +414,7 @@ func @test_invariant_backedge() {

// Test that cycles aren't hoisted from graph regions to non-graph regions.
// CHECK-LABEL: func @test_invariant_cycle_not_hoisted
func @test_invariant_cycle_not_hoisted() {
func.func @test_invariant_cycle_not_hoisted() {
// CHECK: test.graph_loop
test.graph_loop {
// CHECK-NEXT: %[[A:.*]] = "test.a"(%[[B:.*]]) :
Expand Down
30 changes: 15 additions & 15 deletions mlir/test/Transforms/memref-bound-check.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// -----

// CHECK-LABEL: func @test() {
func @test() {
func.func @test() {
%zero = arith.constant 0 : index
%minusone = arith.constant -1 : index
%sym = arith.constant 111 : index
Expand Down Expand Up @@ -39,7 +39,7 @@ func @test() {
}

// CHECK-LABEL: func @test_mod_floordiv_ceildiv
func @test_mod_floordiv_ceildiv() {
func.func @test_mod_floordiv_ceildiv() {
%zero = arith.constant 0 : index
%A = memref.alloc() : memref<128 x 64 x 64 x i32>

Expand All @@ -62,7 +62,7 @@ func @test_mod_floordiv_ceildiv() {
}

// CHECK-LABEL: func @test_no_out_of_bounds()
func @test_no_out_of_bounds() {
func.func @test_no_out_of_bounds() {
%zero = arith.constant 0 : index
%A = memref.alloc() : memref<257 x 256 x i32>
%C = memref.alloc() : memref<257 x i32>
Expand All @@ -88,7 +88,7 @@ func @test_no_out_of_bounds() {
}

// CHECK-LABEL: func @mod_div
func @mod_div() {
func.func @mod_div() {
%zero = arith.constant 0 : index
%A = memref.alloc() : memref<128 x 64 x 64 x i32>

Expand All @@ -112,7 +112,7 @@ func @mod_div() {

// Tests with nested mod's and floordiv's.
// CHECK-LABEL: func @mod_floordiv_nested() {
func @mod_floordiv_nested() {
func.func @mod_floordiv_nested() {
%A = memref.alloc() : memref<256 x 256 x i32>
affine.for %i = 0 to 256 {
affine.for %j = 0 to 256 {
Expand All @@ -125,7 +125,7 @@ func @mod_floordiv_nested() {
}

// CHECK-LABEL: func @test_semi_affine_bailout
func @test_semi_affine_bailout(%N : index) {
func.func @test_semi_affine_bailout(%N : index) {
%B = memref.alloc() : memref<10 x i32>
affine.for %i = 0 to 10 {
%idx = affine.apply affine_map<(d0)[s0] -> (d0 * s0)>(%i)[%N]
Expand All @@ -136,7 +136,7 @@ func @test_semi_affine_bailout(%N : index) {
}

// CHECK-LABEL: func @multi_mod_floordiv
func @multi_mod_floordiv() {
func.func @multi_mod_floordiv() {
%A = memref.alloc() : memref<2x2xi32>
affine.for %ii = 0 to 64 {
%idx0 = affine.apply affine_map<(d0) -> ((d0 mod 147456) floordiv 1152)> (%ii)
Expand All @@ -147,7 +147,7 @@ func @multi_mod_floordiv() {
}

// CHECK-LABEL: func @delinearize_mod_floordiv
func @delinearize_mod_floordiv() {
func.func @delinearize_mod_floordiv() {
%c0 = arith.constant 0 : index
%in = memref.alloc() : memref<2x2x3x3x16x1xi32>
%out = memref.alloc() : memref<64x9xi32>
Expand Down Expand Up @@ -177,15 +177,15 @@ func @delinearize_mod_floordiv() {
}

// CHECK-LABEL: func @zero_d_memref
func @zero_d_memref(%arg0: memref<i32>) {
func.func @zero_d_memref(%arg0: memref<i32>) {
%c0 = arith.constant 0 : i32
// A 0-d memref always has in-bound accesses!
affine.store %c0, %arg0[] : memref<i32>
return
}

// CHECK-LABEL: func @out_of_bounds
func @out_of_bounds() {
func.func @out_of_bounds() {
%in = memref.alloc() : memref<1xi32>
%c9 = arith.constant 9 : i32

Expand All @@ -206,7 +206,7 @@ func @out_of_bounds() {
#map4 = affine_map<(d0, d1) -> ((d0 * 72 + d1) mod 2304 - (((d0 * 72 + d1) mod 2304) floordiv 1152) * 1151 - ((((d0 * 72 + d1) mod 2304) mod 1152) floordiv 9) * 9 - (((((d0 * 72 + d1) mod 2304) mod 1152) mod 9) floordiv 3) * 3)>
#map5 = affine_map<(d0, d1) -> (((((d0 * 72 + d1) mod 2304) mod 1152) floordiv 9) floordiv 8)>
// CHECK-LABEL: func @test_complex_mod_floordiv
func @test_complex_mod_floordiv(%arg0: memref<4x4x16x1xf32>) {
func.func @test_complex_mod_floordiv(%arg0: memref<4x4x16x1xf32>) {
%c0 = arith.constant 0 : index
%0 = memref.alloc() : memref<1x2x3x3x16x1xf32>
affine.for %i0 = 0 to 64 {
Expand All @@ -227,7 +227,7 @@ func @test_complex_mod_floordiv(%arg0: memref<4x4x16x1xf32>) {
#map1 = affine_map<(d0) -> (d0 mod 4 + 4)>

// CHECK-LABEL: func @test_mod_bound
func @test_mod_bound() {
func.func @test_mod_bound() {
%0 = memref.alloc() : memref<7 x f32>
%1 = memref.alloc() : memref<6 x f32>
affine.for %i0 = 0 to 4096 {
Expand All @@ -247,7 +247,7 @@ func @test_mod_bound() {
#map2 = affine_map<(d0) -> (4 * (d0 floordiv 4) + d0 mod 4)>

// CHECK-LABEL: func @test_floordiv_bound
func @test_floordiv_bound() {
func.func @test_floordiv_bound() {
%0 = memref.alloc() : memref<1027 x f32>
%1 = memref.alloc() : memref<1026 x f32>
%2 = memref.alloc() : memref<4096 x f32>
Expand Down Expand Up @@ -275,7 +275,7 @@ func @test_floordiv_bound() {
#map_ub = affine_map<(d0) -> (d0 + 4)>

// CHECK-LABEL: func @non_composed_bound_operand
func @non_composed_bound_operand(%arg0: memref<1024xf32>) {
func.func @non_composed_bound_operand(%arg0: memref<1024xf32>) {
affine.for %i0 = 4 to 1028 step 4 {
%i1 = affine.apply affine_map<(d0) -> (d0 - 4)> (%i0)
affine.for %i2 = #map_lb(%i1) to #map_ub(%i1) {
Expand All @@ -286,7 +286,7 @@ func @non_composed_bound_operand(%arg0: memref<1024xf32>) {
}

// CHECK-LABEL: func @zero_d_memref
func @zero_d_memref() {
func.func @zero_d_memref() {
%Z = memref.alloc() : memref<f32>
affine.for %i = 0 to 100 {
affine.load %Z[] : memref<f32>
Expand Down
82 changes: 41 additions & 41 deletions mlir/test/Transforms/memref-dependence-check.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#set0 = affine_set<(d0) : (1 == 0)>

// CHECK-LABEL: func @store_may_execute_before_load() {
func @store_may_execute_before_load() {
func.func @store_may_execute_before_load() {
%m = memref.alloc() : memref<10xf32>
%cf7 = arith.constant 7.0 : f32
%c0 = arith.constant 4 : index
Expand All @@ -32,7 +32,7 @@ func @store_may_execute_before_load() {
// -----

// CHECK-LABEL: func @dependent_loops() {
func @dependent_loops() {
func.func @dependent_loops() {
%0 = memref.alloc() : memref<10xf32>
%cst = arith.constant 7.000000e+00 : f32
// There is a dependence from 0 to 1 at depth 1 (common surrounding loops 0)
Expand All @@ -54,7 +54,7 @@ func @dependent_loops() {

// -----
// CHECK-LABEL: func @different_memrefs() {
func @different_memrefs() {
func.func @different_memrefs() {
%m.a = memref.alloc() : memref<100xf32>
%m.b = memref.alloc() : memref<100xf32>
%c0 = arith.constant 0 : index
Expand All @@ -70,7 +70,7 @@ func @different_memrefs() {

// -----
// CHECK-LABEL: func @store_load_different_elements() {
func @store_load_different_elements() {
func.func @store_load_different_elements() {
%m = memref.alloc() : memref<100xf32>
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
Expand All @@ -86,7 +86,7 @@ func @store_load_different_elements() {

// -----
// CHECK-LABEL: func @load_store_different_elements() {
func @load_store_different_elements() {
func.func @load_store_different_elements() {
%m = memref.alloc() : memref<100xf32>
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
Expand All @@ -102,7 +102,7 @@ func @load_store_different_elements() {

// -----
// CHECK-LABEL: func @store_load_same_element() {
func @store_load_same_element() {
func.func @store_load_same_element() {
%m = memref.alloc() : memref<100xf32>
%c11 = arith.constant 11 : index
%c7 = arith.constant 7.0 : f32
Expand All @@ -117,7 +117,7 @@ func @store_load_same_element() {

// -----
// CHECK-LABEL: func @load_load_same_element() {
func @load_load_same_element() {
func.func @load_load_same_element() {
%m = memref.alloc() : memref<100xf32>
%c11 = arith.constant 11 : index
%c7 = arith.constant 7.0 : f32
Expand All @@ -132,7 +132,7 @@ func @load_load_same_element() {

// -----
// CHECK-LABEL: func @store_load_same_symbol(%arg0: index) {
func @store_load_same_symbol(%arg0: index) {
func.func @store_load_same_symbol(%arg0: index) {
%m = memref.alloc() : memref<100xf32>
%c7 = arith.constant 7.0 : f32
affine.store %c7, %m[%arg0] : memref<100xf32>
Expand All @@ -146,7 +146,7 @@ func @store_load_same_symbol(%arg0: index) {

// -----
// CHECK-LABEL: func @store_load_different_symbols(%arg0: index, %arg1: index) {
func @store_load_different_symbols(%arg0: index, %arg1: index) {
func.func @store_load_different_symbols(%arg0: index, %arg1: index) {
%m = memref.alloc() : memref<100xf32>
%c7 = arith.constant 7.0 : f32
affine.store %c7, %m[%arg0] : memref<100xf32>
Expand All @@ -160,7 +160,7 @@ func @store_load_different_symbols(%arg0: index, %arg1: index) {

// -----
// CHECK-LABEL: func @store_load_diff_element_affine_apply_const() {
func @store_load_diff_element_affine_apply_const() {
func.func @store_load_diff_element_affine_apply_const() {
%m = memref.alloc() : memref<100xf32>
%c1 = arith.constant 1 : index
%c8 = arith.constant 8.0 : f32
Expand All @@ -177,7 +177,7 @@ func @store_load_diff_element_affine_apply_const() {

// -----
// CHECK-LABEL: func @store_load_same_element_affine_apply_const() {
func @store_load_same_element_affine_apply_const() {
func.func @store_load_same_element_affine_apply_const() {
%m = memref.alloc() : memref<100xf32>
%c7 = arith.constant 7.0 : f32
%c9 = arith.constant 9 : index
Expand All @@ -195,7 +195,7 @@ func @store_load_same_element_affine_apply_const() {

// -----
// CHECK-LABEL: func @store_load_affine_apply_symbol(%arg0: index) {
func @store_load_affine_apply_symbol(%arg0: index) {
func.func @store_load_affine_apply_symbol(%arg0: index) {
%m = memref.alloc() : memref<100xf32>
%c7 = arith.constant 7.0 : f32
%a0 = affine.apply affine_map<(d0) -> (d0)> (%arg0)
Expand All @@ -211,7 +211,7 @@ func @store_load_affine_apply_symbol(%arg0: index) {

// -----
// CHECK-LABEL: func @store_load_affine_apply_symbol_offset(%arg0: index) {
func @store_load_affine_apply_symbol_offset(%arg0: index) {
func.func @store_load_affine_apply_symbol_offset(%arg0: index) {
%m = memref.alloc() : memref<100xf32>
%c7 = arith.constant 7.0 : f32
%a0 = affine.apply affine_map<(d0) -> (d0)> (%arg0)
Expand All @@ -227,7 +227,7 @@ func @store_load_affine_apply_symbol_offset(%arg0: index) {

// -----
// CHECK-LABEL: func @store_range_load_after_range() {
func @store_range_load_after_range() {
func.func @store_range_load_after_range() {
%m = memref.alloc() : memref<100xf32>
%c7 = arith.constant 7.0 : f32
%c10 = arith.constant 10 : index
Expand All @@ -250,7 +250,7 @@ func @store_range_load_after_range() {

// -----
// CHECK-LABEL: func @store_load_func_symbol(%arg0: index, %arg1: index) {
func @store_load_func_symbol(%arg0: index, %arg1: index) {
func.func @store_load_func_symbol(%arg0: index, %arg1: index) {
%m = memref.alloc() : memref<100xf32>
%c7 = arith.constant 7.0 : f32
%c10 = arith.constant 10 : index
Expand All @@ -273,7 +273,7 @@ func @store_load_func_symbol(%arg0: index, %arg1: index) {

// -----
// CHECK-LABEL: func @store_range_load_last_in_range() {
func @store_range_load_last_in_range() {
func.func @store_range_load_last_in_range() {
%m = memref.alloc() : memref<100xf32>
%c7 = arith.constant 7.0 : f32
%c10 = arith.constant 10 : index
Expand Down Expand Up @@ -301,7 +301,7 @@ func @store_range_load_last_in_range() {

// -----
// CHECK-LABEL: func @store_range_load_before_range() {
func @store_range_load_before_range() {
func.func @store_range_load_before_range() {
%m = memref.alloc() : memref<100xf32>
%c7 = arith.constant 7.0 : f32
%c0 = arith.constant 0 : index
Expand All @@ -324,7 +324,7 @@ func @store_range_load_before_range() {

// -----
// CHECK-LABEL: func @store_range_load_first_in_range() {
func @store_range_load_first_in_range() {
func.func @store_range_load_first_in_range() {
%m = memref.alloc() : memref<100xf32>
%c7 = arith.constant 7.0 : f32
%c0 = arith.constant 0 : index
Expand All @@ -350,7 +350,7 @@ func @store_range_load_first_in_range() {

// -----
// CHECK-LABEL: func @store_plus_3() {
func @store_plus_3() {
func.func @store_plus_3() {
%m = memref.alloc() : memref<100xf32>
%c7 = arith.constant 7.0 : f32
affine.for %i0 = 1 to 11 {
Expand All @@ -372,7 +372,7 @@ func @store_plus_3() {

// -----
// CHECK-LABEL: func @load_minus_2() {
func @load_minus_2() {
func.func @load_minus_2() {
%m = memref.alloc() : memref<100xf32>
%c7 = arith.constant 7.0 : f32
affine.for %i0 = 2 to 11 {
Expand All @@ -394,7 +394,7 @@ func @load_minus_2() {

// -----
// CHECK-LABEL: func @perfectly_nested_loops_loop_independent() {
func @perfectly_nested_loops_loop_independent() {
func.func @perfectly_nested_loops_loop_independent() {
%m = memref.alloc() : memref<10x10xf32>
%c7 = arith.constant 7.0 : f32
affine.for %i0 = 0 to 11 {
Expand Down Expand Up @@ -425,7 +425,7 @@ func @perfectly_nested_loops_loop_independent() {

// -----
// CHECK-LABEL: func @perfectly_nested_loops_loop_carried_at_depth1() {
func @perfectly_nested_loops_loop_carried_at_depth1() {
func.func @perfectly_nested_loops_loop_carried_at_depth1() {
%m = memref.alloc() : memref<10x10xf32>
%c7 = arith.constant 7.0 : f32
affine.for %i0 = 0 to 9 {
Expand Down Expand Up @@ -456,7 +456,7 @@ func @perfectly_nested_loops_loop_carried_at_depth1() {

// -----
// CHECK-LABEL: func @perfectly_nested_loops_loop_carried_at_depth2() {
func @perfectly_nested_loops_loop_carried_at_depth2() {
func.func @perfectly_nested_loops_loop_carried_at_depth2() {
%m = memref.alloc() : memref<10x10xf32>
%c7 = arith.constant 7.0 : f32
affine.for %i0 = 0 to 10 {
Expand Down Expand Up @@ -487,7 +487,7 @@ func @perfectly_nested_loops_loop_carried_at_depth2() {

// -----
// CHECK-LABEL: func @one_common_loop() {
func @one_common_loop() {
func.func @one_common_loop() {
%m = memref.alloc() : memref<10x10xf32>
%c7 = arith.constant 7.0 : f32
// There is a loop-independent dependence from access 0 to 1 at depth 2.
Expand Down Expand Up @@ -518,7 +518,7 @@ func @one_common_loop() {

// -----
// CHECK-LABEL: func @dependence_cycle() {
func @dependence_cycle() {
func.func @dependence_cycle() {
%m.a = memref.alloc() : memref<100xf32>
%m.b = memref.alloc() : memref<100xf32>

Expand Down Expand Up @@ -572,7 +572,7 @@ func @dependence_cycle() {

// -----
// CHECK-LABEL: func @negative_and_positive_direction_vectors(%arg0: index, %arg1: index) {
func @negative_and_positive_direction_vectors(%arg0: index, %arg1: index) {
func.func @negative_and_positive_direction_vectors(%arg0: index, %arg1: index) {
%m = memref.alloc() : memref<10x10xf32>
%c7 = arith.constant 7.0 : f32
affine.for %i0 = 0 to %arg0 {
Expand Down Expand Up @@ -602,7 +602,7 @@ func @negative_and_positive_direction_vectors(%arg0: index, %arg1: index) {

// -----
// CHECK-LABEL: func @war_raw_waw_deps() {
func @war_raw_waw_deps() {
func.func @war_raw_waw_deps() {
%m = memref.alloc() : memref<100xf32>
%c7 = arith.constant 7.0 : f32
affine.for %i0 = 0 to 10 {
Expand Down Expand Up @@ -630,7 +630,7 @@ func @war_raw_waw_deps() {

// -----
// CHECK-LABEL: func @mod_deps() {
func @mod_deps() {
func.func @mod_deps() {
%m = memref.alloc() : memref<100xf32>
%c7 = arith.constant 7.0 : f32
affine.for %i0 = 0 to 10 {
Expand All @@ -654,7 +654,7 @@ func @mod_deps() {

// -----
// CHECK-LABEL: func @loop_nest_depth() {
func @loop_nest_depth() {
func.func @loop_nest_depth() {
%0 = memref.alloc() : memref<100x100xf32>
%c7 = arith.constant 7.0 : f32

Expand Down Expand Up @@ -690,7 +690,7 @@ func @loop_nest_depth() {
// Test case to exercise sanity when flattening multiple expressions involving
// mod/div's successively.
// CHECK-LABEL: func @mod_div_3d() {
func @mod_div_3d() {
func.func @mod_div_3d() {
%M = memref.alloc() : memref<2x2x2xi32>
%c0 = arith.constant 0 : i32
affine.for %i0 = 0 to 8 {
Expand All @@ -713,7 +713,7 @@ func @mod_div_3d() {
// -----
// This test case arises in the context of a 6-d to 2-d reshape.
// CHECK-LABEL: func @delinearize_mod_floordiv
func @delinearize_mod_floordiv() {
func.func @delinearize_mod_floordiv() {
%c0 = arith.constant 0 : index
%val = arith.constant 0 : i32
%in = memref.alloc() : memref<2x2x3x3x16x1xi32>
Expand Down Expand Up @@ -787,7 +787,7 @@ func @delinearize_mod_floordiv() {

// Load and store ops access the same elements in strided scf.
// CHECK-LABEL: func @strided_loop_with_dependence_at_depth2
func @strided_loop_with_dependence_at_depth2() {
func.func @strided_loop_with_dependence_at_depth2() {
%0 = memref.alloc() : memref<10xf32>
%cf0 = arith.constant 0.0 : f32
affine.for %i0 = 0 to 8 step 2 {
Expand All @@ -809,7 +809,7 @@ func @strided_loop_with_dependence_at_depth2() {

// Load and store ops access alternating memref elements: no dependence.
// CHECK-LABEL: func @strided_loop_with_no_dependence
func @strided_loop_with_no_dependence() {
func.func @strided_loop_with_no_dependence() {
%0 = memref.alloc() : memref<10xf32>
%cf0 = arith.constant 0.0 : f32
affine.for %i0 = 0 to 8 step 2 {
Expand All @@ -832,7 +832,7 @@ func @strided_loop_with_no_dependence() {

// Affine.Store op accesses memref elements at offset causing loop-carried dependence.
// CHECK-LABEL: func @strided_loop_with_loop_carried_dependence_at_depth1
func @strided_loop_with_loop_carried_dependence_at_depth1() {
func.func @strided_loop_with_loop_carried_dependence_at_depth1() {
%0 = memref.alloc() : memref<10xf32>
%cf0 = arith.constant 0.0 : f32
affine.for %i0 = 0 to 8 step 2 {
Expand All @@ -856,7 +856,7 @@ func @strided_loop_with_loop_carried_dependence_at_depth1() {
// Test that the loop carried dependence from load to store on '%i0' is
// properly computed when the load and store are at different loop depths.
// CHECK-LABEL: func @test_dep_store_depth1_load_depth2
func @test_dep_store_depth1_load_depth2() {
func.func @test_dep_store_depth1_load_depth2() {
%0 = memref.alloc() : memref<100xf32>
%cst = arith.constant 7.000000e+00 : f32
affine.for %i0 = 0 to 10 {
Expand All @@ -883,7 +883,7 @@ func @test_dep_store_depth1_load_depth2() {
// Test that the loop carried dependence from store to load on '%i0' is
// properly computed when the load and store are at different loop depths.
// CHECK-LABEL: func @test_dep_store_depth2_load_depth1
func @test_dep_store_depth2_load_depth1() {
func.func @test_dep_store_depth2_load_depth1() {
%0 = memref.alloc() : memref<100xf32>
%cst = arith.constant 7.000000e+00 : f32
affine.for %i0 = 0 to 10 {
Expand Down Expand Up @@ -911,7 +911,7 @@ func @test_dep_store_depth2_load_depth1() {
#set = affine_set<(d0): (d0 - 50 >= 0)>

// CHECK-LABEL: func @test_affine_for_if_same_block() {
func @test_affine_for_if_same_block() {
func.func @test_affine_for_if_same_block() {
%0 = memref.alloc() : memref<100xf32>
%cf7 = arith.constant 7.0 : f32

Expand Down Expand Up @@ -939,7 +939,7 @@ func @test_affine_for_if_same_block() {
#set = affine_set<(d0): (d0 - 50 >= 0)>

// CHECK-LABEL: func @test_affine_for_if_separated() {
func @test_affine_for_if_separated() {
func.func @test_affine_for_if_separated() {
%0 = memref.alloc() : memref<100xf32>
%cf7 = arith.constant 7.0 : f32

Expand Down Expand Up @@ -969,7 +969,7 @@ func @test_affine_for_if_separated() {
#set2 = affine_set<(d0): (- d0 + 75 >= 0)>

// CHECK-LABEL: func @test_affine_for_if_partially_joined() {
func @test_affine_for_if_partially_joined() {
func.func @test_affine_for_if_partially_joined() {
%0 = memref.alloc() : memref<100xf32>
%cf7 = arith.constant 7.0 : f32

Expand Down Expand Up @@ -1000,7 +1000,7 @@ func @test_affine_for_if_partially_joined() {
#set2 = affine_set<(d0, d1): (d0 - 75 >= 0, d1 - 50 >= 0)>

// CHECK-LABEL: func @test_interleaved_affine_for_if() {
func @test_interleaved_affine_for_if() {
func.func @test_interleaved_affine_for_if() {
%0 = memref.alloc() : memref<100x100xf32>
%cf7 = arith.constant 7.0 : f32

Expand Down Expand Up @@ -1038,7 +1038,7 @@ func @test_interleaved_affine_for_if() {
#set2 = affine_set<(d0): (- d0 + 51 >= 0)>

// CHECK-LABEL: func @test_interleaved_affine_for_if() {
func @test_interleaved_affine_for_if() {
func.func @test_interleaved_affine_for_if() {
%0 = memref.alloc() : memref<101xf32>
%c0 = arith.constant 0 : index
%N = memref.dim %0, %c0 : memref<101xf32>
Expand Down
14 changes: 7 additions & 7 deletions mlir/test/Transforms/normalize-memrefs-ops-dynamic.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

// CHECK-LABEL: test_norm_dynamic12
// CHECK-SAME: ([[ARG_0_:%.+]]: memref<1x?x?x1x?x64xf32>) {
func @test_norm_dynamic12(%arg0 : memref<1x?x?x14xf32, #map_tiled>) -> () {
func.func @test_norm_dynamic12(%arg0 : memref<1x?x?x14xf32, #map_tiled>) -> () {
%c1 = arith.constant 1 : index
%c2 = arith.constant 2 : index
%0 = memref.dim %arg0, %c1 :memref<1x?x?x14xf32, #map_tiled>
Expand Down Expand Up @@ -60,7 +60,7 @@ func @test_norm_dynamic12(%arg0 : memref<1x?x?x14xf32, #map_tiled>) -> () {

// CHECK-LABEL: test_norm_dynamic1234
// CHECK-SAME: ([[ARG_0_:%.+]]: memref<?x?x?x?x?x?xf32>) {
func @test_norm_dynamic1234(%arg0 : memref<?x?x?x?xf32, #map_tiled1>) -> () {
func.func @test_norm_dynamic1234(%arg0 : memref<?x?x?x?xf32, #map_tiled1>) -> () {
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
%c2 = arith.constant 2 : index
Expand Down Expand Up @@ -106,7 +106,7 @@ func @test_norm_dynamic1234(%arg0 : memref<?x?x?x?xf32, #map_tiled1>) -> () {

// CHECK-LABEL: func @test_norm_dynamic_not_tiled0
// CHECK-SAME: ([[ARG_0_:%.+]]: memref<1x?x?x14xf32, #[[$MAP6]]>) {
func @test_norm_dynamic_not_tiled0(%arg0 : memref<1x?x?x14xf32, #map_not_tiled0>) -> () {
func.func @test_norm_dynamic_not_tiled0(%arg0 : memref<1x?x?x14xf32, #map_not_tiled0>) -> () {
%c1 = arith.constant 1 : index
%c2 = arith.constant 2 : index
%0 = memref.dim %arg0, %c1 :memref<1x?x?x14xf32, #map_not_tiled0>
Expand Down Expand Up @@ -137,7 +137,7 @@ func @test_norm_dynamic_not_tiled0(%arg0 : memref<1x?x?x14xf32, #map_not_tiled0>

// CHECK-LABEL: func @test_norm_dynamic_not_tiled1
// CHECK-SAME: ([[ARG_0_:%.+]]: memref<1x?x?x14xf32, #[[$MAP6]]>) {
func @test_norm_dynamic_not_tiled1(%arg0 : memref<1x?x?x14xf32, #map_not_tiled1>) -> () {
func.func @test_norm_dynamic_not_tiled1(%arg0 : memref<1x?x?x14xf32, #map_not_tiled1>) -> () {
%c1 = arith.constant 1 : index
%c2 = arith.constant 2 : index
%0 = memref.dim %arg0, %c1 :memref<1x?x?x14xf32, #map_not_tiled1>
Expand Down Expand Up @@ -168,7 +168,7 @@ func @test_norm_dynamic_not_tiled1(%arg0 : memref<1x?x?x14xf32, #map_not_tiled1>

// CHECK-LABEL: func @test_norm_dynamic_not_tiled2
// CHECK-SAME: ([[ARG_0_:%.+]]: memref<1x?x?x14xf32, #[[$MAP7]]>) {
func @test_norm_dynamic_not_tiled2(%arg0 : memref<1x?x?x14xf32, #map_not_tiled2>) -> () {
func.func @test_norm_dynamic_not_tiled2(%arg0 : memref<1x?x?x14xf32, #map_not_tiled2>) -> () {
%c1 = arith.constant 1 : index
%c2 = arith.constant 2 : index
%0 = memref.dim %arg0, %c1 :memref<1x?x?x14xf32, #map_not_tiled2>
Expand Down Expand Up @@ -199,7 +199,7 @@ func @test_norm_dynamic_not_tiled2(%arg0 : memref<1x?x?x14xf32, #map_not_tiled2>

// CHECK-LABEL: func @test_norm_dynamic_not_tiled3
// CHECK-SAME: ([[ARG_0_:%.+]]: memref<1x?x?x14xf32, #[[$MAP8]]>) {
func @test_norm_dynamic_not_tiled3(%arg0 : memref<1x?x?x14xf32, #map_not_tiled3>) -> () {
func.func @test_norm_dynamic_not_tiled3(%arg0 : memref<1x?x?x14xf32, #map_not_tiled3>) -> () {
%c1 = arith.constant 1 : index
%c2 = arith.constant 2 : index
%0 = memref.dim %arg0, %c1 :memref<1x?x?x14xf32, #map_not_tiled3>
Expand Down Expand Up @@ -230,7 +230,7 @@ func @test_norm_dynamic_not_tiled3(%arg0 : memref<1x?x?x14xf32, #map_not_tiled3>

// CHECK-LABEL: func @test_norm_dynamic_not_tiled4
// CHECK-SAME: ([[ARG_0_:%.+]]: memref<1x?x?x14xf32, #[[$MAP9]]>) {
func @test_norm_dynamic_not_tiled4(%arg0 : memref<1x?x?x14xf32, #map_not_tiled4>) -> () {
func.func @test_norm_dynamic_not_tiled4(%arg0 : memref<1x?x?x14xf32, #map_not_tiled4>) -> () {
%c1 = arith.constant 1 : index
%c2 = arith.constant 2 : index
%0 = memref.dim %arg0, %c1 :memref<1x?x?x14xf32, #map_not_tiled4>
Expand Down
12 changes: 6 additions & 6 deletions mlir/test/Transforms/normalize-memrefs-ops.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

// CHECK-LABEL: test_norm
// CHECK-SAME: (%[[ARG0:.*]]: memref<1x16x1x1x32x64xf32>)
func @test_norm(%arg0 : memref<1x16x14x14xf32, #map0>) -> () {
func.func @test_norm(%arg0 : memref<1x16x14x14xf32, #map0>) -> () {
%0 = memref.alloc() : memref<1x16x14x14xf32, #map0>
"test.op_norm"(%arg0, %0) : (memref<1x16x14x14xf32, #map0>, memref<1x16x14x14xf32, #map0>) -> ()
memref.dealloc %0 : memref<1x16x14x14xf32, #map0>
Expand All @@ -30,7 +30,7 @@ func @test_norm(%arg0 : memref<1x16x14x14xf32, #map0>) -> () {

// CHECK-LABEL: test_nonnorm
// CHECK-SAME: (%[[ARG0:.*]]: memref<1x16x14x14xf32, #map>)
func @test_nonnorm(%arg0 : memref<1x16x14x14xf32, #map0>) -> () {
func.func @test_nonnorm(%arg0 : memref<1x16x14x14xf32, #map0>) -> () {
%0 = memref.alloc() : memref<1x16x14x14xf32, #map0>
"test.op_nonnorm"(%arg0, %0) : (memref<1x16x14x14xf32, #map0>, memref<1x16x14x14xf32, #map0>) -> ()
memref.dealloc %0 : memref<1x16x14x14xf32, #map0>
Expand All @@ -45,7 +45,7 @@ func @test_nonnorm(%arg0 : memref<1x16x14x14xf32, #map0>) -> () {

// CHECK-LABEL: test_norm_mix
// CHECK-SAME: (%[[ARG0:.*]]: memref<1x16x1x1x32x64xf32>
func @test_norm_mix(%arg0 : memref<1x16x1x1x32x64xf32>) -> () {
func.func @test_norm_mix(%arg0 : memref<1x16x1x1x32x64xf32>) -> () {
%0 = memref.alloc() : memref<1x16x14x14xf32, #map0>
"test.op_norm"(%arg0, %0) : (memref<1x16x1x1x32x64xf32>, memref<1x16x14x14xf32, #map0>) -> ()
memref.dealloc %0 : memref<1x16x14x14xf32, #map0>
Expand All @@ -62,7 +62,7 @@ func @test_norm_mix(%arg0 : memref<1x16x1x1x32x64xf32>) -> () {

// CHECK-LABEL: test_load_store
// CHECK-SAME: (%[[ARG0:.*]]: memref<1x16x14x14xf32>
func @test_load_store(%arg0 : memref<1x16x14x14xf32>) -> () {
func.func @test_load_store(%arg0 : memref<1x16x14x14xf32>) -> () {
%0 = memref.alloc() : memref<1x16x14x14xf32, #map_tile>
// CHECK: %[[v0:.*]] = memref.alloc() : memref<1x16x1x1x32x32xf32>
%1 = memref.alloc() : memref<1x16x14x14xf32>
Expand Down Expand Up @@ -94,7 +94,7 @@ func @test_load_store(%arg0 : memref<1x16x14x14xf32>) -> () {

// CHECK-LABEL: test_norm_ret
// CHECK-SAME: (%[[ARG0:.*]]: memref<1x16x1x1x32x32xf32>) -> (memref<1x16x1x1x32x32xf32>, memref<1x16x14x14xf32>) {
func @test_norm_ret(%arg0: memref<1x16x14x14xf32, #map_tile>) -> (memref<1x16x14x14xf32, #map_tile>, memref<1x16x14x14xf32>) {
func.func @test_norm_ret(%arg0: memref<1x16x14x14xf32, #map_tile>) -> (memref<1x16x14x14xf32, #map_tile>, memref<1x16x14x14xf32>) {
%0 = memref.alloc() : memref<1x16x14x14xf32, #map_tile>
// CHECK-NEXT: %[[v0:.*]] = memref.alloc() : memref<1x16x1x1x32x32xf32>
%1, %2 = "test.op_norm_ret"(%arg0) : (memref<1x16x14x14xf32, #map_tile>) -> (memref<1x16x14x14xf32, #map_tile>, memref<1x16x14x14xf32>)
Expand Down Expand Up @@ -122,7 +122,7 @@ func @test_norm_ret(%arg0: memref<1x16x14x14xf32, #map_tile>) -> (memref<1x16x14

// CHECK-LABEL: test_norm_reinterpret_cast
// CHECK-SAME: (%[[ARG0:.*]]: memref<1x32xf32>) -> memref<3x1x1xf32> {
func @test_norm_reinterpret_cast(%arg0 : memref<3xf32, #map_1d_tile>) -> (memref<3x1x1xf32>) {
func.func @test_norm_reinterpret_cast(%arg0 : memref<3xf32, #map_1d_tile>) -> (memref<3x1x1xf32>) {
%0 = memref.alloc() : memref<3xf32>
"test.op_norm"(%arg0, %0) : (memref<3xf32, #map_1d_tile>, memref<3xf32>) -> ()
%1 = memref.reinterpret_cast %0 to offset: [0], sizes: [3, 1, 1], strides: [1, 1, 1] : memref<3xf32> to memref<3x1x1xf32>
Expand Down
52 changes: 26 additions & 26 deletions mlir/test/Transforms/normalize-memrefs.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// are normalized to trivial (identity) layouts.

// CHECK-LABEL: func @permute()
func @permute() {
func.func @permute() {
%A = memref.alloc() : memref<64x256xf32, affine_map<(d0, d1) -> (d1, d0)>>
affine.for %i = 0 to 64 {
affine.for %j = 0 to 256 {
Expand All @@ -28,7 +28,7 @@ func @permute() {
// CHECK-NEXT: return

// CHECK-LABEL: func @shift
func @shift(%idx : index) {
func.func @shift(%idx : index) {
// CHECK-NEXT: memref.alloc() : memref<65xf32>
%A = memref.alloc() : memref<64xf32, affine_map<(d0) -> (d0 + 1)>>
// CHECK-NEXT: affine.load %{{.*}}[symbol(%arg0) + 1] : memref<65xf32>
Expand All @@ -42,7 +42,7 @@ func @shift(%idx : index) {
}

// CHECK-LABEL: func @high_dim_permute()
func @high_dim_permute() {
func.func @high_dim_permute() {
// CHECK-NOT: memref<64x128x256xf32,
%A = memref.alloc() : memref<64x128x256xf32, affine_map<(d0, d1, d2) -> (d2, d0, d1)>>
// CHECK: %[[I:arg[0-9]+]]
Expand All @@ -61,15 +61,15 @@ func @high_dim_permute() {
}

// CHECK-LABEL: func @invalid_map
func @invalid_map() {
func.func @invalid_map() {
%A = memref.alloc() : memref<64x128xf32, affine_map<(d0, d1) -> (d0, -d1 - 10)>>
// CHECK: %{{.*}} = memref.alloc() : memref<64x128xf32,
return
}

// A tiled layout.
// CHECK-LABEL: func @data_tiling
func @data_tiling(%idx : index) {
func.func @data_tiling(%idx : index) {
// CHECK: memref.alloc() : memref<8x32x8x16xf32>
%A = memref.alloc() : memref<64x512xf32, affine_map<(d0, d1) -> (d0 floordiv 8, d1 floordiv 16, d0 mod 8, d1 mod 16)>>
// CHECK: affine.load %{{.*}}[symbol(%arg0) floordiv 8, symbol(%arg0) floordiv 16, symbol(%arg0) mod 8, symbol(%arg0) mod 16]
Expand All @@ -80,7 +80,7 @@ func @data_tiling(%idx : index) {

// Strides 2 and 4 along respective dimensions.
// CHECK-LABEL: func @strided
func @strided() {
func.func @strided() {
%A = memref.alloc() : memref<64x128xf32, affine_map<(d0, d1) -> (2*d0, 4*d1)>>
// CHECK: affine.for %[[IV0:.*]] =
affine.for %i = 0 to 64 {
Expand All @@ -96,7 +96,7 @@ func @strided() {

// Strided, but the strides are in the linearized space.
// CHECK-LABEL: func @strided_cumulative
func @strided_cumulative() {
func.func @strided_cumulative() {
%A = memref.alloc() : memref<2x5xf32, affine_map<(d0, d1) -> (3*d0 + 17*d1)>>
// CHECK: affine.for %[[IV0:.*]] =
affine.for %i = 0 to 2 {
Expand All @@ -113,7 +113,7 @@ func @strided_cumulative() {
// Symbolic operand for alloc, although unused. Tests replaceAllMemRefUsesWith
// when the index remap has symbols.
// CHECK-LABEL: func @symbolic_operands
func @symbolic_operands(%s : index) {
func.func @symbolic_operands(%s : index) {
// CHECK: memref.alloc() : memref<100xf32>
%A = memref.alloc()[%s] : memref<10x10xf32, affine_map<(d0,d1)[s0] -> (10*d0 + d1)>>
affine.for %i = 0 to 10 {
Expand All @@ -128,7 +128,7 @@ func @symbolic_operands(%s : index) {

// Semi-affine maps, normalization not implemented yet.
// CHECK-LABEL: func @semi_affine_layout_map
func @semi_affine_layout_map(%s0: index, %s1: index) {
func.func @semi_affine_layout_map(%s0: index, %s1: index) {
%A = memref.alloc()[%s0, %s1] : memref<256x1024xf32, affine_map<(d0, d1)[s0, s1] -> (d0*s0 + d1*s1)>>
affine.for %i = 0 to 256 {
affine.for %j = 0 to 1024 {
Expand All @@ -140,7 +140,7 @@ func @semi_affine_layout_map(%s0: index, %s1: index) {
}

// CHECK-LABEL: func @alignment
func @alignment() {
func.func @alignment() {
%A = memref.alloc() {alignment = 32 : i64}: memref<64x128x256xf32, affine_map<(d0, d1, d2) -> (d2, d0, d1)>>
// CHECK-NEXT: memref.alloc() {alignment = 32 : i64} : memref<256x64x128xf32>
return
Expand All @@ -153,7 +153,7 @@ func @alignment() {
// Test case 1: Check normalization for multiple memrefs in a function argument list.
// CHECK-LABEL: func @multiple_argument_type
// CHECK-SAME: (%[[A:arg[0-9]+]]: memref<4x4xf64>, %[[B:arg[0-9]+]]: f64, %[[C:arg[0-9]+]]: memref<2x4xf64>, %[[D:arg[0-9]+]]: memref<24xf64>) -> f64
func @multiple_argument_type(%A: memref<16xf64, #tile>, %B: f64, %C: memref<8xf64, #tile>, %D: memref<24xf64>) -> f64 {
func.func @multiple_argument_type(%A: memref<16xf64, #tile>, %B: f64, %C: memref<8xf64, #tile>, %D: memref<24xf64>) -> f64 {
%a = affine.load %A[0] : memref<16xf64, #tile>
%p = arith.mulf %a, %a : f64
affine.store %p, %A[10] : memref<16xf64, #tile>
Expand All @@ -170,7 +170,7 @@ func @multiple_argument_type(%A: memref<16xf64, #tile>, %B: f64, %C: memref<8xf6
// Test case 2: Check normalization for single memref argument in a function.
// CHECK-LABEL: func @single_argument_type
// CHECK-SAME: (%[[C:arg[0-9]+]]: memref<2x4xf64>)
func @single_argument_type(%C : memref<8xf64, #tile>) {
func.func @single_argument_type(%C : memref<8xf64, #tile>) {
%a = memref.alloc(): memref<8xf64, #tile>
%b = memref.alloc(): memref<16xf64, #tile>
%d = arith.constant 23.0 : f64
Expand All @@ -192,7 +192,7 @@ func @single_argument_type(%C : memref<8xf64, #tile>) {
// Test case 3: Check function returning any other type except memref.
// CHECK-LABEL: func @non_memref_ret
// CHECK-SAME: (%[[C:arg[0-9]+]]: memref<2x4xf64>) -> i1
func @non_memref_ret(%A: memref<8xf64, #tile>) -> i1 {
func.func @non_memref_ret(%A: memref<8xf64, #tile>) -> i1 {
%d = arith.constant 1 : i1
return %d : i1
}
Expand All @@ -202,7 +202,7 @@ func @non_memref_ret(%A: memref<8xf64, #tile>) -> i1 {
// Test case 4: Check successful memref normalization in case of inter/intra-recursive calls.
// CHECK-LABEL: func @ret_multiple_argument_type
// CHECK-SAME: (%[[A:arg[0-9]+]]: memref<4x4xf64>, %[[B:arg[0-9]+]]: f64, %[[C:arg[0-9]+]]: memref<2x4xf64>) -> (memref<2x4xf64>, f64)
func @ret_multiple_argument_type(%A: memref<16xf64, #tile>, %B: f64, %C: memref<8xf64, #tile>) -> (memref<8xf64, #tile>, f64) {
func.func @ret_multiple_argument_type(%A: memref<16xf64, #tile>, %B: f64, %C: memref<8xf64, #tile>) -> (memref<8xf64, #tile>, f64) {
%a = affine.load %A[0] : memref<16xf64, #tile>
%p = arith.mulf %a, %a : f64
%cond = arith.constant 1 : i1
Expand All @@ -226,7 +226,7 @@ func @ret_multiple_argument_type(%A: memref<16xf64, #tile>, %B: f64, %C: memref<

// CHECK-LABEL: func @ret_single_argument_type
// CHECK-SAME: (%[[C:arg[0-9]+]]: memref<2x4xf64>) -> (memref<4x4xf64>, memref<2x4xf64>)
func @ret_single_argument_type(%C: memref<8xf64, #tile>) -> (memref<16xf64, #tile>, memref<8xf64, #tile>){
func.func @ret_single_argument_type(%C: memref<8xf64, #tile>) -> (memref<16xf64, #tile>, memref<8xf64, #tile>){
%a = memref.alloc() : memref<8xf64, #tile>
%b = memref.alloc() : memref<16xf64, #tile>
%d = arith.constant 23.0 : f64
Expand All @@ -249,38 +249,38 @@ func @ret_single_argument_type(%C: memref<8xf64, #tile>) -> (memref<16xf64, #til
// Test case set #5: To check normalization in a chain of interconnected functions.
// CHECK-LABEL: func @func_A
// CHECK-SAME: (%[[A:arg[0-9]+]]: memref<2x4xf64>)
func @func_A(%A: memref<8xf64, #tile>) {
func.func @func_A(%A: memref<8xf64, #tile>) {
call @func_B(%A) : (memref<8xf64, #tile>) -> ()
return
}
// CHECK: call @func_B(%[[A]]) : (memref<2x4xf64>) -> ()

// CHECK-LABEL: func @func_B
// CHECK-SAME: (%[[A:arg[0-9]+]]: memref<2x4xf64>)
func @func_B(%A: memref<8xf64, #tile>) {
func.func @func_B(%A: memref<8xf64, #tile>) {
call @func_C(%A) : (memref<8xf64, #tile>) -> ()
return
}
// CHECK: call @func_C(%[[A]]) : (memref<2x4xf64>) -> ()

// CHECK-LABEL: func @func_C
// CHECK-SAME: (%[[A:arg[0-9]+]]: memref<2x4xf64>)
func @func_C(%A: memref<8xf64, #tile>) {
func.func @func_C(%A: memref<8xf64, #tile>) {
return
}

// Test case set #6: Checking if no normalization takes place in a scenario: A -> B -> C and B has an unsupported type.
// CHECK-LABEL: func @some_func_A
// CHECK-SAME: (%[[A:arg[0-9]+]]: memref<8xf64, #map{{[0-9]+}}>)
func @some_func_A(%A: memref<8xf64, #tile>) {
func.func @some_func_A(%A: memref<8xf64, #tile>) {
call @some_func_B(%A) : (memref<8xf64, #tile>) -> ()
return
}
// CHECK: call @some_func_B(%[[A]]) : (memref<8xf64, #map{{[0-9]+}}>) -> ()

// CHECK-LABEL: func @some_func_B
// CHECK-SAME: (%[[A:arg[0-9]+]]: memref<8xf64, #map{{[0-9]+}}>)
func @some_func_B(%A: memref<8xf64, #tile>) {
func.func @some_func_B(%A: memref<8xf64, #tile>) {
"test.test"(%A) : (memref<8xf64, #tile>) -> ()
call @some_func_C(%A) : (memref<8xf64, #tile>) -> ()
return
Expand All @@ -289,21 +289,21 @@ func @some_func_B(%A: memref<8xf64, #tile>) {

// CHECK-LABEL: func @some_func_C
// CHECK-SAME: (%[[A:arg[0-9]+]]: memref<8xf64, #map{{[0-9]+}}>)
func @some_func_C(%A: memref<8xf64, #tile>) {
func.func @some_func_C(%A: memref<8xf64, #tile>) {
return
}

// Test case set #7: Check normalization in case of external functions.
// CHECK-LABEL: func private @external_func_A
// CHECK-SAME: (memref<4x4xf64>)
func private @external_func_A(memref<16xf64, #tile>) -> ()
func.func private @external_func_A(memref<16xf64, #tile>) -> ()

// CHECK-LABEL: func private @external_func_B
// CHECK-SAME: (memref<4x4xf64>, f64) -> memref<2x4xf64>
func private @external_func_B(memref<16xf64, #tile>, f64) -> (memref<8xf64, #tile>)
func.func private @external_func_B(memref<16xf64, #tile>, f64) -> (memref<8xf64, #tile>)

// CHECK-LABEL: func @simply_call_external()
func @simply_call_external() {
func.func @simply_call_external() {
%a = memref.alloc() : memref<16xf64, #tile>
call @external_func_A(%a) : (memref<16xf64, #tile>) -> ()
return
Expand All @@ -313,15 +313,15 @@ func @simply_call_external() {

// CHECK-LABEL: func @use_value_of_external
// CHECK-SAME: (%[[A:arg[0-9]+]]: memref<4x4xf64>, %[[B:arg[0-9]+]]: f64) -> memref<2x4xf64>
func @use_value_of_external(%A: memref<16xf64, #tile>, %B: f64) -> (memref<8xf64, #tile>) {
func.func @use_value_of_external(%A: memref<16xf64, #tile>, %B: f64) -> (memref<8xf64, #tile>) {
%res = call @external_func_B(%A, %B) : (memref<16xf64, #tile>, f64) -> (memref<8xf64, #tile>)
return %res : memref<8xf64, #tile>
}
// CHECK: %[[res:[0-9]+]] = call @external_func_B(%[[A]], %[[B]]) : (memref<4x4xf64>, f64) -> memref<2x4xf64>
// CHECK: return %{{.*}} : memref<2x4xf64>

// CHECK-LABEL: func @affine_parallel_norm
func @affine_parallel_norm() -> memref<8xf32, #tile> {
func.func @affine_parallel_norm() -> memref<8xf32, #tile> {
%c = arith.constant 23.0 : f32
%a = memref.alloc() : memref<8xf32, #tile>
// CHECK: affine.parallel (%{{.*}}) = (0) to (8) reduce ("assign") -> (memref<2x4xf32>)
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/Transforms/parallel-loop-collapsing.mlir
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='func.func(scf-parallel-loop-collapsing{collapsed-indices-0=0,3 collapsed-indices-1=1,4 collapsed-indices-2=2}, canonicalize)' | FileCheck %s

// CHECK-LABEL: func @parallel_many_dims() {
func @parallel_many_dims() {
func.func @parallel_many_dims() {
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
%c2 = arith.constant 2 : index
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/Transforms/parametric-mapping.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK: func @map1d
// CHECK-SAME: (%[[lb:.*]]: index, %[[ub:.*]]: index, %[[step:.*]]: index)
func @map1d(%lb: index, %ub: index, %step: index) {
func.func @map1d(%lb: index, %ub: index, %step: index) {
// CHECK: %[[threads:.*]]:2 = "new_processor_id_and_range"() : () -> (index, index)
%0:2 = "new_processor_id_and_range"() : () -> (index, index)

Expand All @@ -20,7 +20,7 @@ func @map1d(%lb: index, %ub: index, %step: index) {

// CHECK: func @map2d
// CHECK-SAME: (%[[lb:.*]]: index, %[[ub:.*]]: index, %[[step:.*]]: index)
func @map2d(%lb : index, %ub : index, %step : index) {
func.func @map2d(%lb : index, %ub : index, %step : index) {
// CHECK: %[[blocks:.*]]:2 = "new_processor_id_and_range"() : () -> (index, index)
%0:2 = "new_processor_id_and_range"() : () -> (index, index)

Expand Down
4 changes: 2 additions & 2 deletions mlir/test/Transforms/parametric-tiling.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// RUN: mlir-opt -test-extract-fixed-outer-loops='test-outer-loop-sizes=7,4' %s | FileCheck %s --check-prefixes=COMMON,TILE_74

// COMMON-LABEL: @rectangular
func @rectangular(%arg0: memref<?x?xf32>) {
func.func @rectangular(%arg0: memref<?x?xf32>) {
%c2 = arith.constant 2 : index
%c44 = arith.constant 44 : index
%c1 = arith.constant 1 : index
Expand Down Expand Up @@ -66,7 +66,7 @@ func @rectangular(%arg0: memref<?x?xf32>) {
}

// COMMON-LABEL: @triangular
func @triangular(%arg0: memref<?x?xf32>) {
func.func @triangular(%arg0: memref<?x?xf32>) {
%c2 = arith.constant 2 : index
%c44 = arith.constant 44 : index
%c1 = arith.constant 1 : index
Expand Down
18 changes: 9 additions & 9 deletions mlir/test/Transforms/pipeline-data-transfer.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// CHECK-DAG: [[$MAP_MINUS_1:#map[0-9]+]] = affine_map<(d0) -> (d0 - 1)>

// CHECK-LABEL: func @loop_nest_dma() {
func @loop_nest_dma() {
func.func @loop_nest_dma() {

%A = memref.alloc() : memref<256 x f32, affine_map<(d0) -> (d0)>, 0>
%Ah = memref.alloc() : memref<32 x f32, affine_map<(d0) -> (d0)>, 1>
Expand Down Expand Up @@ -68,7 +68,7 @@ func @loop_nest_dma() {
// CHECK-DAG: [[$REMAP_SHIFT_MINUS_4:#map[0-9]+]] = affine_map<(d0) -> (d0 - 4)>

// CHECK-LABEL: @loop_step
func @loop_step(%arg0: memref<512xf32>,
func.func @loop_step(%arg0: memref<512xf32>,
%arg1: memref<512xf32>) {
%c0 = arith.constant 0 : index
%c4 = arith.constant 4 : index
Expand Down Expand Up @@ -108,7 +108,7 @@ func @loop_step(%arg0: memref<512xf32>,
#map1 = affine_map<(d0, d1) -> ((d0 * 2048 + d1 * 256) floordiv 32)>
#map2 = affine_map<(d0) -> ((d0 * 2048) floordiv 32)>
// CHECK-LABEL: func @loop_dma_nested(%{{.*}}: memref<512x32xvector<8xf32>
func @loop_dma_nested(%arg0: memref<512x32xvector<8xf32>>, %arg1: memref<512x32xvector<8xf32>>, %arg2: memref<512x32xvector<8xf32>>) {
func.func @loop_dma_nested(%arg0: memref<512x32xvector<8xf32>>, %arg1: memref<512x32xvector<8xf32>>, %arg2: memref<512x32xvector<8xf32>>) {
%num_elts = arith.constant 256 : index
%c0 = arith.constant 0 : index
%0 = memref.alloc() : memref<64x4xvector<8xf32>, 2>
Expand Down Expand Up @@ -202,7 +202,7 @@ func @loop_dma_nested(%arg0: memref<512x32xvector<8xf32>>, %arg1: memref<512x32x
#map2 = affine_map<(d0) -> ((d0 * 2048) floordiv 32)>

// CHECK: func @loop_dma_dependent
func @loop_dma_dependent(%arg2: memref<512x32xvector<8xf32>>) {
func.func @loop_dma_dependent(%arg2: memref<512x32xvector<8xf32>>) {
%num_elts = arith.constant 256 : index
%c0 = arith.constant 0 : index
%0 = memref.alloc() : memref<64x4xvector<8xf32>, 2>
Expand Down Expand Up @@ -236,7 +236,7 @@ func @loop_dma_dependent(%arg2: memref<512x32xvector<8xf32>>) {
// -----

// CHECK-LABEL: func @escaping_use
func @escaping_use(%arg0: memref<512 x 32 x f32>) {
func.func @escaping_use(%arg0: memref<512 x 32 x f32>) {
%c32 = arith.constant 32 : index
%num_elt = arith.constant 512 : index
%zero = arith.constant 0 : index
Expand Down Expand Up @@ -264,7 +264,7 @@ func @escaping_use(%arg0: memref<512 x 32 x f32>) {
// -----

// CHECK-LABEL: func @escaping_tag
func @escaping_tag(%arg0: memref<512 x 32 x f32>) {
func.func @escaping_tag(%arg0: memref<512 x 32 x f32>) {
%c32 = arith.constant 32 : index
%num_elt = arith.constant 512 : index
%zero = arith.constant 0 : index
Expand Down Expand Up @@ -293,7 +293,7 @@ func @escaping_tag(%arg0: memref<512 x 32 x f32>) {
// -----

// CHECK-LABEL: func @live_out_use
func @live_out_use(%arg0: memref<512 x 32 x f32>) -> f32 {
func.func @live_out_use(%arg0: memref<512 x 32 x f32>) -> f32 {
%c32 = arith.constant 32 : index
%num_elt = arith.constant 512 : index
%zero = arith.constant 0 : index
Expand All @@ -320,7 +320,7 @@ func @live_out_use(%arg0: memref<512 x 32 x f32>) -> f32 {
// -----

// CHECK-LABEL: func @dynamic_shape_dma_buffer
func @dynamic_shape_dma_buffer(%arg0: memref<512 x 32 x f32>, %Av: memref<? x ? x f32, 2>) {
func.func @dynamic_shape_dma_buffer(%arg0: memref<512 x 32 x f32>, %Av: memref<? x ? x f32, 2>) {
%num_elt = arith.constant 512 : index
%zero = arith.constant 0 : index
%tag = memref.alloc() : memref<1 x i32>
Expand Down Expand Up @@ -352,7 +352,7 @@ func @dynamic_shape_dma_buffer(%arg0: memref<512 x 32 x f32>, %Av: memref<? x ?
// dereferencing one since replaceAllMemRefUsesWith checks for escaping uses
// before performing any replacement.
// CHECK-LABEL: func @escaping_and_indexed_use_mix
func @escaping_and_indexed_use_mix() {
func.func @escaping_and_indexed_use_mix() {
%A = memref.alloc() : memref<256 x f32, affine_map<(d0) -> (d0)>, 0>
%Ah = memref.alloc() : memref<32 x f32, affine_map<(d0) -> (d0)>, 1>
%tag = memref.alloc() : memref<1 x f32>
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/Transforms/print-op-graph.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
// CFG: v[[TEST_FUNC]] -> v[[ANCHOR]] [{{.*}}, lhead = [[CLUSTER_MERGE_BLOCKS]]]
// CFG: v[[ANCHOR]] -> v[[TEST_RET]] [{{.*}}, ltail = [[CLUSTER_MERGE_BLOCKS]]]

func @merge_blocks(%arg0: i32, %arg1 : i32) -> () {
func.func @merge_blocks(%arg0: i32, %arg1 : i32) -> () {
%0 = arith.constant dense<[[0, 1], [2, 3]]> : tensor<2x2xi32>
%1 = arith.constant dense<1> : tensor<5xi32>
%2 = arith.constant dense<[[0, 1]]> : tensor<1x2xi32>
Expand Down
46 changes: 23 additions & 23 deletions mlir/test/Transforms/promote-buffers-to-stack.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// AllocaOp.

// CHECK-LABEL: func @condBranch
func @condBranch(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
func.func @condBranch(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
cf.cond_br %arg0, ^bb1, ^bb2
^bb1:
cf.br ^bb3(%arg1 : memref<2xf32>)
Expand Down Expand Up @@ -46,7 +46,7 @@ func @condBranch(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
// Since the alloc has dynamic type, it is not converted into an alloca.

// CHECK-LABEL: func @condBranchDynamicType
func @condBranchDynamicType(
func.func @condBranchDynamicType(
%arg0: i1,
%arg1: memref<?xf32>,
%arg2: memref<?xf32>,
Expand Down Expand Up @@ -76,7 +76,7 @@ func @condBranchDynamicType(
// -----

// CHECK-LABEL: func @dynamicRanked
func @dynamicRanked(%memref: memref<*xf32>) {
func.func @dynamicRanked(%memref: memref<*xf32>) {
%0 = memref.rank %memref : memref<*xf32>
%1 = memref.alloc(%0) : memref<?xindex>
return
Expand All @@ -88,7 +88,7 @@ func @dynamicRanked(%memref: memref<*xf32>) {
// -----

// CHECK-LABEL: func @dynamicRanked2D
func @dynamicRanked2D(%memref: memref<*xf32>) {
func.func @dynamicRanked2D(%memref: memref<*xf32>) {
%0 = memref.rank %memref : memref<*xf32>
%1 = memref.alloc(%0, %0) : memref<?x?xindex>
return
Expand All @@ -101,7 +101,7 @@ func @dynamicRanked2D(%memref: memref<*xf32>) {
// -----

// CHECK-LABEL: func @dynamicNoRank
func @dynamicNoRank(%arg0: index) {
func.func @dynamicNoRank(%arg0: index) {
%0 = memref.alloc(%arg0) : memref<?xindex>
return
}
Expand All @@ -115,7 +115,7 @@ func @dynamicNoRank(%arg0: index) {
// AllocaOp.

// CHECK-LABEL: func @emptyUsesValue
func @emptyUsesValue(%arg0: memref<4xf32>) {
func.func @emptyUsesValue(%arg0: memref<4xf32>) {
%0 = memref.alloc() : memref<4xf32>
return
}
Expand All @@ -134,7 +134,7 @@ func @emptyUsesValue(%arg0: memref<4xf32>) {
// AllocaOp.

// CHECK-LABEL: func @criticalEdge
func @criticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
func.func @criticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
cf.cond_br %arg0, ^bb1, ^bb2(%arg1 : memref<2xf32>)
^bb1:
%0 = memref.alloc() : memref<2xf32>
Expand Down Expand Up @@ -162,7 +162,7 @@ func @criticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
// PromoteBuffersToStack expected behavior: It converts the alloc in an alloca.

// CHECK-LABEL: func @invCriticalEdge
func @invCriticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
func.func @invCriticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
%0 = memref.alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
cf.cond_br %arg0, ^bb1, ^bb2(%arg1 : memref<2xf32>)
Expand All @@ -189,7 +189,7 @@ func @invCriticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
// PromoteBuffersToStack expected behavior: It converts the allocs into allocas.

// CHECK-LABEL: func @ifElse
func @ifElse(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
func.func @ifElse(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
%0 = memref.alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
cf.cond_br %arg0,
Expand Down Expand Up @@ -224,7 +224,7 @@ func @ifElse(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
// PromoteBuffersToStack expected behavior: It converts the alloc into alloca.

// CHECK-LABEL: func @ifElseNoUsers
func @ifElseNoUsers(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
func.func @ifElseNoUsers(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
%0 = memref.alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
cf.cond_br %arg0,
Expand Down Expand Up @@ -257,7 +257,7 @@ func @ifElseNoUsers(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
// into allocas.

// CHECK-LABEL: func @ifElseNested
func @ifElseNested(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
func.func @ifElseNested(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
%0 = memref.alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
cf.cond_br %arg0,
Expand Down Expand Up @@ -292,7 +292,7 @@ func @ifElseNested(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
// allocas.

// CHECK-LABEL: func @redundantOperations
func @redundantOperations(%arg0: memref<2xf32>) {
func.func @redundantOperations(%arg0: memref<2xf32>) {
%0 = memref.alloc() : memref<2xf32>
test.buffer_based in(%arg0: memref<2xf32>) out(%0: memref<2xf32>)
%1 = memref.alloc() : memref<2xf32>
Expand All @@ -319,7 +319,7 @@ func @redundantOperations(%arg0: memref<2xf32>) {
// allocas.

// CHECK-LABEL: func @moving_alloc_and_inserting_missing_dealloc
func @moving_alloc_and_inserting_missing_dealloc(
func.func @moving_alloc_and_inserting_missing_dealloc(
%cond: i1,
%arg0: memref<2xf32>,
%arg1: memref<2xf32>) {
Expand Down Expand Up @@ -353,7 +353,7 @@ func @moving_alloc_and_inserting_missing_dealloc(
// allocas.

// CHECK-LABEL: func @nested_regions_and_cond_branch
func @nested_regions_and_cond_branch(
func.func @nested_regions_and_cond_branch(
%arg0: i1,
%arg1: memref<2xf32>,
%arg2: memref<2xf32>) {
Expand Down Expand Up @@ -389,7 +389,7 @@ func @nested_regions_and_cond_branch(
// only remains in the scope of the function.

// CHECK-LABEL: func @memref_in_function_results
func @memref_in_function_results(
func.func @memref_in_function_results(
%arg0: memref<5xf32>,
%arg1: memref<10xf32>,
%arg2: memref<5xf32>) -> (memref<10xf32>, memref<15xf32>) {
Expand All @@ -413,7 +413,7 @@ func @memref_in_function_results(
// due to its dynamic memory allocation behavior.

// CHECK-LABEL: func @nested_region_control_flow
func @nested_region_control_flow(
func.func @nested_region_control_flow(
%arg0 : index,
%arg1 : index) -> memref<?x?xf32> {
%0 = arith.cmpi eq, %arg0, %arg1 : index
Expand Down Expand Up @@ -441,7 +441,7 @@ func @nested_region_control_flow(
// allocation finally escapes the method.

// CHECK-LABEL: func @inner_region_control_flow
func @inner_region_control_flow(%arg0 : index) -> memref<2x2xf32> {
func.func @inner_region_control_flow(%arg0 : index) -> memref<2x2xf32> {
%0 = memref.alloc() : memref<2x2xf32>
%1 = test.region_if %0 : memref<2x2xf32> -> (memref<2x2xf32>) then {
^bb0(%arg1 : memref<2x2xf32>):
Expand Down Expand Up @@ -472,7 +472,7 @@ func @inner_region_control_flow(%arg0 : index) -> memref<2x2xf32> {
// Alloc %0 will be converted to an alloca. %3 is not transformed.

// CHECK-LABEL: func @loop_alloc
func @loop_alloc(
func.func @loop_alloc(
%lb: index,
%ub: index,
%step: index,
Expand Down Expand Up @@ -502,7 +502,7 @@ func @loop_alloc(
// that are passed via the backedges. The alloc is converted to an AllocaOp.

// CHECK-LABEL: func @loop_nested_if_no_alloc
func @loop_nested_if_no_alloc(
func.func @loop_nested_if_no_alloc(
%lb: index,
%ub: index,
%step: index,
Expand Down Expand Up @@ -538,7 +538,7 @@ func @loop_nested_if_no_alloc(
// The allocs are not converted in this case.

// CHECK-LABEL: func @loop_nested_if_alloc
func @loop_nested_if_alloc(
func.func @loop_nested_if_alloc(
%lb: index,
%ub: index,
%step: index,
Expand Down Expand Up @@ -573,7 +573,7 @@ func @loop_nested_if_alloc(
// converted. In the actual implementation the largest size is 1KB.

// CHECK-LABEL: func @large_buffer_allocation
func @large_buffer_allocation(%arg0: memref<2048xf32>) {
func.func @large_buffer_allocation(%arg0: memref<2048xf32>) {
%0 = memref.alloc() : memref<2048xf32>
test.copy(%0, %arg0) : (memref<2048xf32>, memref<2048xf32>)
return
Expand All @@ -589,7 +589,7 @@ func @large_buffer_allocation(%arg0: memref<2048xf32>) {
// AllocaOp.

// CHECK-LABEL: func @indexElementType
func @indexElementType() {
func.func @indexElementType() {
%0 = memref.alloc() : memref<4xindex>
return
}
Expand All @@ -602,7 +602,7 @@ func @indexElementType() {

// CHECK-LABEL: func @bigIndexElementType
module attributes { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<index, 256>>} {
func @bigIndexElementType() {
func.func @bigIndexElementType() {
%0 = memref.alloc() : memref<4xindex>
return
}
Expand Down
44 changes: 22 additions & 22 deletions mlir/test/Transforms/sccp-callgraph.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
/// results of a private function.

// CHECK-LABEL: func private @private(
func private @private(%arg0 : i32) -> i32 {
func.func private @private(%arg0 : i32) -> i32 {
// CHECK: %[[CST:.*]] = arith.constant 1 : i32
// CHECK: return %[[CST]] : i32

return %arg0 : i32
}

// CHECK-LABEL: func @simple_private(
func @simple_private() -> i32 {
func.func @simple_private() -> i32 {
// CHECK: %[[CST:.*]] = arith.constant 1 : i32
// CHECK: return %[[CST]] : i32

Expand All @@ -28,15 +28,15 @@ func @simple_private() -> i32 {
/// results of a visible nested function.

// CHECK: func nested @nested(
func nested @nested(%arg0 : i32) -> i32 {
func.func nested @nested(%arg0 : i32) -> i32 {
// CHECK: %[[CST:.*]] = arith.constant 1 : i32
// CHECK: return %[[CST]] : i32

return %arg0 : i32
}

// CHECK-LABEL: func @simple_nested(
func @simple_nested() -> i32 {
func.func @simple_nested() -> i32 {
// CHECK: %[[CST:.*]] = arith.constant 1 : i32
// CHECK: return %[[CST]] : i32

Expand All @@ -53,7 +53,7 @@ module {
module @nested_module attributes { sym_visibility = "public" } {

// NESTED: func nested @nested(
func nested @nested(%arg0 : i32) -> (i32, i32) {
func.func nested @nested(%arg0 : i32) -> (i32, i32) {
// NESTED: %[[CST:.*]] = arith.constant 1 : i32
// NESTED: return %[[CST]], %arg0 : i32, i32

Expand All @@ -62,7 +62,7 @@ module {
}

// NESTED: func @nested_not_all_uses_visible(
func @nested_not_all_uses_visible() -> (i32, i32) {
func.func @nested_not_all_uses_visible() -> (i32, i32) {
// NESTED: %[[CST:.*]] = arith.constant 1 : i32
// NESTED: %[[CALL:.*]]:2 = call @nested
// NESTED: return %[[CST]], %[[CALL]]#1 : i32, i32
Expand All @@ -79,13 +79,13 @@ module {
/// Check that public functions do not track arguments.

// CHECK-LABEL: func @public(
func @public(%arg0 : i32) -> (i32, i32) {
func.func @public(%arg0 : i32) -> (i32, i32) {
%1 = arith.constant 1 : i32
return %1, %arg0 : i32, i32
}

// CHECK-LABEL: func @simple_public(
func @simple_public() -> (i32, i32) {
func.func @simple_public() -> (i32, i32) {
// CHECK: %[[CST:.*]] = arith.constant 1 : i32
// CHECK: %[[CALL:.*]]:2 = call @public
// CHECK: return %[[CST]], %[[CALL]]#1 : i32, i32
Expand All @@ -99,13 +99,13 @@ func @simple_public() -> (i32, i32) {

/// Check that functions with non-call users don't have arguments tracked.

func private @callable(%arg0 : i32) -> (i32, i32) {
func.func private @callable(%arg0 : i32) -> (i32, i32) {
%1 = arith.constant 1 : i32
return %1, %arg0 : i32, i32
}

// CHECK-LABEL: func @non_call_users(
func @non_call_users() -> (i32, i32) {
func.func @non_call_users() -> (i32, i32) {
// CHECK: %[[CST:.*]] = arith.constant 1 : i32
// CHECK: %[[CALL:.*]]:2 = call @callable
// CHECK: return %[[CST]], %[[CALL]]#1 : i32, i32
Expand All @@ -121,12 +121,12 @@ func @non_call_users() -> (i32, i32) {

/// Check that return values are overdefined in the presence of an unknown terminator.

func private @callable(%arg0 : i32) -> i32 {
func.func private @callable(%arg0 : i32) -> i32 {
"unknown.return"(%arg0) : (i32) -> ()
}

// CHECK-LABEL: func @unknown_terminator(
func @unknown_terminator() -> i32 {
func.func @unknown_terminator() -> i32 {
// CHECK: %[[CALL:.*]] = call @callable
// CHECK: return %[[CALL]] : i32

Expand All @@ -139,12 +139,12 @@ func @unknown_terminator() -> i32 {

/// Check that return values are overdefined when the constant conflicts.

func private @callable(%arg0 : i32) -> i32 {
func.func private @callable(%arg0 : i32) -> i32 {
return %arg0 : i32
}

// CHECK-LABEL: func @conflicting_constant(
func @conflicting_constant() -> (i32, i32) {
func.func @conflicting_constant() -> (i32, i32) {
// CHECK: %[[CALL1:.*]] = call @callable
// CHECK: %[[CALL2:.*]] = call @callable
// CHECK: return %[[CALL1]], %[[CALL2]] : i32, i32
Expand All @@ -161,12 +161,12 @@ func @conflicting_constant() -> (i32, i32) {
/// Check that return values are overdefined when the constant conflicts with a
/// non-constant.

func private @callable(%arg0 : i32) -> i32 {
func.func private @callable(%arg0 : i32) -> i32 {
"unknown.return"(%arg0) : (i32) -> ()
}

// CHECK-LABEL: func @conflicting_constant(
func @conflicting_constant(%arg0 : i32) -> (i32, i32) {
func.func @conflicting_constant(%arg0 : i32) -> (i32, i32) {
// CHECK: %[[CALL1:.*]] = call @callable
// CHECK: %[[CALL2:.*]] = call @callable
// CHECK: return %[[CALL1]], %[[CALL2]] : i32, i32
Expand All @@ -182,7 +182,7 @@ func @conflicting_constant(%arg0 : i32) -> (i32, i32) {
/// Check a more complex interaction with calls and control flow.

// CHECK-LABEL: func private @complex_inner_if(
func private @complex_inner_if(%arg0 : i32) -> i32 {
func.func private @complex_inner_if(%arg0 : i32) -> i32 {
// CHECK-DAG: %[[TRUE:.*]] = arith.constant true
// CHECK-DAG: %[[CST:.*]] = arith.constant 1 : i32
// CHECK: cf.cond_br %[[TRUE]], ^bb1
Expand All @@ -204,10 +204,10 @@ func private @complex_inner_if(%arg0 : i32) -> i32 {
return %arg_inc : i32
}

func private @complex_cond() -> i1
func.func private @complex_cond() -> i1

// CHECK-LABEL: func private @complex_callee(
func private @complex_callee(%arg0 : i32) -> i32 {
func.func private @complex_callee(%arg0 : i32) -> i32 {
// CHECK: %[[CST:.*]] = arith.constant 1 : i32

%loop_cond = call @complex_cond() : () -> i1
Expand All @@ -230,7 +230,7 @@ func private @complex_callee(%arg0 : i32) -> i32 {
}

// CHECK-LABEL: func @complex_caller(
func @complex_caller(%arg0 : i32) -> i32 {
func.func @complex_caller(%arg0 : i32) -> i32 {
// CHECK: %[[CST:.*]] = arith.constant 1 : i32
// CHECK: return %[[CST]] : i32

Expand All @@ -244,7 +244,7 @@ func @complex_caller(%arg0 : i32) -> i32 {
/// Check that non-symbol defining callables currently go to overdefined.

// CHECK-LABEL: func @non_symbol_defining_callable
func @non_symbol_defining_callable() -> i32 {
func.func @non_symbol_defining_callable() -> i32 {
// CHECK: %[[RES:.*]] = call_indirect
// CHECK: return %[[RES]] : i32

Expand All @@ -261,7 +261,7 @@ func @non_symbol_defining_callable() -> i32 {
/// Check that private callables don't get processed if they have no uses.

// CHECK-LABEL: func private @unreferenced_private_function
func private @unreferenced_private_function() -> i32 {
func.func private @unreferenced_private_function() -> i32 {
// CHECK: %[[RES:.*]] = arith.select
// CHECK: return %[[RES]] : i32
%true = arith.constant true
Expand Down
20 changes: 10 additions & 10 deletions mlir/test/Transforms/sccp-structured.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// Check that a constant is properly propagated when only one edge is taken.

// CHECK-LABEL: func @simple(
func @simple(%arg0 : i32) -> i32 {
func.func @simple(%arg0 : i32) -> i32 {
// CHECK: %[[CST:.*]] = arith.constant 1 : i32
// CHECK-NOT: scf.if
// CHECK: return %[[CST]] : i32
Expand All @@ -22,7 +22,7 @@ func @simple(%arg0 : i32) -> i32 {
/// same value.

// CHECK-LABEL: func @simple_both_same(
func @simple_both_same(%cond : i1) -> i32 {
func.func @simple_both_same(%cond : i1) -> i32 {
// CHECK: %[[CST:.*]] = arith.constant 1 : i32
// CHECK-NOT: scf.if
// CHECK: return %[[CST]] : i32
Expand All @@ -41,7 +41,7 @@ func @simple_both_same(%cond : i1) -> i32 {
/// a specific successor is taken.

// CHECK-LABEL: func @overdefined_unknown_condition(
func @overdefined_unknown_condition(%cond : i1, %arg0 : i32) -> i32 {
func.func @overdefined_unknown_condition(%cond : i1, %arg0 : i32) -> i32 {
// CHECK: %[[RES:.*]] = scf.if
// CHECK: return %[[RES]] : i32

Expand All @@ -58,7 +58,7 @@ func @overdefined_unknown_condition(%cond : i1, %arg0 : i32) -> i32 {
/// constants.

// CHECK-LABEL: func @overdefined_different_constants(
func @overdefined_different_constants(%cond : i1) -> i32 {
func.func @overdefined_different_constants(%cond : i1) -> i32 {
// CHECK: %[[RES:.*]] = scf.if
// CHECK: return %[[RES]] : i32

Expand All @@ -75,7 +75,7 @@ func @overdefined_different_constants(%cond : i1) -> i32 {
/// Check that arguments are properly merged across loop-like control flow.

// CHECK-LABEL: func @simple_loop(
func @simple_loop(%arg0 : index, %arg1 : index, %arg2 : index) -> i32 {
func.func @simple_loop(%arg0 : index, %arg1 : index, %arg2 : index) -> i32 {
// CHECK: %[[CST:.*]] = arith.constant 0 : i32
// CHECK-NOT: scf.for
// CHECK: return %[[CST]] : i32
Expand All @@ -92,7 +92,7 @@ func @simple_loop(%arg0 : index, %arg1 : index, %arg2 : index) -> i32 {
/// conflicting value.

// CHECK-LABEL: func @loop_overdefined(
func @loop_overdefined(%arg0 : index, %arg1 : index, %arg2 : index) -> i32 {
func.func @loop_overdefined(%arg0 : index, %arg1 : index, %arg2 : index) -> i32 {
// CHECK: %[[RES:.*]] = scf.for
// CHECK: return %[[RES]] : i32

Expand All @@ -109,7 +109,7 @@ func @loop_overdefined(%arg0 : index, %arg1 : index, %arg2 : index) -> i32 {
/// of the analysis.

// CHECK-LABEL: func @loop_inner_control_flow(
func @loop_inner_control_flow(%arg0 : index, %arg1 : index, %arg2 : index) -> i32 {
func.func @loop_inner_control_flow(%arg0 : index, %arg1 : index, %arg2 : index) -> i32 {
// CHECK: %[[CST:.*]] = arith.constant 1 : i32
// CHECK-NOT: scf.for
// CHECK-NOT: scf.if
Expand All @@ -135,7 +135,7 @@ func @loop_inner_control_flow(%arg0 : index, %arg1 : index, %arg2 : index) -> i3
/// implements the RegionBranchTerminatorOpInterface.

// CHECK-LABEL: func @loop_region_branch_terminator_op(
func @loop_region_branch_terminator_op(%arg1 : i32) {
func.func @loop_region_branch_terminator_op(%arg1 : i32) {
// CHECK: %c2_i32 = arith.constant 2 : i32
// CHECK-NEXT: return

Expand All @@ -154,7 +154,7 @@ func @loop_region_branch_terminator_op(%arg1 : i32) {
/// interface as well.

// CHECK-LABEL: func @affine_loop_one_iter(
func @affine_loop_one_iter(%arg0 : index, %arg1 : index, %arg2 : index) -> i32 {
func.func @affine_loop_one_iter(%arg0 : index, %arg1 : index, %arg2 : index) -> i32 {
// CHECK: %[[C1:.*]] = arith.constant 1 : i32
%s0 = arith.constant 0 : i32
%s1 = arith.constant 1 : i32
Expand All @@ -167,7 +167,7 @@ func @affine_loop_one_iter(%arg0 : index, %arg1 : index, %arg2 : index) -> i32 {
}

// CHECK-LABEL: func @affine_loop_zero_iter(
func @affine_loop_zero_iter(%arg0 : index, %arg1 : index, %arg2 : index) -> i32 {
func.func @affine_loop_zero_iter(%arg0 : index, %arg1 : index, %arg2 : index) -> i32 {
// This exposes a crash in sccp/forward data flow analysis: https://github.com/llvm/llvm-project/issues/54928
// CHECK: %[[C0:.*]] = arith.constant 0 : i32
%s0 = arith.constant 0 : i32
Expand Down
24 changes: 12 additions & 12 deletions mlir/test/Transforms/sccp.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// Check simple forward constant propagation without any control flow.

// CHECK-LABEL: func @no_control_flow
func @no_control_flow(%arg0: i32) -> i32 {
func.func @no_control_flow(%arg0: i32) -> i32 {
// CHECK: %[[CST:.*]] = arith.constant 1 : i32
// CHECK: return %[[CST]] : i32

Expand All @@ -17,7 +17,7 @@ func @no_control_flow(%arg0: i32) -> i32 {
/// is taken.

// CHECK-LABEL: func @simple_control_flow
func @simple_control_flow(%arg0 : i32) -> i32 {
func.func @simple_control_flow(%arg0 : i32) -> i32 {
// CHECK: %[[CST:.*]] = arith.constant 1 : i32

%cond = arith.constant true
Expand All @@ -38,7 +38,7 @@ func @simple_control_flow(%arg0 : i32) -> i32 {
/// a specific successor is taken.

// CHECK-LABEL: func @simple_control_flow_overdefined
func @simple_control_flow_overdefined(%arg0 : i32, %arg1 : i1) -> i32 {
func.func @simple_control_flow_overdefined(%arg0 : i32, %arg1 : i1) -> i32 {
%1 = arith.constant 1 : i32
cf.cond_br %arg1, ^bb1, ^bb2(%arg0 : i32)

Expand All @@ -56,7 +56,7 @@ func @simple_control_flow_overdefined(%arg0 : i32, %arg1 : i1) -> i32 {
/// constants.

// CHECK-LABEL: func @simple_control_flow_constant_overdefined
func @simple_control_flow_constant_overdefined(%arg0 : i32, %arg1 : i1) -> i32 {
func.func @simple_control_flow_constant_overdefined(%arg0 : i32, %arg1 : i1) -> i32 {
%1 = arith.constant 1 : i32
%2 = arith.constant 2 : i32
cf.cond_br %arg1, ^bb1, ^bb2(%arg0 : i32)
Expand All @@ -74,7 +74,7 @@ func @simple_control_flow_constant_overdefined(%arg0 : i32, %arg1 : i1) -> i32 {
/// Check that the arguments go to overdefined if the branch is unknown.

// CHECK-LABEL: func @unknown_terminator
func @unknown_terminator(%arg0 : i32, %arg1 : i1) -> i32 {
func.func @unknown_terminator(%arg0 : i32, %arg1 : i1) -> i32 {
%1 = arith.constant 1 : i32
"foo.cond_br"() [^bb1, ^bb2] : () -> ()

Expand All @@ -90,10 +90,10 @@ func @unknown_terminator(%arg0 : i32, %arg1 : i1) -> i32 {

/// Check that arguments are properly merged across loop-like control flow.

func private @ext_cond_fn() -> i1
func.func private @ext_cond_fn() -> i1

// CHECK-LABEL: func @simple_loop
func @simple_loop(%arg0 : i32, %cond1 : i1) -> i32 {
func.func @simple_loop(%arg0 : i32, %cond1 : i1) -> i32 {
// CHECK: %[[CST:.*]] = arith.constant 1 : i32

%cst_1 = arith.constant 1 : i32
Expand Down Expand Up @@ -121,7 +121,7 @@ func @simple_loop(%arg0 : i32, %cond1 : i1) -> i32 {
/// of the analysis.

// CHECK-LABEL: func @simple_loop_inner_control_flow
func @simple_loop_inner_control_flow(%arg0 : i32) -> i32 {
func.func @simple_loop_inner_control_flow(%arg0 : i32) -> i32 {
// CHECK-DAG: %[[CST:.*]] = arith.constant 1 : i32
// CHECK-DAG: %[[TRUE:.*]] = arith.constant true

Expand Down Expand Up @@ -161,10 +161,10 @@ func @simple_loop_inner_control_flow(%arg0 : i32) -> i32 {
/// Check that arguments go to overdefined when loop backedges produce a
/// conflicting value.

func private @ext_cond_and_value_fn() -> (i1, i32)
func.func private @ext_cond_and_value_fn() -> (i1, i32)

// CHECK-LABEL: func @simple_loop_overdefined
func @simple_loop_overdefined(%arg0 : i32, %cond1 : i1) -> i32 {
func.func @simple_loop_overdefined(%arg0 : i32, %cond1 : i1) -> i32 {
%cst_1 = arith.constant 1 : i32
cf.cond_br %cond1, ^bb1(%cst_1 : i32), ^bb2(%cst_1 : i32)

Expand All @@ -182,7 +182,7 @@ func @simple_loop_overdefined(%arg0 : i32, %cond1 : i1) -> i32 {
// Check that we reprocess executable edges when information changes.

// CHECK-LABEL: func @recheck_executable_edge
func @recheck_executable_edge(%cond0: i1) -> (i1, i1) {
func.func @recheck_executable_edge(%cond0: i1) -> (i1, i1) {
%true = arith.constant true
%false = arith.constant false
cf.cond_br %cond0, ^bb_1a, ^bb2(%false : i1)
Expand All @@ -200,7 +200,7 @@ func @recheck_executable_edge(%cond0: i1) -> (i1, i1) {
}

// CHECK-LABEL: func @simple_produced_operand
func @simple_produced_operand() -> (i32, i32) {
func.func @simple_produced_operand() -> (i32, i32) {
// CHECK: %[[ONE:.*]] = arith.constant 1
%1 = arith.constant 1 : i32
"test.internal_br"(%1) [^bb1, ^bb2] {
Expand Down
6 changes: 3 additions & 3 deletions mlir/test/Transforms/scf-if-utils.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// CHECK-NEXT: }
// CHECK-NEXT: return
// CHECK-NEXT: }
func @outline_if_else(%cond: i1, %a: index, %b: memref<?xf32>, %c: i8) {
func.func @outline_if_else(%cond: i1, %a: index, %b: memref<?xf32>, %c: i8) {
%r = scf.if %cond -> (i8) {
%r = "some_op"(%cond, %b) : (i1, memref<?xf32>) -> (i8)
scf.yield %r : i8
Expand All @@ -41,7 +41,7 @@ func @outline_if_else(%cond: i1, %a: index, %b: memref<?xf32>, %c: i8) {
// CHECK-NEXT: }
// CHECK-NEXT: return
// CHECK-NEXT: }
func @outline_if(%cond: i1, %a: index, %b: memref<?xf32>, %c: i8) {
func.func @outline_if(%cond: i1, %a: index, %b: memref<?xf32>, %c: i8) {
scf.if %cond {
"some_op"(%cond, %b) : (i1, memref<?xf32>) -> ()
scf.yield
Expand All @@ -66,7 +66,7 @@ func @outline_if(%cond: i1, %a: index, %b: memref<?xf32>, %c: i8) {
// CHECK-NEXT: }
// CHECK-NEXT: return
// CHECK-NEXT: }
func @outline_empty_if_else(%cond: i1, %a: index, %b: memref<?xf32>, %c: i8) {
func.func @outline_empty_if_else(%cond: i1, %a: index, %b: memref<?xf32>, %c: i8) {
scf.if %cond {
} else {
"some_op"(%cond, %b) : (i1, memref<?xf32>) -> ()
Expand Down
6 changes: 3 additions & 3 deletions mlir/test/Transforms/scf-loop-unroll.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// RUN: mlir-opt %s --test-loop-unrolling="unroll-factor=1" -split-input-file -canonicalize | FileCheck %s --check-prefix UNROLL-BY-1

// CHECK-LABEL: scf_loop_unroll_single
func @scf_loop_unroll_single(%arg0 : f32, %arg1 : f32) -> f32 {
func.func @scf_loop_unroll_single(%arg0 : f32, %arg1 : f32) -> f32 {
%from = arith.constant 0 : index
%to = arith.constant 10 : index
%step = arith.constant 1 : index
Expand All @@ -23,7 +23,7 @@ func @scf_loop_unroll_single(%arg0 : f32, %arg1 : f32) -> f32 {

// CHECK-LABEL: scf_loop_unroll_double_symbolic_ub
// CHECK-SAME: (%{{.*}}: f32, %{{.*}}: f32, %[[N:.*]]: index)
func @scf_loop_unroll_double_symbolic_ub(%arg0 : f32, %arg1 : f32, %n : index) -> (f32,f32) {
func.func @scf_loop_unroll_double_symbolic_ub(%arg0 : f32, %arg1 : f32, %n : index) -> (f32,f32) {
%from = arith.constant 0 : index
%step = arith.constant 1 : index
%sum:2 = scf.for %iv = %from to %n step %step iter_args(%i0 = %arg0, %i1 = %arg1) -> (f32, f32) {
Expand All @@ -45,7 +45,7 @@ func @scf_loop_unroll_double_symbolic_ub(%arg0 : f32, %arg1 : f32, %n : index) -
}

// UNROLL-BY-1-LABEL: scf_loop_unroll_factor_1_promote
func @scf_loop_unroll_factor_1_promote() -> () {
func.func @scf_loop_unroll_factor_1_promote() -> () {
%step = arith.constant 1 : index
%lo = arith.constant 0 : index
%hi = arith.constant 1 : index
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/Transforms/scf-loop-utils.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// CHECK-SAME: %[[lb:[a-zA-Z0-9]*]]: index,
// CHECK-SAME: %[[ub:[a-zA-Z0-9]*]]: index,
// CHECK-SAME: %[[step:[a-zA-Z0-9]*]]: index
func @hoist(%lb: index, %ub: index, %step: index) {
func.func @hoist(%lb: index, %ub: index, %step: index) {
// CHECK: %[[A:.*]] = "fake_read"() : () -> index
// CHECK: %[[RES:.*]] = scf.for %[[I:.*]] = %[[lb]] to %[[ub]] step %[[step]] iter_args(%[[VAL:.*]] = %[[A]]) -> (index)
// CHECK: %[[YIELD:.*]] = "fake_compute"(%[[VAL]]) : (index) -> index
Expand All @@ -23,7 +23,7 @@ func @hoist(%lb: index, %ub: index, %step: index) {
// CHECK-SAME: %[[ub:[a-zA-Z0-9]*]]: index,
// CHECK-SAME: %[[step:[a-zA-Z0-9]*]]: index
// CHECK-SAME: %[[extra_arg:[a-zA-Z0-9]*]]: f32
func @hoist2(%lb: index, %ub: index, %step: index, %extra_arg: f32) -> f32 {
func.func @hoist2(%lb: index, %ub: index, %step: index, %extra_arg: f32) -> f32 {
// CHECK: %[[A:.*]] = "fake_read"() : () -> index
// CHECK: %[[RES:.*]]:2 = scf.for %[[I:.*]] = %[[lb]] to %[[ub]] step %[[step]] iter_args(%[[VAL0:.*]] = %[[extra_arg]], %[[VAL1:.*]] = %[[A]]) -> (f32, index)
// CHECK: %[[YIELD:.*]] = "fake_compute"(%[[VAL1]]) : (index) -> index
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/Transforms/single-parallel-loop-collapsing.mlir
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='func.func(scf-parallel-loop-collapsing{collapsed-indices-0=0,1}, canonicalize)' | FileCheck %s

func @collapse_to_single() {
func.func @collapse_to_single() {
%c0 = arith.constant 3 : index
%c1 = arith.constant 7 : index
%c2 = arith.constant 11 : index
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/Transforms/strip-debuginfo.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#set0 = affine_set<(d0) : (1 == 0)>

// CHECK-LABEL: func @inline_notation
func @inline_notation() -> i32 {
func.func @inline_notation() -> i32 {
// CHECK: "foo"() : () -> i32 loc(unknown)
%1 = "foo"() : () -> i32 loc("foo")

Expand Down
2 changes: 1 addition & 1 deletion mlir/test/Transforms/test-canonicalize-filter.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// FILTER_ENABLE-NEXT: return
// FILTER_DISABLE-LABEL: func @remove_op_with_inner_ops_pattern
// FILTER_DISABLE-NEXT: "test.op_with_region_pattern"()
func @remove_op_with_inner_ops_pattern() {
func.func @remove_op_with_inner_ops_pattern() {
"test.op_with_region_pattern"() ({
"test.op_with_region_terminator"() : () -> ()
}) : () -> ()
Expand Down
16 changes: 8 additions & 8 deletions mlir/test/Transforms/test-canonicalize.mlir
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: mlir-opt %s -pass-pipeline='func.func(canonicalize)' | FileCheck %s

// CHECK-LABEL: func @remove_op_with_inner_ops_pattern
func @remove_op_with_inner_ops_pattern() {
func.func @remove_op_with_inner_ops_pattern() {
// CHECK-NEXT: return
"test.op_with_region_pattern"() ({
"test.op_with_region_terminator"() : () -> ()
Expand All @@ -10,7 +10,7 @@ func @remove_op_with_inner_ops_pattern() {
}

// CHECK-LABEL: func @remove_op_with_inner_ops_fold_no_side_effect
func @remove_op_with_inner_ops_fold_no_side_effect() {
func.func @remove_op_with_inner_ops_fold_no_side_effect() {
// CHECK-NEXT: return
"test.op_with_region_fold_no_side_effect"() ({
"test.op_with_region_terminator"() : () -> ()
Expand All @@ -20,7 +20,7 @@ func @remove_op_with_inner_ops_fold_no_side_effect() {

// CHECK-LABEL: func @remove_op_with_inner_ops_fold
// CHECK-SAME: (%[[ARG_0:[a-z0-9]*]]: i32)
func @remove_op_with_inner_ops_fold(%arg0 : i32) -> (i32) {
func.func @remove_op_with_inner_ops_fold(%arg0 : i32) -> (i32) {
// CHECK-NEXT: return %[[ARG_0]]
%0 = "test.op_with_region_fold"(%arg0) ({
"test.op_with_region_terminator"() : () -> ()
Expand All @@ -30,15 +30,15 @@ func @remove_op_with_inner_ops_fold(%arg0 : i32) -> (i32) {

// CHECK-LABEL: func @remove_op_with_variadic_results_and_folder
// CHECK-SAME: (%[[ARG_0:[a-z0-9]*]]: i32, %[[ARG_1:[a-z0-9]*]]: i32)
func @remove_op_with_variadic_results_and_folder(%arg0 : i32, %arg1 : i32) -> (i32, i32) {
func.func @remove_op_with_variadic_results_and_folder(%arg0 : i32, %arg1 : i32) -> (i32, i32) {
// CHECK-NEXT: return %[[ARG_0]], %[[ARG_1]]
%0, %1 = "test.op_with_variadic_results_and_folder"(%arg0, %arg1) : (i32, i32) -> (i32, i32)
return %0, %1 : i32, i32
}

// CHECK-LABEL: func @test_commutative_multi
// CHECK-SAME: (%[[ARG_0:[a-z0-9]*]]: i32, %[[ARG_1:[a-z0-9]*]]: i32)
func @test_commutative_multi(%arg0: i32, %arg1: i32) -> (i32, i32) {
func.func @test_commutative_multi(%arg0: i32, %arg1: i32) -> (i32, i32) {
// CHECK-DAG: %[[C42:.*]] = arith.constant 42 : i32
%c42_i32 = arith.constant 42 : i32
// CHECK-DAG: %[[C43:.*]] = arith.constant 43 : i32
Expand All @@ -54,7 +54,7 @@ func @test_commutative_multi(%arg0: i32, %arg1: i32) -> (i32, i32) {


// CHECK-LABEL: func @test_commutative_multi_cst
func @test_commutative_multi_cst(%arg0: i32, %arg1: i32) -> (i32, i32) {
func.func @test_commutative_multi_cst(%arg0: i32, %arg1: i32) -> (i32, i32) {
// CHECK-NEXT: %c42_i32 = arith.constant 42 : i32
%c42_i32 = arith.constant 42 : i32
%c42_i32_2 = arith.constant 42 : i32
Expand All @@ -71,7 +71,7 @@ func @test_commutative_multi_cst(%arg0: i32, %arg1: i32) -> (i32, i32) {

// CHECK-LABEL: func @typemismatch

func @typemismatch() -> i32 {
func.func @typemismatch() -> i32 {
%c42 = arith.constant 42.0 : f32

// The "passthrough_fold" folder will naively return its operand, but we don't
Expand All @@ -83,7 +83,7 @@ func @typemismatch() -> i32 {
}

// CHECK-LABEL: test_dialect_canonicalizer
func @test_dialect_canonicalizer() -> (i32) {
func.func @test_dialect_canonicalizer() -> (i32) {
%0 = "test.dialect_canonicalizable"() : () -> (i32)
// CHECK: %[[CST:.*]] = arith.constant 42 : i32
// CHECK: return %[[CST]]
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/Transforms/test-convert-call-op.mlir
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// RUN: mlir-opt %s -test-convert-call-op | FileCheck %s

// CHECK-LABEL: llvm.func @callee(!llvm.ptr<i8>) -> i32
func private @callee(!test.test_type) -> i32
func.func private @callee(!test.test_type) -> i32

// CHECK-NEXT: llvm.func @caller() -> i32
func @caller() -> i32 {
func.func @caller() -> i32 {
%arg = "test.type_producer"() : () -> !test.test_type
%out = call @callee(%arg) : (!test.test_type) -> i32
return %out : i32
Expand Down
8 changes: 4 additions & 4 deletions mlir/test/Transforms/test-inlining.mlir
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: mlir-opt -allow-unregistered-dialect %s -test-inline | FileCheck %s

// CHECK-LABEL: func @inline_with_arg
func @inline_with_arg(%arg0 : i32) -> i32 {
func.func @inline_with_arg(%arg0 : i32) -> i32 {
// CHECK-NEXT: %[[ADD:.*]] = arith.addi %{{.*}}, %{{.*}} : i32
// CHECK-NEXT: return %[[ADD]] : i32
%fn = "test.functional_region_op"() ({
Expand All @@ -15,7 +15,7 @@ func @inline_with_arg(%arg0 : i32) -> i32 {
}

// CHECK-LABEL: func @no_inline_invalid_nested_operation
func @no_inline_invalid_nested_operation() {
func.func @no_inline_invalid_nested_operation() {
// CHECK: call_indirect

// test.region is analyzed recursively, so it must not have an invalid op.
Expand All @@ -32,7 +32,7 @@ func @no_inline_invalid_nested_operation() {
}

// CHECK-LABEL: func @inline_ignore_invalid_nested_operation
func @inline_ignore_invalid_nested_operation() {
func.func @inline_ignore_invalid_nested_operation() {
// CHECK-NOT: call_indirect

// test.functional_region_op is not analyzed recursively, so it may have an
Expand All @@ -50,7 +50,7 @@ func @inline_ignore_invalid_nested_operation() {
}

// CHECK-LABEL: func @no_inline_invalid_dest_region
func @no_inline_invalid_dest_region() {
func.func @no_inline_invalid_dest_region() {
// CHECK: call_indirect

// foo.unknown_region is unknown, so we can't inline into it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Test that an error is emitted when an operation is marked as "erased", but
// has users that live across the conversion.
func @remove_all_ops(%arg0: i32) -> i32 {
func.func @remove_all_ops(%arg0: i32) -> i32 {
// expected-error@below {{failed to legalize operation 'test.illegal_op_a' marked as erased}}
%0 = "test.illegal_op_a"() : () -> i32
// expected-note@below {{found live user of result #0: return %0 : i32}}
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/Transforms/test-legalize-remapped-value.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// CHECK-NEXT: %[[VAL:.*]] = "test.one_variadic_out_one_variadic_in1"(%[[ARG]], %[[ARG]])
// CHECK-NEXT: "test.one_variadic_out_one_variadic_in1"(%[[VAL]], %[[VAL]])

func @remap_input_1_to_1(%arg0: i32) {
func.func @remap_input_1_to_1(%arg0: i32) {
%0 = "test.one_variadic_out_one_variadic_in1"(%arg0) : (i32) -> i32
%1 = "test.one_variadic_out_one_variadic_in1"(%0) : (i32) -> i32
"test.return"() : () -> ()
Expand All @@ -18,7 +18,7 @@ func @remap_input_1_to_1(%arg0: i32) {
// CHECK-LABEL: func @remap_unconverted
// CHECK-NEXT: %[[VAL:.*]] = "test.type_producer"() : () -> f64
// CHECK-NEXT: "test.type_consumer"(%[[VAL]]) : (f64)
func @remap_unconverted() {
func.func @remap_unconverted() {
%region_result = "test.remapped_value_region"() ({
%result = "test.type_producer"() : () -> f32
"test.return"(%result) : (f32) -> ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// dummy cast to be dead.

// CHECK-LABEL: @foo
func @foo() {
func.func @foo() {
%0 = "test.type_producer"() : () -> i32
// CHECK: test.cast
// CHECK-NOT: test.type_changer
Expand Down
22 changes: 11 additions & 11 deletions mlir/test/Transforms/test-legalize-type-conversion.mlir
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: mlir-opt %s -test-legalize-type-conversion -allow-unregistered-dialect -split-input-file -verify-diagnostics | FileCheck %s


func @test_invalid_arg_materialization(
func.func @test_invalid_arg_materialization(
// expected-error@below {{failed to materialize conversion for block argument #0 that remained live after conversion, type was 'i16'}}
%arg0: i16) {
// expected-note@below {{see existing live user here}}
Expand All @@ -11,7 +11,7 @@ func @test_invalid_arg_materialization(
// -----

// CHECK-LABEL: func @test_valid_arg_materialization
func @test_valid_arg_materialization(%arg0: i64) {
func.func @test_valid_arg_materialization(%arg0: i64) {
// CHECK: %[[ARG:.*]] = "test.type_producer"
// CHECK: "foo.return"(%[[ARG]]) : (i64)

Expand All @@ -20,7 +20,7 @@ func @test_valid_arg_materialization(%arg0: i64) {

// -----

func @test_invalid_result_materialization() {
func.func @test_invalid_result_materialization() {
// expected-error@below {{failed to materialize conversion for result #0 of operation 'test.type_producer' that remained live after conversion}}
%result = "test.type_producer"() : () -> f16

Expand All @@ -30,7 +30,7 @@ func @test_invalid_result_materialization() {

// -----

func @test_invalid_result_materialization() {
func.func @test_invalid_result_materialization() {
// expected-error@below {{failed to materialize conversion for result #0 of operation 'test.type_producer' that remained live after conversion}}
%result = "test.type_producer"() : () -> f16

Expand All @@ -41,7 +41,7 @@ func @test_invalid_result_materialization() {
// -----

// CHECK-LABEL: @test_transitive_use_materialization
func @test_transitive_use_materialization() {
func.func @test_transitive_use_materialization() {
// CHECK: %[[V:.*]] = "test.type_producer"() : () -> f64
// CHECK: %[[C:.*]] = "test.cast"(%[[V]]) : (f64) -> f32
%result = "test.another_type_producer"() : () -> f32
Expand All @@ -51,7 +51,7 @@ func @test_transitive_use_materialization() {

// -----

func @test_transitive_use_invalid_materialization() {
func.func @test_transitive_use_invalid_materialization() {
// expected-error@below {{failed to materialize conversion for result #0 of operation 'test.type_producer' that remained live after conversion}}
%result = "test.another_type_producer"() : () -> f16
// expected-note@below {{see existing live user here}}
Expand All @@ -61,7 +61,7 @@ func @test_transitive_use_invalid_materialization() {
// -----

// CHECK-LABEL: func @test_valid_result_legalization
func @test_valid_result_legalization() {
func.func @test_valid_result_legalization() {
// CHECK: %[[RESULT:.*]] = "test.type_producer"() : () -> f64
// CHECK: %[[CAST:.*]] = "test.cast"(%[[RESULT]]) : (f64) -> f32
// CHECK: "foo.return"(%[[CAST]]) : (f32)
Expand All @@ -74,7 +74,7 @@ func @test_valid_result_legalization() {

// Should not segfault here but gracefully fail.
// CHECK-LABEL: func @test_signature_conversion_undo
func @test_signature_conversion_undo() {
func.func @test_signature_conversion_undo() {
// CHECK: test.signature_conversion_undo
"test.signature_conversion_undo"() ({
// CHECK: ^{{.*}}(%{{.*}}: f32):
Expand All @@ -89,7 +89,7 @@ func @test_signature_conversion_undo() {

// Should not segfault here but gracefully fail.
// CHECK-LABEL: func @test_block_argument_not_converted
func @test_block_argument_not_converted() {
func.func @test_block_argument_not_converted() {
"test.unsupported_block_arg_type"() ({
// NOTE: The test pass does not convert `index` types.
// CHECK: ^bb0({{.*}}: index):
Expand All @@ -102,7 +102,7 @@ func @test_block_argument_not_converted() {
// -----

// Make sure argument type changes aren't implicitly forwarded.
func @test_signature_conversion_no_converter() {
func.func @test_signature_conversion_no_converter() {
"test.signature_conversion_no_converter"() ({
// expected-error@below {{failed to materialize conversion for block argument #0 that remained live after conversion}}
^bb0(%arg0: f32):
Expand All @@ -116,7 +116,7 @@ func @test_signature_conversion_no_converter() {
// -----

// CHECK-LABEL: @recursive_type_conversion
func @recursive_type_conversion() {
func.func @recursive_type_conversion() {
// CHECK: !test.test_rec<outer_converted_type, smpla>
"test.type_producer"() : () -> !test.test_rec<something, test_rec<something>>
return
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/Transforms/test-legalize-unknown-root.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Test that all `test` dialect operations are removed.
// CHECK-LABEL: func @remove_all_ops
func @remove_all_ops(%arg0: i32) {
func.func @remove_all_ops(%arg0: i32) {
// CHECK-NEXT: return
%0 = "test.illegal_op_a"() : () -> i32
%1 = "test.illegal_op_b"() : () -> i32
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/Transforms/test-legalizer-analysis.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// expected-remark@-2 {{op 'builtin.module' is legalizable}}

// expected-remark@+1 {{op 'func.func' is legalizable}}
func @test(%arg0: f32) {
func.func @test(%arg0: f32) {
// expected-remark@+1 {{op 'test.illegal_op_a' is legalizable}}
%result = "test.illegal_op_a"() : () -> (i32)
"foo.region"() ({
Expand Down
18 changes: 9 additions & 9 deletions mlir/test/Transforms/test-legalizer-full.mlir
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: mlir-opt -allow-unregistered-dialect -test-legalize-patterns -test-legalize-mode=full -split-input-file -verify-diagnostics %s | FileCheck %s

// CHECK-LABEL: func @multi_level_mapping
func @multi_level_mapping() {
func.func @multi_level_mapping() {
// CHECK: "test.type_producer"() : () -> f64
// CHECK: "test.type_consumer"(%{{.*}}) : (f64) -> ()
%result = "test.type_producer"() : () -> i32
Expand All @@ -11,7 +11,7 @@ func @multi_level_mapping() {

// Test that operations that are erased don't need to be legalized.
// CHECK-LABEL: func @dropped_region_with_illegal_ops
func @dropped_region_with_illegal_ops() {
func.func @dropped_region_with_illegal_ops() {
// CHECK-NEXT: test.return
"test.drop_region_op"() ({
%ignored = "test.illegal_op_f"() : () -> (i32)
Expand All @@ -20,7 +20,7 @@ func @dropped_region_with_illegal_ops() {
"test.return"() : () -> ()
}
// CHECK-LABEL: func @replace_non_root_illegal_op
func @replace_non_root_illegal_op() {
func.func @replace_non_root_illegal_op() {
// CHECK-NEXT: "test.legal_op_b"
// CHECK-NEXT: test.return
%result = "test.replace_non_root"() : () -> (i32)
Expand All @@ -30,7 +30,7 @@ func @replace_non_root_illegal_op() {
// -----

// Test that children of recursively legal operations are ignored.
func @recursively_legal_invalid_op() {
func.func @recursively_legal_invalid_op() {
/// Operation that is statically legal.
builtin.module attributes {test.recursively_legal} {
%ignored = "test.illegal_op_f"() : () -> (i32)
Expand All @@ -51,7 +51,7 @@ func @recursively_legal_invalid_op() {
builtin.module {

// Test that region cloning can be properly undone.
func @test_undo_region_clone() {
func.func @test_undo_region_clone() {
"test.region"() ({
^bb1(%i0: i64):
"test.invalid"(%i0) : (i64) -> ()
Expand All @@ -70,7 +70,7 @@ builtin.module {
builtin.module {

// Test that unknown operations can be dynamically legal.
func @test_unknown_dynamically_legal() {
func.func @test_unknown_dynamically_legal() {
"foo.unknown_op"() {test.dynamically_legal} : () -> ()

// expected-error@+1 {{failed to legalize operation 'foo.unknown_op'}}
Expand All @@ -86,7 +86,7 @@ builtin.module {
builtin.module {

// Test that region inlining can be properly undone.
func @test_undo_region_inline() {
func.func @test_undo_region_inline() {
"test.region"() ({
^bb1(%i0: i64):
// expected-error@+1 {{failed to legalize operation 'cf.br'}}
Expand All @@ -106,7 +106,7 @@ builtin.module {
builtin.module {

// Test that multiple block erases can be properly undone.
func @test_undo_block_erase() {
func.func @test_undo_block_erase() {
// expected-error@+1 {{failed to legalize operation 'test.region'}}
"test.region"() ({
^bb1(%i0: i64):
Expand All @@ -125,7 +125,7 @@ builtin.module {
// expected-remark@+1 {{applyFullConversion failed}}
builtin.module {

func @create_unregistered_op_in_pattern() -> i32 {
func.func @create_unregistered_op_in_pattern() -> i32 {
// expected-error@+1 {{failed to legalize operation 'test.illegal_op_g'}}
%0 = "test.illegal_op_g"() : () -> (i32)
"test.return"(%0) : (i32) -> ()
Expand Down
58 changes: 29 additions & 29 deletions mlir/test/Transforms/test-legalizer.mlir
Original file line number Diff line number Diff line change
@@ -1,75 +1,75 @@
// RUN: mlir-opt -allow-unregistered-dialect -split-input-file -test-legalize-patterns -verify-diagnostics %s | FileCheck %s

// CHECK-LABEL: verifyDirectPattern
func @verifyDirectPattern() -> i32 {
func.func @verifyDirectPattern() -> i32 {
// CHECK-NEXT: "test.legal_op_a"() {status = "Success"}
%result = "test.illegal_op_a"() : () -> (i32)
// expected-remark@+1 {{op 'func.return' is not legalizable}}
return %result : i32
}

// CHECK-LABEL: verifyLargerBenefit
func @verifyLargerBenefit() -> i32 {
func.func @verifyLargerBenefit() -> i32 {
// CHECK-NEXT: "test.legal_op_a"() {status = "Success"}
%result = "test.illegal_op_c"() : () -> (i32)
// expected-remark@+1 {{op 'func.return' is not legalizable}}
return %result : i32
}

// CHECK-LABEL: func private @remap_input_1_to_0()
func private @remap_input_1_to_0(i16)
func.func private @remap_input_1_to_0(i16)

// CHECK-LABEL: func @remap_input_1_to_1(%arg0: f64)
func @remap_input_1_to_1(%arg0: i64) {
func.func @remap_input_1_to_1(%arg0: i64) {
// CHECK-NEXT: "test.valid"{{.*}} : (f64)
"test.invalid"(%arg0) : (i64) -> ()
}

// CHECK-LABEL: func @remap_call_1_to_1(%arg0: f64)
func @remap_call_1_to_1(%arg0: i64) {
func.func @remap_call_1_to_1(%arg0: i64) {
// CHECK-NEXT: call @remap_input_1_to_1(%arg0) : (f64) -> ()
call @remap_input_1_to_1(%arg0) : (i64) -> ()
// expected-remark@+1 {{op 'func.return' is not legalizable}}
return
}

// CHECK-LABEL: func @remap_input_1_to_N({{.*}}f16, {{.*}}f16)
func @remap_input_1_to_N(%arg0: f32) -> f32 {
func.func @remap_input_1_to_N(%arg0: f32) -> f32 {
// CHECK-NEXT: "test.return"{{.*}} : (f16, f16) -> ()
"test.return"(%arg0) : (f32) -> ()
}

// CHECK-LABEL: func @remap_input_1_to_N_remaining_use(%arg0: f16, %arg1: f16)
func @remap_input_1_to_N_remaining_use(%arg0: f32) {
func.func @remap_input_1_to_N_remaining_use(%arg0: f32) {
// CHECK-NEXT: [[CAST:%.*]] = "test.cast"(%arg0, %arg1) : (f16, f16) -> f32
// CHECK-NEXT: "work"([[CAST]]) : (f32) -> ()
// expected-remark@+1 {{op 'work' is not legalizable}}
"work"(%arg0) : (f32) -> ()
}

// CHECK-LABEL: func @remap_materialize_1_to_1(%{{.*}}: i43)
func @remap_materialize_1_to_1(%arg0: i42) {
func.func @remap_materialize_1_to_1(%arg0: i42) {
// CHECK: %[[V:.*]] = "test.cast"(%arg0) : (i43) -> i42
// CHECK: "test.return"(%[[V]])
"test.return"(%arg0) : (i42) -> ()
}

// CHECK-LABEL: func @remap_input_to_self
func @remap_input_to_self(%arg0: index) {
func.func @remap_input_to_self(%arg0: index) {
// CHECK-NOT: test.cast
// CHECK: "work"
// expected-remark@+1 {{op 'work' is not legalizable}}
"work"(%arg0) : (index) -> ()
}

// CHECK-LABEL: func @remap_multi(%arg0: f64, %arg1: f64) -> (f64, f64)
func @remap_multi(%arg0: i64, %unused: i16, %arg1: i64) -> (i64, i64) {
func.func @remap_multi(%arg0: i64, %unused: i16, %arg1: i64) -> (i64, i64) {
// CHECK-NEXT: "test.valid"{{.*}} : (f64, f64)
"test.invalid"(%arg0, %arg1) : (i64, i64) -> ()
}

// CHECK-LABEL: func @no_remap_nested
func @no_remap_nested() {
func.func @no_remap_nested() {
// CHECK-NEXT: "foo.region"
// expected-remark@+1 {{op 'foo.region' is not legalizable}}
"foo.region"() ({
Expand All @@ -83,7 +83,7 @@ func @no_remap_nested() {
}

// CHECK-LABEL: func @remap_moved_region_args
func @remap_moved_region_args() {
func.func @remap_moved_region_args() {
// CHECK-NEXT: return
// CHECK-NEXT: ^bb1(%{{.*}}: f64, %{{.*}}: f64, %{{.*}}: f16, %{{.*}}: f16):
// CHECK-NEXT: "test.cast"{{.*}} : (f16, f16) -> f32
Expand All @@ -97,7 +97,7 @@ func @remap_moved_region_args() {
}

// CHECK-LABEL: func @remap_cloned_region_args
func @remap_cloned_region_args() {
func.func @remap_cloned_region_args() {
// CHECK-NEXT: return
// CHECK-NEXT: ^bb1(%{{.*}}: f64, %{{.*}}: f64, %{{.*}}: f16, %{{.*}}: f16):
// CHECK-NEXT: "test.cast"{{.*}} : (f16, f16) -> f32
Expand All @@ -111,7 +111,7 @@ func @remap_cloned_region_args() {
}

// CHECK-LABEL: func @remap_drop_region
func @remap_drop_region() {
func.func @remap_drop_region() {
// CHECK-NEXT: return
// CHECK-NEXT: }
"test.drop_region_op"() ({
Expand All @@ -123,15 +123,15 @@ func @remap_drop_region() {
}

// CHECK-LABEL: func @dropped_input_in_use
func @dropped_input_in_use(%arg: i16, %arg2: i64) {
func.func @dropped_input_in_use(%arg: i16, %arg2: i64) {
// CHECK-NEXT: "test.cast"{{.*}} : () -> i16
// CHECK-NEXT: "work"{{.*}} : (i16)
// expected-remark@+1 {{op 'work' is not legalizable}}
"work"(%arg) : (i16) -> ()
}

// CHECK-LABEL: func @up_to_date_replacement
func @up_to_date_replacement(%arg: i8) -> i8 {
func.func @up_to_date_replacement(%arg: i8) -> i8 {
// CHECK-NEXT: return
%repl_1 = "test.rewrite"(%arg) : (i8) -> i8
%repl_2 = "test.rewrite"(%repl_1) : (i8) -> i8
Expand All @@ -141,7 +141,7 @@ func @up_to_date_replacement(%arg: i8) -> i8 {

// CHECK-LABEL: func @remove_foldable_op
// CHECK-SAME: (%[[ARG_0:[a-z0-9]*]]: i32)
func @remove_foldable_op(%arg0 : i32) -> (i32) {
func.func @remove_foldable_op(%arg0 : i32) -> (i32) {
// CHECK-NEXT: return %[[ARG_0]]
%0 = "test.op_with_region_fold"(%arg0) ({
"foo.op_with_region_terminator"() : () -> ()
Expand All @@ -151,7 +151,7 @@ func @remove_foldable_op(%arg0 : i32) -> (i32) {
}

// CHECK-LABEL: @create_block
func @create_block() {
func.func @create_block() {
// Check that we created a block with arguments.
// CHECK-NOT: test.create_block
// CHECK: ^{{.*}}(%{{.*}}: i32, %{{.*}}: i32):
Expand All @@ -162,7 +162,7 @@ func @create_block() {
}

// CHECK-LABEL: @bounded_recursion
func @bounded_recursion() {
func.func @bounded_recursion() {
// CHECK: test.recursive_rewrite 0
test.recursive_rewrite 3
// expected-remark@+1 {{op 'func.return' is not legalizable}}
Expand All @@ -174,7 +174,7 @@ func @bounded_recursion() {
// expected-remark@+1 {{applyPartialConversion failed}}
builtin.module {

func @fail_to_convert_illegal_op() -> i32 {
func.func @fail_to_convert_illegal_op() -> i32 {
// expected-error@+1 {{failed to legalize operation 'test.illegal_op_f'}}
%result = "test.illegal_op_f"() : () -> (i32)
return %result : i32
Expand All @@ -187,7 +187,7 @@ builtin.module {
// expected-remark@+1 {{applyPartialConversion failed}}
builtin.module {

func @fail_to_convert_illegal_op_in_region() {
func.func @fail_to_convert_illegal_op_in_region() {
// expected-error@+1 {{failed to legalize operation 'test.region_builder'}}
"test.region_builder"() : () -> ()
return
Expand All @@ -203,7 +203,7 @@ builtin.module {
// expected-remark@+1 {{applyPartialConversion failed}}
builtin.module {

func @fail_to_convert_region() {
func.func @fail_to_convert_region() {
// CHECK: "test.region"
// CHECK-NEXT: ^bb{{.*}}(%{{.*}}: i64):
"test.region"() ({
Expand All @@ -220,7 +220,7 @@ builtin.module {
// -----

// CHECK-LABEL: @create_illegal_block
func @create_illegal_block() {
func.func @create_illegal_block() {
// Check that we can undo block creation, i.e. that the block was removed.
// CHECK: test.create_illegal_block
// CHECK-NOT: ^{{.*}}(%{{.*}}: i32, %{{.*}}: i32):
Expand All @@ -234,7 +234,7 @@ func @create_illegal_block() {
// -----

// CHECK-LABEL: @undo_block_arg_replace
func @undo_block_arg_replace() {
func.func @undo_block_arg_replace() {
// expected-remark@+1 {{op 'test.undo_block_arg_replace' is not legalizable}}
"test.undo_block_arg_replace"() ({
^bb0(%arg0: i32):
Expand All @@ -253,7 +253,7 @@ func @undo_block_arg_replace() {
// a pattern that removes its second block after adding an operation into it.
// Check that we can undo block removal successfully.
// CHECK-LABEL: @undo_block_erase
func @undo_block_erase() {
func.func @undo_block_erase() {
// CHECK: test.undo_block_erase
"test.undo_block_erase"() ({
// expected-remark@-1 {{not legalizable}}
Expand All @@ -276,7 +276,7 @@ func @undo_block_erase() {
// created ops in the inverse order, i.e. deleting the parent op and then the
// child op.
// CHECK-LABEL: @undo_child_created_before_parent
func @undo_child_created_before_parent() {
func.func @undo_child_created_before_parent() {
// expected-remark@+1 {{is not legalizable}}
"test.illegal_op_with_region_anchor"() : () -> ()
// expected-remark@+1 {{op 'func.return' is not legalizable}}
Expand All @@ -288,7 +288,7 @@ func @undo_child_created_before_parent() {
// Check that a conversion pattern on `test.blackhole` can mark the producer
// for deletion.
// CHECK-LABEL: @blackhole
func @blackhole() {
func.func @blackhole() {
%input = "test.blackhole_producer"() : () -> (i32)
"test.blackhole"(%input) : (i32) -> ()
// expected-remark@+1 {{op 'func.return' is not legalizable}}
Expand All @@ -300,7 +300,7 @@ func @blackhole() {
// expected-remark@+1 {{applyPartialConversion failed}}
builtin.module {

func @create_unregistered_op_in_pattern() -> i32 {
func.func @create_unregistered_op_in_pattern() -> i32 {
// expected-error@+1 {{failed to legalize operation 'test.illegal_op_g'}}
%0 = "test.illegal_op_g"() : () -> (i32)
"test.return"(%0) : (i32) -> ()
Expand All @@ -312,7 +312,7 @@ builtin.module {

// The "passthrough_fold" folder will naively return its operand, but we don't
// want to fold here because of the type mismatch.
func @typemismatch(%arg: f32) -> i32 {
func.func @typemismatch(%arg: f32) -> i32 {
// expected-remark@+1 {{op 'test.passthrough_fold' is not legalizable}}
%0 = "test.passthrough_fold"(%arg) : (f32) -> (i32)
"test.return"(%0) : (i32) -> ()
Expand Down
6 changes: 3 additions & 3 deletions mlir/test/Transforms/test-merge-blocks.mlir
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: mlir-opt -allow-unregistered-dialect -split-input-file -test-merge-blocks -verify-diagnostics %s | FileCheck %s

// CHECK-LABEL: @merge_blocks
func @merge_blocks(%arg0: i32, %arg1 : i32) -> () {
func.func @merge_blocks(%arg0: i32, %arg1 : i32) -> () {
// CHECK: "test.merge_blocks"() ({
// CHECK-NEXT: "test.return"
// CHECK-NEXT: })
Expand All @@ -22,7 +22,7 @@ func @merge_blocks(%arg0: i32, %arg1 : i32) -> () {
// after adding an operation into it. Check that we can undo block
// removal successfully.
// CHECK-LABEL: @undo_blocks_merge
func @undo_blocks_merge(%arg0: i32) {
func.func @undo_blocks_merge(%arg0: i32) {
"test.undo_blocks_merge"() ({
// expected-remark@-1 {{op 'test.undo_blocks_merge' is not legalizable}}
// CHECK: "unregistered.return"(%{{.*}})[^[[BB:.*]]]
Expand All @@ -39,7 +39,7 @@ func @undo_blocks_merge(%arg0: i32) {
// -----

// CHECK-LABEL: @inline_regions()
func @inline_regions() -> ()
func.func @inline_regions() -> ()
{
// CHECK: test.SingleBlockImplicitTerminator
// CHECK-NEXT: %[[T0:.*]] = "test.type_producer"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: mlir-opt --pass-pipeline="func.func(test-patterns)" %s | FileCheck %s

// CHECK-LABEL: func @test_reorder_constants_and_match
func @test_reorder_constants_and_match(%arg0 : i32) -> (i32) {
func.func @test_reorder_constants_and_match(%arg0 : i32) -> (i32) {
// CHECK: %[[CST:.+]] = arith.constant 43
%cst = arith.constant 43 : i32
// CHECK: return %[[CST]]
Expand Down
Loading