diff --git a/flang/test/Fir/Todo/allocmem.fir b/flang/test/Fir/Todo/allocmem.fir --- a/flang/test/Fir/Todo/allocmem.fir +++ b/flang/test/Fir/Todo/allocmem.fir @@ -3,7 +3,7 @@ // Test `fir.allocmem` of derived type with LEN parameters conversion to llvm. // Not implemented yet. -func @allocmem_test(%arg0 : i32, %arg1 : i16) { +func.func @allocmem_test(%arg0 : i32, %arg1 : i16) { // CHECK: not yet implemented fir.allocmem codegen of derived type with length parameters %0 = fir.allocmem !fir.type<_QTt(p1:i32,p2:i16){f1:i32,f2:f32}>(%arg0, %arg1 : i32, i16) {name = "_QEvar"} return diff --git a/flang/test/Fir/Todo/boxproc_host.fir b/flang/test/Fir/Todo/boxproc_host.fir --- a/flang/test/Fir/Todo/boxproc_host.fir +++ b/flang/test/Fir/Todo/boxproc_host.fir @@ -4,7 +4,7 @@ // At the moment this test fails since `fir.boxproc` type does not have a conversion. // CHECK: failed to legalize operation 'func.func' -func @test(%bproc: !fir.boxproc<(i32) -> ()>) { +func.func @test(%bproc: !fir.boxproc<(i32) -> ()>) { %tuple = fir.boxproc_host %bproc : (!fir.boxproc<(i32) -> ()>) -> (!fir.ref>) return } diff --git a/flang/test/Fir/Todo/cordinate_of_1.fir b/flang/test/Fir/Todo/cordinate_of_1.fir --- a/flang/test/Fir/Todo/cordinate_of_1.fir +++ b/flang/test/Fir/Todo/cordinate_of_1.fir @@ -4,7 +4,7 @@ // `fir.len_param_index` is not implemented yet, that's the error that's // currently being generated (this error is generated before trying to convert // `fir.coordinate_of`) -func @coordinate_box_derived_with_fir_len(%arg0: !fir.box>) { +func.func @coordinate_box_derived_with_fir_len(%arg0: !fir.box>) { // CHECK: not yet implemented fir.len_param_index codegen %e = fir.len_param_index len1, !fir.type %q = fir.coordinate_of %arg0, %e : (!fir.box>, !fir.len) -> !fir.ref diff --git a/flang/test/Fir/Todo/cordinate_of_2.fir b/flang/test/Fir/Todo/cordinate_of_2.fir --- a/flang/test/Fir/Todo/cordinate_of_2.fir +++ b/flang/test/Fir/Todo/cordinate_of_2.fir @@ -3,7 +3,7 @@ // CHECK: not yet implemented fir.array nested inside other array and/or derived type // `!fir.coordinate_of` - `!fir.array` inside "boxed" `!fir.type` -func @coordinate_box_array_inside_derived(%arg0: !fir.box, field_2:i32}>>, %arg1 : index) { +func.func @coordinate_box_array_inside_derived(%arg0: !fir.box, field_2:i32}>>, %arg1 : index) { %idx0 = arith.constant 0 : i32 %q = fir.coordinate_of %arg0, %idx0, %arg1 : (!fir.box, field_2:i32}>>, i32, index) -> !fir.ref return diff --git a/flang/test/Fir/Todo/cordinate_of_3.fir b/flang/test/Fir/Todo/cordinate_of_3.fir --- a/flang/test/Fir/Todo/cordinate_of_3.fir +++ b/flang/test/Fir/Todo/cordinate_of_3.fir @@ -3,7 +3,7 @@ // CHECK: not yet implemented fir.array nested inside other array and/or derived type // `fir.coordinate_of` - `fir.array` inside "boxed" `!fir.type}` (i.e. nested `!fir.type`) -func @coordinate_box_array_inside_derived(%arg0: !fir.box}>}>>, %arg1 : index) { +func.func @coordinate_box_array_inside_derived(%arg0: !fir.box}>}>>, %arg1 : index) { %idx0 = arith.constant 0 : i32 %q = fir.coordinate_of %arg0, %idx0, %idx0, %arg1 : (!fir.box}>}>>, i32, i32, index) -> !fir.ref return diff --git a/flang/test/Fir/Todo/cordinate_of_4.fir b/flang/test/Fir/Todo/cordinate_of_4.fir --- a/flang/test/Fir/Todo/cordinate_of_4.fir +++ b/flang/test/Fir/Todo/cordinate_of_4.fir @@ -3,7 +3,7 @@ // `!fir.coordinate_of` - derived type with `!fir.len_param_index`. As // `!fir.len_param_index` is not implemented yet, the error that we hit is // related to `!fir.len_param_index` rather than `!fir.coordinate_of`. -func @coordinate_box_derived_with_fir_len(%arg0: !fir.box>) { +func.func @coordinate_box_derived_with_fir_len(%arg0: !fir.box>) { // CHECK: not yet implemented fir.len_param_index codegen %e = fir.len_param_index len1, !fir.type %q = fir.coordinate_of %arg0, %e : (!fir.box>, !fir.len) -> !fir.ref diff --git a/flang/test/Fir/Todo/cordinate_of_5.fir b/flang/test/Fir/Todo/cordinate_of_5.fir --- a/flang/test/Fir/Todo/cordinate_of_5.fir +++ b/flang/test/Fir/Todo/cordinate_of_5.fir @@ -1,7 +1,7 @@ // RUN: %not_todo_cmd fir-opt --fir-to-llvm-ir="target=x86_64-unknown-linux-gnu" %s 2>&1 | FileCheck %s // CHECK: unsupported combination of coordinate operands -func @test_coordinate_of(%arr : !fir.ref>>, %arg1: index) { +func.func @test_coordinate_of(%arr : !fir.ref>>, %arg1: index) { %1 = arith.constant 10 : i32 %2 = fir.coordinate_of %arr, %arg1, %1 : (!fir.ref>>, index, i32) -> !fir.ref> return diff --git a/flang/test/Fir/Todo/cordinate_of_6.fir b/flang/test/Fir/Todo/cordinate_of_6.fir --- a/flang/test/Fir/Todo/cordinate_of_6.fir +++ b/flang/test/Fir/Todo/cordinate_of_6.fir @@ -2,7 +2,7 @@ // CHECK: unsupported combination of coordinate operands -func @test_coordinate_of(%arr : !fir.ref>, %arg1: index) { +func.func @test_coordinate_of(%arr : !fir.ref>, %arg1: index) { %2 = fir.coordinate_of %arr, %arg1, %arg1 : (!fir.ref>, index, index) -> !fir.ref return } diff --git a/flang/test/Fir/Todo/dispatch.fir b/flang/test/Fir/Todo/dispatch.fir --- a/flang/test/Fir/Todo/dispatch.fir +++ b/flang/test/Fir/Todo/dispatch.fir @@ -3,7 +3,7 @@ // Test `fir.dispatch` conversion to llvm. // Not implemented yet. -func @dispatch(%arg0: !fir.box>) { +func.func @dispatch(%arg0: !fir.box>) { // CHECK: not yet implemented fir.dispatch codegen %0 = fir.dispatch "method"(%arg0) : (!fir.box>) -> i32 return diff --git a/flang/test/Fir/Todo/end.fir b/flang/test/Fir/Todo/end.fir --- a/flang/test/Fir/Todo/end.fir +++ b/flang/test/Fir/Todo/end.fir @@ -3,7 +3,7 @@ // Test `fir.end` conversion to llvm. // Not implemented yet. -func @end_test() { +func.func @end_test() { // CHECK: not yet implemented fir.end codegen "fir.end"() : () -> () } diff --git a/flang/test/Fir/Todo/gentypedesc.fir b/flang/test/Fir/Todo/gentypedesc.fir --- a/flang/test/Fir/Todo/gentypedesc.fir +++ b/flang/test/Fir/Todo/gentypedesc.fir @@ -3,7 +3,7 @@ // Test `fir.gentypedesc` conversion to llvm. // Not implemented yet. -func @gentypedesc() { +func.func @gentypedesc() { // CHECK: not yet implemented fir.gentypedesc codegen %0 = fir.gentypedesc !fir.type return diff --git a/flang/test/Fir/Todo/len_param_index.fir b/flang/test/Fir/Todo/len_param_index.fir --- a/flang/test/Fir/Todo/len_param_index.fir +++ b/flang/test/Fir/Todo/len_param_index.fir @@ -3,7 +3,7 @@ // Test `fir.len_param_index` conversion to llvm. // Not implemented yet. -func @lenparamindex() { +func.func @lenparamindex() { // CHECK: not yet implemented fir.len_param_index codegen %0 = fir.len_param_index l1, !fir.type return diff --git a/flang/test/Fir/Todo/select_case_with_character.fir b/flang/test/Fir/Todo/select_case_with_character.fir --- a/flang/test/Fir/Todo/select_case_with_character.fir +++ b/flang/test/Fir/Todo/select_case_with_character.fir @@ -3,7 +3,7 @@ // Test `fir.select_case` conversion to llvm with character type. // Not implemented yet. -func @select_case_charachter(%arg0: !fir.char<2, 10>, %arg1: !fir.char<2, 10>, %arg2: !fir.char<2, 10>) { +func.func @select_case_charachter(%arg0: !fir.char<2, 10>, %arg1: !fir.char<2, 10>, %arg2: !fir.char<2, 10>) { // CHECK: not yet implemented fir.select_case codegen with character type fir.select_case %arg0 : !fir.char<2, 10> [#fir.point, %arg1, ^bb1, #fir.point, %arg2, ^bb2, diff --git a/flang/test/Fir/Todo/unboxproc.fir b/flang/test/Fir/Todo/unboxproc.fir --- a/flang/test/Fir/Todo/unboxproc.fir +++ b/flang/test/Fir/Todo/unboxproc.fir @@ -5,7 +5,7 @@ // Currently fails since coversion for boxproc type is not implemented. // CHECK: failed to legalize operation 'func.func' -func @boxing_match(%bproc: !fir.boxproc<(i32) -> ()>) { +func.func @boxing_match(%bproc: !fir.boxproc<(i32) -> ()>) { %ubproc:2 = fir.unboxproc %bproc : (!fir.boxproc<(i32) -> ()>) -> ((i32) -> (), !fir.ref>) return } diff --git a/flang/test/Fir/abstract-results.fir b/flang/test/Fir/abstract-results.fir --- a/flang/test/Fir/abstract-results.fir +++ b/flang/test/Fir/abstract-results.fir @@ -8,15 +8,15 @@ // CHECK-LABEL: func private @arrayfunc(!fir.ref>, i32) // CHECK-BOX-LABEL: func private @arrayfunc(!fir.box>, i32) -func private @arrayfunc(i32) -> !fir.array +func.func private @arrayfunc(i32) -> !fir.array // CHECK-LABEL: func private @derivedfunc(!fir.ref>, f32) // CHECK-BOX-LABEL: func private @derivedfunc(!fir.box>, f32) -func private @derivedfunc(f32) -> !fir.type +func.func private @derivedfunc(f32) -> !fir.type // CHECK-LABEL: func private @boxfunc(!fir.ref>>, i64) // CHECK-BOX-LABEL: func private @boxfunc(!fir.ref>>, i64) -func private @boxfunc(i64) -> !fir.box> +func.func private @boxfunc(i64) -> !fir.box> // ------------------------ Test callee rewrite -------------------------------- @@ -25,7 +25,7 @@ // CHECK-SAME: %[[buffer:.*]]: !fir.ref>, %[[n:.*]]: index) { // CHECK-BOX-LABEL: func private @arrayfunc_callee( // CHECK-BOX-SAME: %[[box:.*]]: !fir.box>, %[[n:.*]]: index) { -func private @arrayfunc_callee(%n : index) -> !fir.array { +func.func private @arrayfunc_callee(%n : index) -> !fir.array { %buffer = fir.alloca !fir.array, %n // Do something with result (res(4) = 42.) %c4 = arith.constant 4 : i64 @@ -50,7 +50,7 @@ // CHECK-SAME: %[[buffer:.*]]: !fir.ref>, %[[v:.*]]: f32) { // CHECK-BOX-LABEL: func @derivedfunc_callee( // CHECK-BOX-SAME: %[[box:.*]]: !fir.box>, %[[v:.*]]: f32) { -func @derivedfunc_callee(%v: f32) -> !fir.type { +func.func @derivedfunc_callee(%v: f32) -> !fir.type { %buffer = fir.alloca !fir.type %0 = fir.field_index x, !fir.type %1 = fir.coordinate_of %buffer, %0 : (!fir.ref>, !fir.field) -> !fir.ref @@ -72,7 +72,7 @@ // CHECK-SAME: %[[buffer:.*]]: !fir.ref>>) { // CHECK-BOX-LABEL: func @boxfunc_callee( // CHECK-BOX-SAME: %[[buffer:.*]]: !fir.ref>>) { -func @boxfunc_callee() -> !fir.box> { +func.func @boxfunc_callee() -> !fir.box> { %alloc = fir.allocmem f64 %res = fir.embox %alloc : (!fir.heap) -> !fir.box> return %res : !fir.box> @@ -89,7 +89,7 @@ // CHECK-LABEL: func @call_arrayfunc() { // CHECK-BOX-LABEL: func @call_arrayfunc() { -func @call_arrayfunc() { +func.func @call_arrayfunc() { %c100 = arith.constant 100 : index %buffer = fir.alloca !fir.array, %c100 %shape = fir.shape %c100 : (index) -> !fir.shape<1> @@ -112,7 +112,7 @@ // CHECK-LABEL: func @call_derivedfunc() { // CHECK-BOX-LABEL: func @call_derivedfunc() { -func @call_derivedfunc() { +func.func @call_derivedfunc() { %buffer = fir.alloca !fir.type %cst = arith.constant 4.200000e+01 : f32 %res = fir.call @derivedfunc_callee(%cst) : (f32) -> !fir.type @@ -130,13 +130,13 @@ // CHECK-BOX-NOT: fir.save_result } -func private @derived_lparams_func() -> !fir.type +func.func private @derived_lparams_func() -> !fir.type // CHECK-LABEL: func @call_derived_lparams_func( // CHECK-SAME: %[[buffer:.*]]: !fir.ref> // CHECK-BOX-LABEL: func @call_derived_lparams_func( // CHECK-BOX-SAME: %[[buffer:.*]]: !fir.ref> -func @call_derived_lparams_func(%buffer: !fir.ref>) { +func.func @call_derived_lparams_func(%buffer: !fir.ref>) { %l1 = arith.constant 3 : i32 %l2 = arith.constant 5 : i32 %res = fir.call @derived_lparams_func() : () -> !fir.type @@ -157,7 +157,7 @@ // CHECK-LABEL: func @call_boxfunc() { // CHECK-BOX-LABEL: func @call_boxfunc() { -func @call_boxfunc() { +func.func @call_boxfunc() { %buffer = fir.alloca !fir.box> %res = fir.call @boxfunc_callee() : () -> !fir.box> fir.save_result %res to %buffer: !fir.box>, !fir.ref>> @@ -172,11 +172,11 @@ // CHECK-BOX-NOT: fir.save_result } -func private @chararrayfunc(index, index) -> !fir.array> +func.func private @chararrayfunc(index, index) -> !fir.array> // CHECK-LABEL: func @call_chararrayfunc() { // CHECK-BOX-LABEL: func @call_chararrayfunc() { -func @call_chararrayfunc() { +func.func @call_chararrayfunc() { %c100 = arith.constant 100 : index %c50 = arith.constant 50 : index %buffer = fir.alloca !fir.array>(%c100 : index), %c50 @@ -202,11 +202,11 @@ // ------------------------ Test fir.address_of rewrite ------------------------ -func private @takesfuncarray((i32) -> !fir.array) +func.func private @takesfuncarray((i32) -> !fir.array) // CHECK-LABEL: func @test_address_of() { // CHECK-BOX-LABEL: func @test_address_of() { -func @test_address_of() { +func.func @test_address_of() { %0 = fir.address_of(@arrayfunc) : (i32) -> !fir.array fir.call @takesfuncarray(%0) : ((i32) -> !fir.array) -> () return @@ -227,7 +227,7 @@ // CHECK-SAME: %[[arg0:.*]]: () -> ()) { // CHECK-BOX-LABEL: func @test_indirect_calls( // CHECK-BOX-SAME: %[[arg0:.*]]: () -> ()) { -func @test_indirect_calls(%arg0: () -> ()) { +func.func @test_indirect_calls(%arg0: () -> ()) { %c100 = arith.constant 100 : index %buffer = fir.alloca !fir.array, %c100 %shape = fir.shape %c100 : (index) -> !fir.shape<1> diff --git a/flang/test/Fir/addrof.fir b/flang/test/Fir/addrof.fir --- a/flang/test/Fir/addrof.fir +++ b/flang/test/Fir/addrof.fir @@ -4,7 +4,7 @@ fir.global @var_x : !fir.int<4> {} // CHECK-LABEL: define i32* @getAddressOfX -func @getAddressOfX() -> !fir.ref> { +func.func @getAddressOfX() -> !fir.ref> { %1 = fir.address_of(@var_x) : !fir.ref> // CHECK: ret i32* @var_x return %1 : !fir.ref> diff --git a/flang/test/Fir/affine-demotion.fir b/flang/test/Fir/affine-demotion.fir --- a/flang/test/Fir/affine-demotion.fir +++ b/flang/test/Fir/affine-demotion.fir @@ -6,7 +6,7 @@ #map1 = affine_map<()[s0] -> (s0 + 1)> #map2 = affine_map<(d0)[s0, s1, s2] -> (d0 * s2 - s0)> module { - func @calc(%arg0: !fir.ref>, %arg1: !fir.ref>, %arg2: !fir.ref>) { + func.func @calc(%arg0: !fir.ref>, %arg1: !fir.ref>, %arg2: !fir.ref>) { %c1 = arith.constant 1 : index %c100 = arith.constant 100 : index %0 = fir.shape %c100 : (index) -> !fir.shape<1> diff --git a/flang/test/Fir/affine-promotion.fir b/flang/test/Fir/affine-promotion.fir --- a/flang/test/Fir/affine-promotion.fir +++ b/flang/test/Fir/affine-promotion.fir @@ -5,7 +5,7 @@ !arr_d1 = type !fir.ref> #arr_len = affine_map<()[j1,k1] -> (k1 - j1 + 1)> -func @loop_with_load_and_store(%a1: !arr_d1, %a2: !arr_d1, %a3: !arr_d1) { +func.func @loop_with_load_and_store(%a1: !arr_d1, %a2: !arr_d1, %a3: !arr_d1) { %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %len = arith.constant 100 : index @@ -78,7 +78,7 @@ !arr_d1 = type !fir.ref> #arr_len = affine_map<()[j1,k1] -> (k1 - j1 + 1)> -func @loop_with_if(%a: !arr_d1, %v: f32) { +func.func @loop_with_if(%a: !arr_d1, %v: f32) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index diff --git a/flang/test/Fir/alloc.fir b/flang/test/Fir/alloc.fir --- a/flang/test/Fir/alloc.fir +++ b/flang/test/Fir/alloc.fir @@ -4,14 +4,14 @@ // CHECK-LABEL: define i32* @alloca_scalar_nonchar() // CHECK: alloca i32, i64 1 -func @alloca_scalar_nonchar() -> !fir.ref { +func.func @alloca_scalar_nonchar() -> !fir.ref { %1 = fir.alloca i32 return %1 : !fir.ref } // CHECK-LABEL: define i32* @alloca_scalars_nonchar() // CHECK: alloca i32, i64 100 -func @alloca_scalars_nonchar() -> !fir.ref { +func.func @alloca_scalars_nonchar() -> !fir.ref { %0 = arith.constant 100 : index %1 = fir.alloca i32, %0 return %1 : !fir.ref @@ -19,14 +19,14 @@ // CHECK-LABEL: define i32* @allocmem_scalar_nonchar( // CHECK: call i8* @malloc(i64 4) -func @allocmem_scalar_nonchar() -> !fir.heap { +func.func @allocmem_scalar_nonchar() -> !fir.heap { %1 = fir.allocmem i32 return %1 : !fir.heap } // CHECK-LABEL: define i32* @allocmem_scalars_nonchar( // CHECK: call i8* @malloc(i64 400) -func @allocmem_scalars_nonchar() -> !fir.heap { +func.func @allocmem_scalars_nonchar() -> !fir.heap { %0 = arith.constant 100 : index %1 = fir.allocmem i32, %0 return %1 : !fir.heap @@ -34,28 +34,28 @@ // CHECK-LABEL: define [10 x i8]* @alloca_scalar_char( // CHECK: alloca [10 x i8], i64 1 -func @alloca_scalar_char() -> !fir.ref> { +func.func @alloca_scalar_char() -> !fir.ref> { %1 = fir.alloca !fir.char<1,10> return %1 : !fir.ref> } // CHECK-LABEL: define [10 x i16]* @alloca_scalar_char_kind( // CHECK: alloca [10 x i16], i64 1 -func @alloca_scalar_char_kind() -> !fir.ref> { +func.func @alloca_scalar_char_kind() -> !fir.ref> { %1 = fir.alloca !fir.char<2,10> return %1 : !fir.ref> } // CHECK-LABEL: define [10 x i8]* @allocmem_scalar_char( // CHECK: call i8* @malloc(i64 ptrtoint ([10 x i8]* getelementptr ([10 x i8], [10 x i8]* null, i64 1) to i64)) -func @allocmem_scalar_char() -> !fir.heap> { +func.func @allocmem_scalar_char() -> !fir.heap> { %1 = fir.allocmem !fir.char<1,10> return %1 : !fir.heap> } // CHECK-LABEL: define [10 x i16]* @allocmem_scalar_char_kind( // CHECK: call i8* @malloc(i64 ptrtoint ([10 x i16]* getelementptr ([10 x i16], [10 x i16]* null, i64 1) to i64)) -func @allocmem_scalar_char_kind() -> !fir.heap> { +func.func @allocmem_scalar_char_kind() -> !fir.heap> { %1 = fir.allocmem !fir.char<2,10> return %1 : !fir.heap> } @@ -64,7 +64,7 @@ // CHECK-SAME: i32 %[[len:.*]]) // CHECK: %[[mul1:.*]] = sext i32 %[[len]] to i64 // CHECK: alloca i8, i64 %[[mul1]] -func @alloca_scalar_dynchar(%l : i32) -> !fir.ref> { +func.func @alloca_scalar_dynchar(%l : i32) -> !fir.ref> { %1 = fir.alloca !fir.char<1,?>(%l : i32) return %1 : !fir.ref> } @@ -73,7 +73,7 @@ // CHECK-SAME: i32 %[[len:.*]]) // CHECK: %[[mul1:.*]] = sext i32 %[[len]] to i64 // CHECK: alloca i16, i64 %[[mul1]] -func @alloca_scalar_dynchar_kind(%l : i32) -> !fir.ref> { +func.func @alloca_scalar_dynchar_kind(%l : i32) -> !fir.ref> { %1 = fir.alloca !fir.char<2,?>(%l : i32) return %1 : !fir.ref> } @@ -83,7 +83,7 @@ // CHECK: %[[mul1:.*]] = sext i32 %[[len]] to i64 // CHECK: %[[mul2:.*]] = mul i64 1, %[[mul1]] // CHECK: call i8* @malloc(i64 %[[mul2]]) -func @allocmem_scalar_dynchar(%l : i32) -> !fir.heap> { +func.func @allocmem_scalar_dynchar(%l : i32) -> !fir.heap> { %1 = fir.allocmem !fir.char<1,?>(%l : i32) return %1 : !fir.heap> } @@ -93,28 +93,28 @@ // CHECK: %[[mul1:.*]] = sext i32 %[[len]] to i64 // CHECK: %[[mul2:.*]] = mul i64 2, %[[mul1]] // CHECK: call i8* @malloc(i64 %[[mul2]]) -func @allocmem_scalar_dynchar_kind(%l : i32) -> !fir.heap>{ +func.func @allocmem_scalar_dynchar_kind(%l : i32) -> !fir.heap>{ %1 = fir.allocmem !fir.char<2,?>(%l : i32) return %1 : !fir.heap> } // CHECK-LABEL: define i32** @alloca_ptr_to_dynarray_nonchar( // CHECK: %1 = alloca i32*, i64 1 -func @alloca_ptr_to_dynarray_nonchar() -> !fir.ref>> { +func.func @alloca_ptr_to_dynarray_nonchar() -> !fir.ref>> { %1 = fir.alloca !fir.ptr> return %1 : !fir.ref>> } // CHECK-LABEL: define [3 x [3 x i32]]* @alloca_array_of_nonchar( // CHECK: alloca [3 x [3 x i32]], i64 1 -func @alloca_array_of_nonchar() -> !fir.ref> { +func.func @alloca_array_of_nonchar() -> !fir.ref> { %1 = fir.alloca !fir.array<3x3xi32> return %1 : !fir.ref> } // CHECK-LABEL: define [3 x [3 x [10 x i8]]]* @alloca_array_of_char( // CHECK: alloca [3 x [3 x [10 x i8]]], i64 1 -func @alloca_array_of_char() -> !fir.ref>> { +func.func @alloca_array_of_char() -> !fir.ref>> { %1 = fir.alloca !fir.array<3x3x!fir.char<1,10>> return %1 : !fir.ref>> } @@ -124,21 +124,21 @@ // CHECK: %[[mul1:.*]] = sext i32 %[[len]] to i64 // CHECK: %[[mul2:.*]] = mul i64 %[[mul1]], 9 // CHECK: alloca i8, i64 %[[mul2]] -func @alloca_array_of_dynchar(%l: i32) -> !fir.ref>> { +func.func @alloca_array_of_dynchar(%l: i32) -> !fir.ref>> { %1 = fir.alloca !fir.array<3x3x!fir.char<1,?>>(%l : i32) return %1 : !fir.ref>> } // CHECK-LABEL: define [3 x [3 x i32]]* @allocmem_array_of_nonchar( // CHECK: call i8* @malloc(i64 ptrtoint ([3 x [3 x i32]]* getelementptr ([3 x [3 x i32]], [3 x [3 x i32]]* null, i64 1) to i64)) -func @allocmem_array_of_nonchar() -> !fir.heap> { +func.func @allocmem_array_of_nonchar() -> !fir.heap> { %1 = fir.allocmem !fir.array<3x3xi32> return %1 : !fir.heap> } // CHECK-LABEL: define [3 x [3 x [10 x i8]]]* @allocmem_array_of_char( // CHECK: call i8* @malloc(i64 ptrtoint ([3 x [3 x [10 x i8]]]* getelementptr ([3 x [3 x [10 x i8]]], [3 x [3 x [10 x i8]]]* null, i64 1) to i64)) -func @allocmem_array_of_char() -> !fir.heap>> { +func.func @allocmem_array_of_char() -> !fir.heap>> { %1 = fir.allocmem !fir.array<3x3x!fir.char<1,10>> return %1 : !fir.heap>> } @@ -148,7 +148,7 @@ // CHECK: %[[mul1:.*]] = sext i32 %[[len]] to i64 // CHECK: %[[mul2:.*]] = mul i64 9, %[[mul1]] // CHECK: call i8* @malloc(i64 %[[mul2]]) -func @allocmem_array_of_dynchar(%l: i32) -> !fir.heap>> { +func.func @allocmem_array_of_dynchar(%l: i32) -> !fir.heap>> { %1 = fir.allocmem !fir.array<3x3x!fir.char<1,?>>(%l : i32) return %1 : !fir.heap>> } @@ -157,7 +157,7 @@ // CHECK-SAME: i64 %[[extent:.*]]) // CHECK: %[[prod1:.*]] = mul i64 1, %[[extent]] // CHECK: alloca [3 x i32], i64 %[[prod1]] -func @alloca_dynarray_of_nonchar(%e: index) -> !fir.ref> { +func.func @alloca_dynarray_of_nonchar(%e: index) -> !fir.ref> { %1 = fir.alloca !fir.array<3x?xi32>, %e return %1 : !fir.ref> } @@ -167,7 +167,7 @@ // CHECK: %[[prod1:.*]] = mul i64 1, %[[extent]] // CHECK: %[[prod2:.*]] = mul i64 %[[prod1]], %[[extent]] // CHECK: alloca i32, i64 %[[prod2]] -func @alloca_dynarray_of_nonchar2(%e: index) -> !fir.ref> { +func.func @alloca_dynarray_of_nonchar2(%e: index) -> !fir.ref> { %1 = fir.alloca !fir.array, %e, %e return %1 : !fir.ref> } @@ -176,7 +176,7 @@ // CHECK-SAME: i64 %[[extent:.*]]) // CHECK: %[[prod1:.*]] = mul i64 ptrtoint ([3 x i32]* getelementptr ([3 x i32], [3 x i32]* null, i64 1) to i64), %[[extent]] // CHECK: call i8* @malloc(i64 %[[prod1]]) -func @allocmem_dynarray_of_nonchar(%e: index) -> !fir.heap> { +func.func @allocmem_dynarray_of_nonchar(%e: index) -> !fir.heap> { %1 = fir.allocmem !fir.array<3x?xi32>, %e return %1 : !fir.heap> } @@ -186,7 +186,7 @@ // CHECK: %[[prod1:.*]] = mul i64 4, %[[extent]] // CHECK: %[[prod2:.*]] = mul i64 %[[prod1]], %[[extent]] // CHECK: call i8* @malloc(i64 %[[prod2]]) -func @allocmem_dynarray_of_nonchar2(%e: index) -> !fir.heap> { +func.func @allocmem_dynarray_of_nonchar2(%e: index) -> !fir.heap> { %1 = fir.allocmem !fir.array, %e, %e return %1 : !fir.heap> } @@ -195,7 +195,7 @@ // CHECK-SAME: i64 %[[extent:.*]]) // CHECK: %[[prod1:.*]] = mul i64 1, %[[extent]] // CHECK: alloca [3 x [10 x i16]], i64 %[[prod1]] -func @alloca_dynarray_of_char(%e : index) -> !fir.ref>> { +func.func @alloca_dynarray_of_char(%e : index) -> !fir.ref>> { %1 = fir.alloca !fir.array<3x?x!fir.char<2,10>>, %e return %1 : !fir.ref>> } @@ -205,7 +205,7 @@ // CHECK: %[[prod1:.*]] = mul i64 1, %[[extent]] // CHECK: %[[prod2:.*]] = mul i64 %[[prod1]], %[[extent]] // CHECK: alloca [10 x i16], i64 %[[prod2]] -func @alloca_dynarray_of_char2(%e : index) -> !fir.ref>> { +func.func @alloca_dynarray_of_char2(%e : index) -> !fir.ref>> { %1 = fir.alloca !fir.array>, %e, %e return %1 : !fir.ref>> } @@ -214,7 +214,7 @@ // CHECK-SAME: i64 %[[extent:.*]]) // CHECK: %[[prod1:.*]] = mul i64 ptrtoint ([3 x [10 x i16]]* getelementptr ([3 x [10 x i16]], [3 x [10 x i16]]* null, i64 1) to i64), %[[extent]] // CHECK: call i8* @malloc(i64 %[[prod1]]) -func @allocmem_dynarray_of_char(%e : index) -> !fir.heap>> { +func.func @allocmem_dynarray_of_char(%e : index) -> !fir.heap>> { %1 = fir.allocmem !fir.array<3x?x!fir.char<2,10>>, %e return %1 : !fir.heap>> } @@ -224,7 +224,7 @@ // CHECK: %[[prod1:.*]] = mul i64 ptrtoint ([10 x i16]* getelementptr ([10 x i16], [10 x i16]* null, i64 1) to i64), %[[extent]] // CHECK: %[[prod2:.*]] = mul i64 %[[prod1]], %[[extent]] // CHECK: call i8* @malloc(i64 %[[prod2]]) -func @allocmem_dynarray_of_char2(%e : index) -> !fir.heap>> { +func.func @allocmem_dynarray_of_char2(%e : index) -> !fir.heap>> { %1 = fir.allocmem !fir.array>, %e, %e return %1 : !fir.heap>> } @@ -235,7 +235,7 @@ // CHECK: %[[prod2:.*]] = mul i64 %[[prod1]], 3 // CHECK: %[[prod3:.*]] = mul i64 %[[prod2]], %[[extent]] // CHECK: alloca i16, i64 %[[prod3]] -func @alloca_dynarray_of_dynchar(%l: i32, %e : index) -> !fir.ref>> { +func.func @alloca_dynarray_of_dynchar(%l: i32, %e : index) -> !fir.ref>> { %1 = fir.alloca !fir.array<3x?x!fir.char<2,?>>(%l : i32), %e return %1 : !fir.ref>> } @@ -246,7 +246,7 @@ // CHECK: %[[prod2:.*]] = mul i64 %[[prod1]], %[[extent]] // CHECK: %[[prod3:.*]] = mul i64 %[[prod2]], %[[extent]] // CHECK: alloca i16, i64 %[[prod3]] -func @alloca_dynarray_of_dynchar2(%l: i32, %e : index) -> !fir.ref>> { +func.func @alloca_dynarray_of_dynchar2(%l: i32, %e : index) -> !fir.ref>> { %1 = fir.alloca !fir.array>(%l : i32), %e, %e return %1 : !fir.ref>> } @@ -257,7 +257,7 @@ // CHECK: %[[prod2:.*]] = mul i64 6, %[[prod1]] // CHECK: %[[prod3:.*]] = mul i64 %[[prod2]], %[[extent]] // CHECK: call i8* @malloc(i64 %[[prod3]]) -func @allocmem_dynarray_of_dynchar(%l: i32, %e : index) -> !fir.heap>> { +func.func @allocmem_dynarray_of_dynchar(%l: i32, %e : index) -> !fir.heap>> { %1 = fir.allocmem !fir.array<3x?x!fir.char<2,?>>(%l : i32), %e return %1 : !fir.heap>> } @@ -269,7 +269,7 @@ // CHECK: %[[prod2:.*]] = mul i64 %[[prod1]], %[[extent]] // CHECK: %[[prod3:.*]] = mul i64 %[[prod2]], %[[extent]] // CHECK: call i8* @malloc(i64 %[[prod3]]) -func @allocmem_dynarray_of_dynchar2(%l: i32, %e : index) -> !fir.heap>> { +func.func @allocmem_dynarray_of_dynchar2(%l: i32, %e : index) -> !fir.heap>> { %1 = fir.allocmem !fir.array>(%l : i32), %e, %e return %1 : !fir.heap>> } @@ -279,7 +279,7 @@ // CHECK: %[[prod1:.*]] = mul i64 60, %[[a]] // CHECK: %[[prod2:.*]] = mul i64 %[[prod1]], %[[b]] // CHECK: alloca i32, i64 %[[prod2]] -func @alloca_array_with_holes_nonchar(%0 : index, %1 : index) -> !fir.ref> { +func.func @alloca_array_with_holes_nonchar(%0 : index, %1 : index) -> !fir.ref> { %a = fir.alloca !fir.array<4x?x3x?x5xi32>, %0, %1 return %a : !fir.ref> } @@ -288,7 +288,7 @@ // CHECK-SAME: i64 %[[e:.*]]) // CHECK: %[[mul:.*]] = mul i64 12, %[[e]] // CHECK: alloca [10 x i16], i64 %[[mul]] -func @alloca_array_with_holes_char(%e: index) -> !fir.ref>> { +func.func @alloca_array_with_holes_char(%e: index) -> !fir.ref>> { %1 = fir.alloca !fir.array<3x?x4x!fir.char<2,10>>, %e return %1 : !fir.ref>> } @@ -298,7 +298,7 @@ // CHECK: %[[a:.*]] = mul i64 %[[len]], 12 // CHECK: %[[b:.*]] = mul i64 %[[a]], %[[extent]] // CHECK: alloca i16, i64 %[[b]] -func @alloca_array_with_holes_dynchar(%arg0: index, %arg1: index) -> !fir.ref>> { +func.func @alloca_array_with_holes_dynchar(%arg0: index, %arg1: index) -> !fir.ref>> { %1 = fir.alloca !fir.array<3x?x4x!fir.char<2,?>>(%arg0 : index), %arg1 return %1 : !fir.ref>> } @@ -308,7 +308,7 @@ // CHECK: %[[a:.*]] = mul i64 240, %[[e1]] // CHECK: %[[b:.*]] = mul i64 %3, %[[e2]] // CHECK: call i8* @malloc(i64 %[[b]]) -func @allocmem_array_with_holes_nonchar(%0 : index, %1 : index) -> !fir.heap> { +func.func @allocmem_array_with_holes_nonchar(%0 : index, %1 : index) -> !fir.heap> { %a = fir.allocmem !fir.array<4x?x3x?x5xi32>, %0, %1 return %a : !fir.heap> } @@ -317,7 +317,7 @@ // CHECK-SAME: i64 %[[e:.*]]) // CHECK: %[[mul:.*]] = mul i64 mul (i64 ptrtoint ([10 x i16]* getelementptr ([10 x i16], [10 x i16]* null, i64 1) to i64), i64 12), %[[e]] // CHECK: call i8* @malloc(i64 %[[mul]]) -func @allocmem_array_with_holes_char(%e: index) -> !fir.heap>> { +func.func @allocmem_array_with_holes_char(%e: index) -> !fir.heap>> { %1 = fir.allocmem !fir.array<3x?x4x!fir.char<2,10>>, %e return %1 : !fir.heap>> } @@ -327,7 +327,7 @@ // CHECK: %[[a:.*]] = mul i64 24, %[[len]] // CHECK: %[[b:.*]] = mul i64 %[[a]], %[[extent]] // CHECK: call i8* @malloc(i64 %[[b]]) -func @allocmem_array_with_holes_dynchar(%arg0: index, %arg1: index) -> !fir.heap>> { +func.func @allocmem_array_with_holes_dynchar(%arg0: index, %arg1: index) -> !fir.heap>> { %1 = fir.allocmem !fir.array<3x?x4x!fir.char<2,?>>(%arg0 : index), %arg1 return %1 : !fir.heap>> } diff --git a/flang/test/Fir/annotate-constant.fir b/flang/test/Fir/annotate-constant.fir --- a/flang/test/Fir/annotate-constant.fir +++ b/flang/test/Fir/annotate-constant.fir @@ -1,7 +1,7 @@ // RUN: fir-opt -annotate-constant %s | FileCheck %s // CHECK-LABEL: func @annotate_test() -> !fir.ref> { -func @annotate_test() -> !fir.ref> { +func.func @annotate_test() -> !fir.ref> { %1 = arith.constant 5 : index // CHECK: %[[a:.*]] = fir.alloca !fir.array, %{{.*}} {canonicalize_constant_operands = [5 : index]} %2 = fir.alloca !fir.array, %1 diff --git a/flang/test/Fir/array-copies-pointers.fir b/flang/test/Fir/array-copies-pointers.fir --- a/flang/test/Fir/array-copies-pointers.fir +++ b/flang/test/Fir/array-copies-pointers.fir @@ -11,7 +11,7 @@ // CHECK: fir.do_loop // CHECK: fir.do_loop // CHECK: fir.freemem %[[ALLOC]] : !fir.heap> -func @maybe_overlap(%arg0: !fir.ptr>, %arg1: !fir.ref>) { +func.func @maybe_overlap(%arg0: !fir.ptr>, %arg1: !fir.ref>) { %c100 = arith.constant 100 : index %c99 = arith.constant 99 : index %c1 = arith.constant 1 : index @@ -38,7 +38,7 @@ // CHECK: fir.array_coor // CHECK: fir.array_coor // CHECK: fir.store -func @no_overlap(%arg0: !fir.ptr>, %arg1: !fir.ref>) { +func.func @no_overlap(%arg0: !fir.ptr>, %arg1: !fir.ref>) { %c100 = arith.constant 100 : index %c99 = arith.constant 99 : index %c1 = arith.constant 1 : index @@ -65,7 +65,7 @@ // CHECK: fir.do_loop // CHECK: fir.do_loop // CHECK: fir.freemem %[[ALLOC]] : !fir.heap> -func @maybe_overlap_2(%arg0: !fir.ptr>, %arg1: !fir.ref>) { +func.func @maybe_overlap_2(%arg0: !fir.ptr>, %arg1: !fir.ref>) { %c100 = arith.constant 100 : index %c99 = arith.constant 99 : index %c1 = arith.constant 1 : index @@ -92,7 +92,7 @@ // CHECK: fir.do_loop // CHECK: fir.do_loop // CHECK: fir.freemem %[[ALLOC]] : !fir.heap> -func @maybe_overlap_3(%arg0: !fir.ptr>, %arg1: !fir.ptr>) { +func.func @maybe_overlap_3(%arg0: !fir.ptr>, %arg1: !fir.ptr>) { %c100 = arith.constant 100 : index %c99 = arith.constant 99 : index %c1 = arith.constant 1 : index @@ -118,7 +118,7 @@ // CHECK: %[[ALLOC:.*]] = fir.allocmem !fir.array<4x!fir.type> // CHECK-COUNT-3: fir.do_loop // CHECK: fir.freemem %[[ALLOC]] : !fir.heap>> -func @derived_whose_component_may_be_aliased(%arg0: !fir.box>> {fir.target}, %arg1: !fir.ref>>>) { +func.func @derived_whose_component_may_be_aliased(%arg0: !fir.box>> {fir.target}, %arg1: !fir.ref>>>) { %c4 = arith.constant 4 : index %0 = fir.field_index i, !fir.type %c1 = arith.constant 1 : index @@ -147,7 +147,7 @@ // CHECK: %[[ALLOC:.*]] = fir.allocmem !fir.array // CHECK-COUNT-3: fir.do_loop // CHECK: fir.freemem %[[ALLOC]] : !fir.heap> -func @complex_real_aliasing(%arg0: !fir.ref>>>, %arg1: !fir.ref>> {fir.target}) { +func.func @complex_real_aliasing(%arg0: !fir.ref>>>, %arg1: !fir.ref>> {fir.target}) { %c4 = arith.constant 4 : index %0 = fir.load %arg0 : !fir.ref>>> %c0 = arith.constant 0 : index diff --git a/flang/test/Fir/array-modify.fir b/flang/test/Fir/array-modify.fir --- a/flang/test/Fir/array-modify.fir +++ b/flang/test/Fir/array-modify.fir @@ -2,7 +2,7 @@ // RUN: fir-opt %s --array-value-copy | FileCheck %s // Test user_defined_assignment(arg0(:), arg1(:)) -func @no_overlap(%arg0: !fir.ref>, %arg1: !fir.ref>) { +func.func @no_overlap(%arg0: !fir.ref>, %arg1: !fir.ref>) { %c100 = arith.constant 100 : index %c99 = arith.constant 99 : index %c1 = arith.constant 1 : index @@ -49,7 +49,7 @@ // Test user_defined_assignment(arg0(:), arg0(100:1:-1)) -func @overlap(%arg0: !fir.ref>) { +func.func @overlap(%arg0: !fir.ref>) { %c100 = arith.constant 100 : index %c99 = arith.constant 99 : index %c1 = arith.constant 1 : index @@ -127,4 +127,4 @@ // CHECK: return // CHECK: } -func private @user_defined_assignment(!fir.ref, !fir.ref) +func.func private @user_defined_assignment(!fir.ref, !fir.ref) diff --git a/flang/test/Fir/array-value-copy-2.fir b/flang/test/Fir/array-value-copy-2.fir --- a/flang/test/Fir/array-value-copy-2.fir +++ b/flang/test/Fir/array-value-copy-2.fir @@ -5,7 +5,7 @@ // CHECK: ^bb{{[0-9]+}}(%{{[0-9]+}}: index, // CHECK-NOT: ^bb{{[0-9]+}}(%{{[0-9]+}}: index, // CHECK: return -func @_QPslice1(%arg0: !fir.box>, %arg1: !fir.ref, %arg2: !fir.ref) { +func.func @_QPslice1(%arg0: !fir.box>, %arg1: !fir.ref, %arg2: !fir.ref) { %c1_i64 = arith.constant 1 : i64 %0 = fir.convert %c1_i64 : (i64) -> index %1 = fir.load %arg1 : !fir.ref @@ -45,7 +45,7 @@ // CHECK: ^bb{{[0-9]+}}(%{{[0-9]+}}: index, // CHECK: fir.freemem // CHECK: return -func @_QPslice2(%arg0: !fir.box>, %arg1: !fir.ref, %arg2: !fir.ref) { +func.func @_QPslice2(%arg0: !fir.box>, %arg1: !fir.ref, %arg2: !fir.ref) { %c1_i64 = arith.constant 1 : i64 %0 = fir.convert %c1_i64 : (i64) -> index %c1_i64_0 = arith.constant 1 : i64 diff --git a/flang/test/Fir/array-value-copy-3.fir b/flang/test/Fir/array-value-copy-3.fir --- a/flang/test/Fir/array-value-copy-3.fir +++ b/flang/test/Fir/array-value-copy-3.fir @@ -7,8 +7,8 @@ !t_with_alloc_comp = type !fir.type>>}> -func private @custom_assign(!fir.ref, !fir.ref) -func @test_overlap_with_alloc_components(%arg0: !fir.ref>) { +func.func private @custom_assign(!fir.ref, !fir.ref) +func.func @test_overlap_with_alloc_components(%arg0: !fir.ref>) { %0 = fir.alloca !fir.box %c10 = arith.constant 10 : index %c9 = arith.constant 9 : index diff --git a/flang/test/Fir/array-value-copy.fir b/flang/test/Fir/array-value-copy.fir --- a/flang/test/Fir/array-value-copy.fir +++ b/flang/test/Fir/array-value-copy.fir @@ -2,7 +2,7 @@ // RUN: fir-opt --split-input-file --array-value-copy %s | FileCheck %s // Test simple fir.array_load/fir.array_fetch conversion to fir.array_coor -func @array_fetch_conversion(%arr1 : !fir.ref>, %m: index, %n: index) { +func.func @array_fetch_conversion(%arr1 : !fir.ref>, %m: index, %n: index) { %c10 = arith.constant 10 : index %c20 = arith.constant 20 : index %s = fir.shape %m, %n : (index, index) -> !fir.shape<2> @@ -27,7 +27,7 @@ // ----- // Test simple fir.array_load/fir.array_update conversion without copy-in/copy-out -func @array_update_conversion(%arr1 : !fir.box>, %m: index, %n: index) { +func.func @array_update_conversion(%arr1 : !fir.box>, %m: index, %n: index) { %c10 = arith.constant 10 : index %c20 = arith.constant 20 : index %c1 = arith.constant 1 : index @@ -49,7 +49,7 @@ // ----- // Test simple fir.array_load/fir.array_update conversion without copy-in/copy-out -func @array_update_conversion(%arr1 : !fir.box>, %m: index, %n: index, %cond: i1) { +func.func @array_update_conversion(%arr1 : !fir.box>, %m: index, %n: index, %cond: i1) { %c10 = arith.constant 10 : index %c20 = arith.constant 20 : index %c1 = arith.constant 1 : index @@ -78,7 +78,7 @@ // end // ``` -func @conversion_with_temporary(%arr0 : !fir.ref>) { +func.func @conversion_with_temporary(%arr0 : !fir.ref>) { %c10 = arith.constant 10 : index %1 = fir.shape %c10 : (index) -> !fir.shape<1> %2 = fir.array_load %arr0(%1) : (!fir.ref>, !fir.shape<1>) -> !fir.array<10xi32> @@ -137,7 +137,7 @@ // Test fir.array_load/fir.array_fetch/fir.array_update conversion with // an introduced copy-in/copy-out on a multidimensional array. -func @conversion_with_temporary_multidim(%0: !fir.ref>) { +func.func @conversion_with_temporary_multidim(%0: !fir.ref>) { %c10 = arith.constant 10 : index %c5 = arith.constant 5 : index %1 = fir.shape %c10, %c5 : (index, index) -> !fir.shape<2> @@ -216,7 +216,7 @@ // ----- // Test fir.array_modify conversion with no overlap. -func @array_modify_no_overlap(%arg0: !fir.ref>, %arg1: !fir.ref>) { +func.func @array_modify_no_overlap(%arg0: !fir.ref>, %arg1: !fir.ref>) { %c100 = arith.constant 100 : index %c99 = arith.constant 99 : index %c1 = arith.constant 1 : index @@ -236,7 +236,7 @@ return } -func private @user_defined_assignment(!fir.ref, !fir.ref) +func.func private @user_defined_assignment(!fir.ref, !fir.ref) // CHECK-LABEL: func @array_modify_no_overlap( // CHECK-SAME: %[[ARR0:.*]]: !fir.ref>, @@ -255,7 +255,7 @@ // Test fir.array_modify conversion with an overlap. // Test user_defined_assignment(arg0(:), arg0(100:1:-1)) -func @array_modify_overlap(%arg0: !fir.ref>) { +func.func @array_modify_overlap(%arg0: !fir.ref>) { %c100 = arith.constant 100 : index %c99 = arith.constant 99 : index %c1 = arith.constant 1 : index @@ -277,7 +277,7 @@ return } -func private @user_defined_assignment(!fir.ref, !fir.ref) +func.func private @user_defined_assignment(!fir.ref, !fir.ref) // CHECK-LABEL: func @array_modify_overlap( // CHECK-SAME: %[[ARR0:.*]]: !fir.ref>) { @@ -316,7 +316,7 @@ // ----- // Test array of types with no overlap -func @array_of_types() { +func.func @array_of_types() { %0 = fir.alloca i32 {bindc_name = "j", uniq_name = "_QEj"} %1 = fir.address_of(@_QEtypes) : !fir.ref}>>> %c1_i32 = arith.constant 1 : i32 @@ -372,7 +372,7 @@ // ----- // Test fir.array_load/boxed array -func @conversion_with_temporary_boxed_array(%arr0 : !fir.box>) { +func.func @conversion_with_temporary_boxed_array(%arr0 : !fir.box>) { %c10 = arith.constant 10 : index %1:3 = fir.box_dims %arr0, %c10 : (!fir.box>, index) -> (index, index, index) %shift = fir.shift %1#0 : (index) -> !fir.shift<1> @@ -430,7 +430,7 @@ // ----- // Test simple fir.array_update with Fortran.offsets attribute. -func @array_update_conversion(%arr1 : !fir.box>, %m: index, %n: index) { +func.func @array_update_conversion(%arr1 : !fir.box>, %m: index, %n: index) { %c10 = arith.constant 10 : index %c20 = arith.constant 20 : index %c1 = arith.constant 1 : index @@ -450,7 +450,7 @@ // ----- // Test fir.array_fetch on derived type members in an array of derived types. -func @array_fetch_derived_type(%0 : !fir.ref}>>>) { +func.func @array_fetch_derived_type(%0 : !fir.ref}>>>) { %1 = fir.alloca i32 {bindc_name = "i", uniq_name = "_QEi"} %c1_i32 = arith.constant 1 : i32 %2 = fir.convert %c1_i32 : (i32) -> index @@ -492,7 +492,7 @@ // ----- // Test simple fir.array_load/fir.array_update conversion without copy-in/copy-out with a `fir.box` -func @array_update_conversion(%arr1 : !fir.box>, %m: index, %n: index) { +func.func @array_update_conversion(%arr1 : !fir.box>, %m: index, %n: index) { %c10 = arith.constant 10 : index %c20 = arith.constant 20 : index %c1 = arith.constant 1 : index @@ -507,7 +507,7 @@ // Test array operation with conditional update. -func @array_operation_with_cond_update(%arg0: !fir.ref>, %cond1: i1) { +func.func @array_operation_with_cond_update(%arg0: !fir.ref>, %cond1: i1) { %c100 = arith.constant 100 : index %c1 = arith.constant 1 : index %c-1 = arith.constant -1 : index diff --git a/flang/test/Fir/arrayset.fir b/flang/test/Fir/arrayset.fir --- a/flang/test/Fir/arrayset.fir +++ b/flang/test/Fir/arrayset.fir @@ -1,7 +1,7 @@ // RUN: tco %s | FileCheck %s // CHECK-LABEL: define void @x([10 x float]* %0) -func @x(%arr : !fir.ref>) { +func.func @x(%arr : !fir.ref>) { %1 = arith.constant 0 : index %2 = arith.constant 9 : index %stepvar = arith.constant 1 : index @@ -21,4 +21,4 @@ return } -func private @y(!fir.box>) -> () +func.func private @y(!fir.box>) -> () diff --git a/flang/test/Fir/basic-program.fir b/flang/test/Fir/basic-program.fir --- a/flang/test/Fir/basic-program.fir +++ b/flang/test/Fir/basic-program.fir @@ -4,7 +4,7 @@ // Check that tco is working with a basic test. // Also check the passes in the default pipeline. -func @_QQmain() { +func.func @_QQmain() { return } diff --git a/flang/test/Fir/boxaddr-folding.fir b/flang/test/Fir/boxaddr-folding.fir --- a/flang/test/Fir/boxaddr-folding.fir +++ b/flang/test/Fir/boxaddr-folding.fir @@ -1,7 +1,7 @@ // RUN: fir-opt --canonicalize %s -split-input-file | FileCheck %s // CHECK-LABEL: func @check_no_folding -func @check_no_folding(%arg0 : !fir.ref>) { +func.func @check_no_folding(%arg0 : !fir.ref>) { %0 = fir.alloca i32 {adapt.valuebyref} %c1_i32 = arith.constant 1 : i32 %1 = fir.load %0 : !fir.ref @@ -19,14 +19,14 @@ return } -func @check(%arg0: !fir.ref>) { +func.func @check(%arg0: !fir.ref>) { return } // ----- // CHECK-LABEL: func @check_folding -func @check_folding(%arg0 : !fir.ref>) { +func.func @check_folding(%arg0 : !fir.ref>) { %0 = fir.alloca i32 {adapt.valuebyref} %c1_i32 = arith.constant 1 : i32 %1 = fir.load %0 : !fir.ref @@ -41,6 +41,6 @@ return } -func @check(%arg0: !fir.ref>) { +func.func @check(%arg0: !fir.ref>) { return } diff --git a/flang/test/Fir/boxchar.fir b/flang/test/Fir/boxchar.fir --- a/flang/test/Fir/boxchar.fir +++ b/flang/test/Fir/boxchar.fir @@ -2,10 +2,10 @@ // Test of building and passing boxchar. -func private @callee(%x : !fir.boxchar<1>) +func.func private @callee(%x : !fir.boxchar<1>) // CHECK-LABEL: define void @get_name -func @get_name() { +func.func @get_name() { %1 = fir.address_of (@name) : !fir.ref> %2 = arith.constant 9 : i64 %3 = fir.convert %1 : (!fir.ref>) -> !fir.ref> diff --git a/flang/test/Fir/cg-ops.fir b/flang/test/Fir/cg-ops.fir --- a/flang/test/Fir/cg-ops.fir +++ b/flang/test/Fir/cg-ops.fir @@ -2,7 +2,7 @@ // CHECK-LABEL: func @codegen( // CHECK-SAME: %[[arg:.*]]: !fir -func @codegen(%addr : !fir.ref>) { +func.func @codegen(%addr : !fir.ref>) { // CHECK: %[[zero:.*]] = arith.constant 0 : index %0 = arith.constant 0 : index %1 = fir.shape_shift %0, %0 : (index, index) -> !fir.shapeshift<1> @@ -37,7 +37,7 @@ // CHECK-LABEL: func @codegen( // CHECK-SAME: %[[arg:.*]]: !fir -func @codegen(%addr : !fir.ref>) { +func.func @codegen(%addr : !fir.ref>) { // CHECK: %[[zero:.*]] = arith.constant 0 : index %0 = arith.constant 0 : index %1 = fir.shape_shift %0, %0 : (index, index) -> !fir.shapeshift<1> @@ -53,7 +53,7 @@ // CHECK-LABEL: func @codegen( // CHECK-SAME: %[[arg:.*]]: !fir -func @codegen(%addr : !fir.box>) { +func.func @codegen(%addr : !fir.box>) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index diff --git a/flang/test/Fir/char-conversion.fir b/flang/test/Fir/char-conversion.fir --- a/flang/test/Fir/char-conversion.fir +++ b/flang/test/Fir/char-conversion.fir @@ -1,6 +1,6 @@ // RUN: fir-opt --character-conversion %s | FileCheck %s -func @char_convert() { +func.func @char_convert() { %1 = fir.undefined i32 %2 = fir.undefined !fir.ref> %3 = fir.undefined !fir.ref>> diff --git a/flang/test/Fir/convert-fold.fir b/flang/test/Fir/convert-fold.fir --- a/flang/test/Fir/convert-fold.fir +++ b/flang/test/Fir/convert-fold.fir @@ -1,7 +1,7 @@ // RUN: fir-opt --canonicalize %s | FileCheck %s // CHECK-LABEL: @ftest -func @ftest(%x : i1) -> i1 { +func.func @ftest(%x : i1) -> i1 { // this pair of converts should be folded and DCEd %1 = fir.convert %x : (i1) -> !fir.logical<1> %2 = fir.convert %1 : (!fir.logical<1>) -> i1 @@ -10,7 +10,7 @@ } // CHECK-LABEL: @gtest -func @gtest(%x : !fir.logical<2>) -> !fir.logical<2> { +func.func @gtest(%x : !fir.logical<2>) -> !fir.logical<2> { // this pair of converts should be folded and DCEd %1 = fir.convert %x : (!fir.logical<2>) -> i1 %2 = fir.convert %1 : (i1) -> !fir.logical<2> @@ -19,7 +19,7 @@ } // CHECK-LABEL: @htest -func @htest(%x : !fir.int<4>) -> !fir.int<4> { +func.func @htest(%x : !fir.int<4>) -> !fir.int<4> { // these converts are NOPs and should be folded away %1 = fir.convert %x : (!fir.int<4>) -> !fir.int<4> %2 = fir.convert %1 : (!fir.int<4>) -> !fir.int<4> @@ -28,7 +28,7 @@ } // CHECK-LABEL: @ctest -func @ctest() -> index { +func.func @ctest() -> index { %1 = arith.constant 10 : i32 %2 = fir.convert %1 : (i32) -> index // CHECK-NEXT: %{{.*}} = arith.constant 10 : index diff --git a/flang/test/Fir/convert-to-llvm-invalid.fir b/flang/test/Fir/convert-to-llvm-invalid.fir --- a/flang/test/Fir/convert-to-llvm-invalid.fir +++ b/flang/test/Fir/convert-to-llvm-invalid.fir @@ -5,7 +5,7 @@ // Test `fir.zero` conversion failure with aggregate type. // Not implemented yet. -func @zero_aggregate() { +func.func @zero_aggregate() { // expected-error@+1{{failed to legalize operation 'fir.zero_bits'}} %a = fir.zero_bits !fir.array<10xf32> return @@ -22,7 +22,7 @@ // Test `fir.shape` conversion failure because the op has uses. -func @shape_not_dead(%arg0: !fir.ref>, %i: index, %j: index) { +func.func @shape_not_dead(%arg0: !fir.ref>, %i: index, %j: index) { %c0 = arith.constant 1 : index // expected-error@+1{{failed to legalize operation 'fir.shape'}} %0 = fir.shape %c0, %c0 : (index, index) -> !fir.shape<2> @@ -34,7 +34,7 @@ // Test `fir.slice` conversion failure because the op has uses. -func @slice_not_dead(%arg0: !fir.ref>, %i: index, %j: index) { +func.func @slice_not_dead(%arg0: !fir.ref>, %i: index, %j: index) { %c0 = arith.constant 1 : index // expected-error@+1{{failed to legalize operation 'fir.slice'}} %0 = fir.slice %c0, %c0, %c0, %c0, %c0, %c0 : (index, index, index, index, index, index) -> !fir.slice<2> @@ -46,7 +46,7 @@ // Test `fir.shift` conversion failure because the op has uses. -func @shift_not_dead(%arg0: !fir.box>, %i: index) { +func.func @shift_not_dead(%arg0: !fir.box>, %i: index) { %c0 = arith.constant 1 : index // expected-error@+1{{failed to legalize operation 'fir.shift'}} %0 = fir.shift %c0 : (index) -> !fir.shift<1> @@ -58,7 +58,7 @@ // Test `fir.shape_shift` conversion failure because the op has uses. -func @shape_shift_not_dead(%arg0: !fir.ref>, %i: index, %j: index) { +func.func @shape_shift_not_dead(%arg0: !fir.ref>, %i: index, %j: index) { %c0 = arith.constant 1 : index // expected-error@+1{{failed to legalize operation 'fir.shape_shift'}} %0 = fir.shape_shift %c0, %c0, %c0, %c0 : (index, index, index, index) -> !fir.shapeshift<2> @@ -71,7 +71,7 @@ // Test `fir.select_type` conversion to llvm. // Should have been converted. -func @bar_select_type(%arg : !fir.box>) -> i32 { +func.func @bar_select_type(%arg : !fir.box>) -> i32 { %0 = arith.constant 1 : i32 %2 = arith.constant 3 : i32 // expected-error@+2{{fir.select_type should have already been converted}} @@ -92,7 +92,7 @@ // ----- // `fir.coordinate_of` - dynamically sized arrays are not supported -func @coordinate_of_dynamic_array(%arg0: !fir.ref>>, %arg1: index) { +func.func @coordinate_of_dynamic_array(%arg0: !fir.ref>>, %arg1: index) { // expected-error@+2{{fir.coordinate_of with a dynamic element size is unsupported}} // expected-error@+1{{failed to legalize operation 'fir.coordinate_of'}} %p = fir.coordinate_of %arg0, %arg1 : (!fir.ref>>, index) -> !fir.ref diff --git a/flang/test/Fir/convert-to-llvm-openmp-and-fir.fir b/flang/test/Fir/convert-to-llvm-openmp-and-fir.fir --- a/flang/test/Fir/convert-to-llvm-openmp-and-fir.fir +++ b/flang/test/Fir/convert-to-llvm-openmp-and-fir.fir @@ -1,6 +1,6 @@ // RUN: fir-opt --split-input-file --fir-to-llvm-ir="target=aarch64-unknown-linux-gnu" %s | FileCheck %s -func @_QPsb1(%arg0: !fir.ref {fir.bindc_name = "n"}, %arg1: !fir.ref> {fir.bindc_name = "arr"}) { +func.func @_QPsb1(%arg0: !fir.ref {fir.bindc_name = "n"}, %arg1: !fir.ref> {fir.bindc_name = "arr"}) { %c1_i64 = arith.constant 1 : i64 %c1_i32 = arith.constant 1 : i32 %0 = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFsbEi"} @@ -47,7 +47,7 @@ // ----- -func @_QPsb2(%arg0: !fir.ref {fir.bindc_name = "x"}, %arg1: !fir.ref {fir.bindc_name = "n"}) { +func.func @_QPsb2(%arg0: !fir.ref {fir.bindc_name = "x"}, %arg1: !fir.ref {fir.bindc_name = "n"}) { omp.parallel { omp.master { %0 = fir.load %arg1 : !fir.ref diff --git a/flang/test/Fir/convert-to-llvm-target.fir b/flang/test/Fir/convert-to-llvm-target.fir --- a/flang/test/Fir/convert-to-llvm-target.fir +++ b/flang/test/Fir/convert-to-llvm-target.fir @@ -9,7 +9,7 @@ // Test fir.emboxchar -func @test_embox(%char_array : !fir.ref>) -> () { +func.func @test_embox(%char_array : !fir.ref>) -> () { %c10 = arith.constant 10 : i64 %box_char = fir.emboxchar %char_array, %c10 : (!fir.ref>, i64) -> !fir.boxchar<1> return @@ -36,7 +36,7 @@ // Test fir.unboxchar -func @unboxchar_i8(%arg0 : !fir.boxchar<1>) -> () { +func.func @unboxchar_i8(%arg0 : !fir.boxchar<1>) -> () { %0:2 = fir.unboxchar %arg0 : (!fir.boxchar<1>) -> (!fir.ref>, i64) return } @@ -54,7 +54,7 @@ // INT32: %{{.*}} = llvm.sext %[[len_unextended]] : i32 to i64 // INT32-NEXT: llvm.return -func @unboxchar_i32(%arg0 : !fir.boxchar<4>) -> () { +func.func @unboxchar_i32(%arg0 : !fir.boxchar<4>) -> () { fir.unboxchar %arg0 : (!fir.boxchar<4>) -> (!fir.ref>, i64) return } @@ -76,7 +76,7 @@ // Test fir.boxchar_len -func @boxchar_len_i8_i32(%arg0 : !fir.boxchar<1>) -> () { +func.func @boxchar_len_i8_i32(%arg0 : !fir.boxchar<1>) -> () { fir.boxchar_len %arg0 : (!fir.boxchar<1>) -> i32 return } @@ -94,7 +94,7 @@ // INT32-NOT: llvm.sext // INT32-NEXT: llvm.return -func @boxchar_len_i8_i64(%arg0 : !fir.boxchar<1>) -> () { +func.func @boxchar_len_i8_i64(%arg0 : !fir.boxchar<1>) -> () { fir.boxchar_len %arg0 : (!fir.boxchar<1>) -> i64 return } @@ -112,7 +112,7 @@ // INT32: %{{.*}} = llvm.sext %0 : i32 to i64 // INT32-NEXT: llvm.return -func @boxchar_len_i32_i32(%arg0 : !fir.boxchar<4>) -> () { +func.func @boxchar_len_i32_i32(%arg0 : !fir.boxchar<4>) -> () { fir.boxchar_len %arg0 : (!fir.boxchar<4>) -> i32 return } @@ -130,7 +130,7 @@ // INT32-NOT: llvm.sext // INT32-NEXT: llvm.return -func @boxchar_len_i32_i64(%arg0 : !fir.boxchar<4>) -> (i64) { +func.func @boxchar_len_i32_i64(%arg0 : !fir.boxchar<4>) -> (i64) { %0 = fir.boxchar_len %arg0 : (!fir.boxchar<4>) -> i64 return %0 : i64 } diff --git a/flang/test/Fir/convert-to-llvm.fir b/flang/test/Fir/convert-to-llvm.fir --- a/flang/test/Fir/convert-to-llvm.fir +++ b/flang/test/Fir/convert-to-llvm.fir @@ -55,7 +55,7 @@ // Test conversion of fir.address_of with fir.global -func @f1() { +func.func @f1() { %0 = fir.address_of(@symbol) : !fir.ref return } @@ -115,7 +115,7 @@ // Test fir.zero_bits operation with LLVM ptr type -func @zero_test_ptr() { +func.func @zero_test_ptr() { %z = fir.zero_bits !llvm.ptr return } @@ -127,7 +127,7 @@ // Test fir.zero_bits operation with integer type. -func @zero_test_integer() { +func.func @zero_test_integer() { %z0 = fir.zero_bits i8 %z1 = fir.zero_bits i16 %z2 = fir.zero_bits i32 @@ -145,7 +145,7 @@ // Test fir.zero_bits operation with floating points types. -func @zero_test_float() { +func.func @zero_test_float() { %z0 = fir.zero_bits f16 %z1 = fir.zero_bits bf16 %z2 = fir.zero_bits f32 @@ -169,7 +169,7 @@ // and that fir.freemem is transformed to a call to free // Single item case -func @test_alloc_and_freemem_one() { +func.func @test_alloc_and_freemem_one() { %z0 = fir.allocmem i32 fir.freemem %z0 : !fir.heap return @@ -186,7 +186,7 @@ // and that fir.freemem is transformed to a call to free // Several item case -func @test_alloc_and_freemem_several() { +func.func @test_alloc_and_freemem_several() { %z0 = fir.allocmem !fir.array<100xf32> fir.freemem %z0 : !fir.heap> return @@ -203,7 +203,7 @@ // CHECK: llvm.return -func @test_with_shape(%ncols: index, %nrows: index) { +func.func @test_with_shape(%ncols: index, %nrows: index) { %1 = fir.allocmem !fir.array, %ncols, %nrows fir.freemem %1 : !fir.heap> return @@ -221,7 +221,7 @@ // CHECK: llvm.return // CHECK: } -func @test_string_with_shape(%len: index, %nelems: index) { +func.func @test_string_with_shape(%len: index, %nelems: index) { %1 = fir.allocmem !fir.array>(%len : index), %nelems fir.freemem %1 : !fir.heap>> return @@ -243,7 +243,7 @@ // Verify that fir.unreachable is transformed to llvm.unreachable -func @test_unreachable() { +func.func @test_unreachable() { fir.unreachable } @@ -257,7 +257,7 @@ // Check that the if-then-else ladder is correctly constructed and that we // branch to the correct block. -func @select(%arg : index, %arg2 : i32) -> i32 { +func.func @select(%arg : index, %arg2 : i32) -> i32 { %0 = arith.constant 1 : i32 %1 = arith.constant 2 : i32 %2 = arith.constant 3 : i32 @@ -304,7 +304,7 @@ // Check that the if-then-else ladder is correctly constructed and that we // branch to the correct block. -func @select_rank(%arg : i32, %arg2 : i32) -> i32 { +func.func @select_rank(%arg : i32, %arg2 : i32) -> i32 { %0 = arith.constant 1 : i32 %1 = arith.constant 2 : i32 %2 = arith.constant 3 : i32 @@ -347,7 +347,7 @@ // Test fir.extract_value operation conversion with derived type. -func @extract_derived_type() -> f32 { +func.func @extract_derived_type() -> f32 { %0 = fir.undefined !fir.type %1 = fir.extract_value %0, ["f", !fir.type] : (!fir.type) -> f32 return %1 : f32 @@ -363,7 +363,7 @@ // Test fir.extract_value operation conversion with a multi-dimensional array // of tuple. -func @extract_array(%a : !fir.array<10x10xtuple>) -> f32 { +func.func @extract_array(%a : !fir.array<10x10xtuple>) -> f32 { %0 = fir.extract_value %a, [5 : index, 4 : index, 1 : index] : (!fir.array<10x10xtuple>) -> f32 return %0 : f32 } @@ -378,7 +378,7 @@ // Test fir.insert_value operation conversion with a multi-dimensional array // of tuple. -func @extract_array(%a : !fir.array<10x10xtuple>) { +func.func @extract_array(%a : !fir.array<10x10xtuple>) { %f = arith.constant 2.0 : f32 %i = arith.constant 1 : i32 %0 = fir.insert_value %a, %i, [5 : index, 4 : index, 0 : index] : (!fir.array<10x10xtuple>, i32) -> !fir.array<10x10xtuple> @@ -396,7 +396,7 @@ // Test fir.insert_value operation conversion with derived type. -func @insert_tuple(%a : tuple) { +func.func @insert_tuple(%a : tuple) { %f = arith.constant 2.0 : f32 %1 = fir.insert_value %a, %f, [1 : index] : (tuple, f32) -> tuple return @@ -412,11 +412,11 @@ // Test `fir.call` -> `llvm.call` conversion for functions that take no arguments // and return nothing -func @dummy_basic() { +func.func @dummy_basic() { return } -func @test_call_basic() { +func.func @test_call_basic() { fir.call @dummy_basic() : () -> () return } @@ -429,11 +429,11 @@ // Test `fir.call` -> `llvm.call` conversion for functions that take one // argument and return nothing -func @dummy_with_arg(%arg0 : i32) { +func.func @dummy_with_arg(%arg0 : i32) { return } -func @test_call_with_arg(%arg0 : i32) { +func.func @test_call_with_arg(%arg0 : i32) { fir.call @dummy_with_arg(%arg0) : (i32) -> () return } @@ -446,12 +446,12 @@ // Test `fir.call` -> `llvm.call` conversion for functions that take no // arguments, but return a value -func @dummy_return_val() -> i32 { +func.func @dummy_return_val() -> i32 { %1 = arith.constant 123 : i32 return %1 : i32 } -func @test_call_return_val() -> i32 { +func.func @test_call_return_val() -> i32 { %1 = fir.call @dummy_return_val() : () -> (i32) return %1 : i32 } @@ -467,7 +467,7 @@ // given: (x + iy) + (x' + iy') // result: (x + x') + i(y + y') -func @fir_complex_add(%a: !fir.complex<16>, %b: !fir.complex<16>) -> !fir.complex<16> { +func.func @fir_complex_add(%a: !fir.complex<16>, %b: !fir.complex<16>) -> !fir.complex<16> { %c = fir.addc %a, %b : !fir.complex<16> return %c : !fir.complex<16> } @@ -492,7 +492,7 @@ // given: (x + iy) - (x' + iy') // result: (x - x') + i(y - y') -func @fir_complex_sub(%a: !fir.complex<16>, %b: !fir.complex<16>) -> !fir.complex<16> { +func.func @fir_complex_sub(%a: !fir.complex<16>, %b: !fir.complex<16>) -> !fir.complex<16> { %c = fir.subc %a, %b : !fir.complex<16> return %c : !fir.complex<16> } @@ -517,7 +517,7 @@ // given: (x + iy) * (x' + iy') // result: (xx'-yy')+i(xy'+yx') -func @fir_complex_mul(%a: !fir.complex<16>, %b: !fir.complex<16>) -> !fir.complex<16> { +func.func @fir_complex_mul(%a: !fir.complex<16>, %b: !fir.complex<16>) -> !fir.complex<16> { %c = fir.mulc %a, %b : !fir.complex<16> return %c : !fir.complex<16> } @@ -546,7 +546,7 @@ // given: (x + iy) / (x' + iy') // result: ((xx'+yy')/d) + i((yx'-xy')/d) where d = x'x' + y'y' -func @fir_complex_div(%a: !fir.complex<16>, %b: !fir.complex<16>) -> !fir.complex<16> { +func.func @fir_complex_div(%a: !fir.complex<16>, %b: !fir.complex<16>) -> !fir.complex<16> { %c = fir.divc %a, %b : !fir.complex<16> return %c : !fir.complex<16> } @@ -580,7 +580,7 @@ // given: -(x + iy) // result: -x - iy -func @fir_complex_neg(%a: !fir.complex<16>) -> !fir.complex<16> { +func.func @fir_complex_neg(%a: !fir.complex<16>) -> !fir.complex<16> { %c = fir.negc %a : !fir.complex<16> return %c : !fir.complex<16> } @@ -599,7 +599,7 @@ // Test FIR complex compare conversion -func @compare_complex_eq(%a : !fir.complex<8>, %b : !fir.complex<8>) -> i1 { +func.func @compare_complex_eq(%a : !fir.complex<8>, %b : !fir.complex<8>) -> i1 { %r = fir.cmpc "oeq", %a, %b : !fir.complex<8> return %r : i1 } @@ -616,7 +616,7 @@ // CHECK: [[RES:%.*]] = llvm.and [[RESR]], [[RESI]] : i1 // CHECK: return [[RES]] : i1 -func @compare_complex_ne(%a : !fir.complex<8>, %b : !fir.complex<8>) -> i1 { +func.func @compare_complex_ne(%a : !fir.complex<8>, %b : !fir.complex<8>) -> i1 { %r = fir.cmpc "une", %a, %b : !fir.complex<8> return %r : i1 } @@ -633,7 +633,7 @@ // CHECK: [[RES:%.*]] = llvm.or [[RESR]], [[RESI]] : i1 // CHECK: return [[RES]] : i1 -func @compare_complex_other(%a : !fir.complex<8>, %b : !fir.complex<8>) -> i1 { +func.func @compare_complex_other(%a : !fir.complex<8>, %b : !fir.complex<8>) -> i1 { %r = fir.cmpc "ogt", %a, %b : !fir.complex<8> return %r : i1 } @@ -650,7 +650,7 @@ // Test `fir.convert` operation conversion from Float type. -func @convert_from_float(%arg0 : f32) { +func.func @convert_from_float(%arg0 : f32) { %0 = fir.convert %arg0 : (f32) -> f16 %1 = fir.convert %arg0 : (f32) -> f32 %2 = fir.convert %arg0 : (f32) -> f64 @@ -681,7 +681,7 @@ // Test `fir.convert` operation conversion from Integer type. -func @convert_from_int(%arg0 : i32) { +func.func @convert_from_int(%arg0 : i32) { %0 = fir.convert %arg0 : (i32) -> f16 %1 = fir.convert %arg0 : (i32) -> f32 %2 = fir.convert %arg0 : (i32) -> f64 @@ -715,7 +715,7 @@ // Test `fir.convert` operation conversion from !fir.ref<> type. -func @convert_from_ref(%arg0 : !fir.ref) { +func.func @convert_from_ref(%arg0 : !fir.ref) { %0 = fir.convert %arg0 : (!fir.ref) -> !fir.ref %1 = fir.convert %arg0 : (!fir.ref) -> i32 return @@ -730,7 +730,7 @@ // Test `fir.convert` operation conversion between fir.complex types. -func @convert_complex4(%arg0 : !fir.complex<4>) -> !fir.complex<8> { +func.func @convert_complex4(%arg0 : !fir.complex<4>) -> !fir.complex<8> { %0 = fir.convert %arg0 : (!fir.complex<4>) -> !fir.complex<8> return %0 : !fir.complex<8> } @@ -748,7 +748,7 @@ // Test `fir.convert` operation conversion between fir.complex types. -func @convert_complex16(%arg0 : !fir.complex<16>) -> !fir.complex<2> { +func.func @convert_complex16(%arg0 : !fir.complex<16>) -> !fir.complex<2> { %0 = fir.convert %arg0 : (!fir.complex<16>) -> !fir.complex<2> return %0 : !fir.complex<2> } @@ -768,7 +768,7 @@ // Test constc. -func @test_constc4() -> !fir.complex<4> { +func.func @test_constc4() -> !fir.complex<4> { %0 = fir.constc (#fir.real<4, 1.4>, #fir.real<4, 2.3>) : !fir.complex<4> return %0 : !fir.complex<4> } @@ -782,7 +782,7 @@ // CHECK: [[full:%.*]] = llvm.insertvalue [[ip]], [[withr]][1 : i32] : !llvm.struct<(f32, f32)> // CHECK: return [[full]] : !llvm.struct<(f32, f32)> -func @test_constc8() -> !fir.complex<8> { +func.func @test_constc8() -> !fir.complex<8> { %0 = fir.constc (#fir.real<8, 1.8>, #fir.real<8, 2.3>) : !fir.complex<8> return %0 : !fir.complex<8> } @@ -800,7 +800,7 @@ // Test `fir.store` --> `llvm.store` conversion -func @test_store_index(%val_to_store : index, %addr : !fir.ref) { +func.func @test_store_index(%val_to_store : index, %addr : !fir.ref) { fir.store %val_to_store to %addr : !fir.ref return } @@ -811,7 +811,7 @@ // CHECK-NEXT: llvm.return // CHECK-NEXT: } -func @test_store_box(%array : !fir.ref>>, %box : !fir.box>) { +func.func @test_store_box(%array : !fir.ref>>, %box : !fir.box>) { fir.store %box to %array : !fir.ref>> return } @@ -828,7 +828,7 @@ // Test `fir.load` --> `llvm.load` conversion -func @test_load_index(%addr : !fir.ref) { +func.func @test_load_index(%addr : !fir.ref) { %0 = fir.load %addr : !fir.ref return } @@ -839,7 +839,7 @@ // CHECK-NEXT: llvm.return // CHECK-NEXT: } -func @test_load_box(%addr : !fir.ref>>) { +func.func @test_load_box(%addr : !fir.ref>>) { %0 = fir.load %addr : !fir.ref>> return } @@ -854,7 +854,7 @@ // Test `fir.box_rank` conversion. -func @extract_rank(%arg0: !fir.box>) -> i32 { +func.func @extract_rank(%arg0: !fir.box>) -> i32 { %0 = fir.box_rank %arg0 : (!fir.box>) -> i32 return %0 : i32 } @@ -870,7 +870,7 @@ // Test `fir.box_addr` conversion. -func @extract_addr(%arg0: !fir.box>) -> !fir.ref { +func.func @extract_addr(%arg0: !fir.box>) -> !fir.ref { %0 = fir.box_addr %arg0 : (!fir.box>) -> !fir.ref return %0 : !fir.ref } @@ -886,7 +886,7 @@ // Test `fir.box_dims` conversion. -func @extract_dims(%arg0: !fir.box>) -> index { +func.func @extract_dims(%arg0: !fir.box>) -> index { %c1 = arith.constant 0 : i32 %cast = fir.convert %arg0 : (!fir.box>) -> !fir.box> %0:3 = fir.box_dims %cast, %c1 : (!fir.box>, i32) -> (index, index, index) @@ -913,7 +913,7 @@ // Test `fir.box_elesize` conversion. -func @extract_elesize(%arg0: !fir.box) -> i32 { +func.func @extract_elesize(%arg0: !fir.box) -> i32 { %0 = fir.box_elesize %arg0 : (!fir.box) -> i32 return %0 : i32 } @@ -930,7 +930,7 @@ // Test `fir.box_isarray` conversion. // `rank` is extracted from `fir.box` and compare to 0. -func @box_isarray(%arg0: !fir.box>) -> i1 { +func.func @box_isarray(%arg0: !fir.box>) -> i1 { %0 = fir.box_isarray %arg0 : (!fir.box>) -> i1 return %0 : i1 } @@ -950,7 +950,7 @@ // `attribute` is extracted from `fir.box` and checked against a mask equal to // the value of `CFI_attribute_allocatable`. -func @box_isalloc(%arg0: !fir.box>) -> i1 { +func.func @box_isalloc(%arg0: !fir.box>) -> i1 { %0 = fir.box_isalloc %arg0 : (!fir.box>) -> i1 return %0 : i1 } @@ -972,7 +972,7 @@ // `attribute` is extracted from `fir.box` and checked against a mask equal to // the value of `CFI_attribute_pointer`. -func @box_isptr(%arg0: !fir.box>) -> i1 { +func.func @box_isptr(%arg0: !fir.box>) -> i1 { %0 = fir.box_isptr %arg0 : (!fir.box>) -> i1 return %0 : i1 } @@ -992,7 +992,7 @@ // Test fir.alloca of one element -func @alloca_one() -> !fir.ref { +func.func @alloca_one() -> !fir.ref { %1 = fir.alloca i32 return %1 : !fir.ref } @@ -1006,7 +1006,7 @@ // Test fir.alloca of several elements -func @alloca_several() -> !fir.ref { +func.func @alloca_several() -> !fir.ref { %0 = arith.constant 100 : index %1 = fir.alloca i32, %0 return %1 : !fir.ref @@ -1023,7 +1023,7 @@ // Test fir.alloca of pointer to array -func @alloca_ptr_to_array() -> !fir.ref>> { +func.func @alloca_ptr_to_array() -> !fir.ref>> { %1 = fir.alloca !fir.ptr> return %1 : !fir.ref>> } @@ -1037,7 +1037,7 @@ // Test fir.alloca of array of unknown-length chars -func @alloca_char_array(%l: i32, %e : index) -> !fir.ref>> { +func.func @alloca_char_array(%l: i32, %e : index) -> !fir.ref>> { %a = fir.alloca !fir.array>(%l : i32), %e, %e return %a : !fir.ref>> } @@ -1055,7 +1055,7 @@ // Test fir.alloca of array of known-length chars -func @alloca_fixed_char_array(%e : index) -> !fir.ref>> { +func.func @alloca_fixed_char_array(%e : index) -> !fir.ref>> { %a = fir.alloca !fir.array>, %e, %e return %a : !fir.ref>> } @@ -1078,9 +1078,9 @@ // real f2 // end type t -func private @_QTtP.mem.size(%0 : i32, %1 : i16) -> index +func.func private @_QTtP.mem.size(%0 : i32, %1 : i16) -> index -func @alloca_record(%arg0 : i32, %arg1 : i16) -> !fir.ref> { +func.func @alloca_record(%arg0 : i32, %arg1 : i16) -> !fir.ref> { %0 = fir.alloca !fir.type<_QTt(p1:i32,p2:i16){f1:i32,f2:f32}>(%arg0, %arg1 : i32, i16) {name = "_QEvar"} return %0 : !fir.ref> } @@ -1097,7 +1097,7 @@ // Test fir.alloca of a multidimensional array, with operands -func @alloca_multidim_array(%0 : index) -> !fir.ref> { +func.func @alloca_multidim_array(%0 : index) -> !fir.ref> { %1 = arith.constant 24 : index %2 = fir.alloca !fir.array<8x16x32xf32>, %0, %1 return %2 : !fir.ref> @@ -1116,7 +1116,7 @@ // Test fir.alloca of a multidimensional array with constant interior -func @alloca_const_interior_array(%0 : index) -> !fir.ref> { +func.func @alloca_const_interior_array(%0 : index) -> !fir.ref> { %1 = arith.constant 64 : index %2 = fir.alloca !fir.array<8x9x?x?xf32>, %0, %1 return %2 : !fir.ref> @@ -1136,7 +1136,7 @@ // Test alloca with an array with holes. // Constant factor of 60 (4*3*5) must be included. -func @alloca_array_with_holes(%0 : index, %1 : index) -> !fir.ref> { +func.func @alloca_array_with_holes(%0 : index, %1 : index) -> !fir.ref> { %a = fir.alloca !fir.array<4x?x3x?x5xi32>, %0, %1 return %a : !fir.ref> } @@ -1155,7 +1155,7 @@ // Test `fir.select_case` operation conversion with INTEGER. -func @select_case_integer(%arg0: !fir.ref) -> i32 { +func.func @select_case_integer(%arg0: !fir.ref) -> i32 { %2 = fir.load %arg0 : !fir.ref %c1_i32 = arith.constant 1 : i32 %c2_i32 = arith.constant 2 : i32 @@ -1265,7 +1265,7 @@ // Test `fir.select_case` operation conversion with LOGICAL. -func @select_case_logical(%arg0: !fir.ref>) { +func.func @select_case_logical(%arg0: !fir.ref>) { %1 = fir.load %arg0 : !fir.ref> %2 = fir.convert %1 : (!fir.logical<4>) -> i1 %false = arith.constant false @@ -1308,7 +1308,7 @@ // Test `fir.is_present` -func @test_is_present_i64(%arg0: !fir.ref) -> () { +func.func @test_is_present_i64(%arg0: !fir.ref) -> () { %0 = fir.is_present %arg0 : (!fir.ref) -> i1 return } @@ -1321,7 +1321,7 @@ // CHECK-NEXT: llvm.return // CHECK-NEXT: } -func @test_is_present_box(%arg0: !fir.box>) -> () { +func.func @test_is_present_box(%arg0: !fir.box>) -> () { %0 = fir.is_present %arg0 : (!fir.box>) -> i1 return } @@ -1339,7 +1339,7 @@ // Test `fir.absent` -func @test_absent_i64() -> () { +func.func @test_absent_i64() -> () { %0 = fir.absent !fir.ref return } @@ -1349,7 +1349,7 @@ // CHECK-NEXT: llvm.return // CHECK-NEXT: } -func @test_absent_box() -> () { +func.func @test_absent_box() -> () { %0 = fir.absent !fir.box> return } @@ -1363,7 +1363,7 @@ // This is a bit more comprehensive test for `fir.is_present` and `fir.absent` // when used together -func @is_present(%arg0: !fir.ref) -> i1 { +func.func @is_present(%arg0: !fir.ref) -> i1 { %0 = fir.is_present %arg0 : (!fir.ref) -> i1 return %0 : i1 } @@ -1376,7 +1376,7 @@ // CHECK-NEXT: llvm.return %[[ret_val]] : i1 // CHECK-NEXT: } -func @absent() -> i1 { +func.func @absent() -> i1 { %0 = fir.absent !fir.ref %1 = fir.call @is_present(%0) : (!fir.ref) -> i1 return %1 : i1 @@ -1392,7 +1392,7 @@ // Test `fir.string_lit` conversion. -func @string_lit0() { +func.func @string_lit0() { %1 = fir.string_lit "Hello, World!"(13) : !fir.char<1> return } @@ -1400,7 +1400,7 @@ // CHECK-LABEL: llvm.func @string_lit0 // CHECK: %{{.*}} = llvm.mlir.constant("Hello, World!") : !llvm.array<13 x i8> -func @string_lit1() { +func.func @string_lit1() { %2 = fir.string_lit [158, 2345](2) : !fir.char<2> return } @@ -1412,7 +1412,7 @@ // Test must be dead conversion. -func @dead_shift() { +func.func @dead_shift() { %c0 = arith.constant 0 : index %0 = fir.shift %c0 : (index) -> !fir.shift<1> return @@ -1423,7 +1423,7 @@ // CHECK: %{{.*}} = llvm.mlir.constant(0 : index) : i{{.*}} // CHECK-NEXT: llvm.return -func @dead_shape() { +func.func @dead_shape() { %c0 = arith.constant 0 : index %0 = fir.shape %c0 : (index) -> !fir.shape<1> return @@ -1434,7 +1434,7 @@ // CHECK: %{{.*}} = llvm.mlir.constant(0 : index) : i{{.*}} // CHECK-NEXT: llvm.return -func @dead_shapeshift() { +func.func @dead_shapeshift() { %c0 = arith.constant 0 : index %0 = fir.shape_shift %c0, %c0 : (index, index) -> !fir.shapeshift<1> return @@ -1445,7 +1445,7 @@ // CHECK: %{{.*}} = llvm.mlir.constant(0 : index) : i{{.*}} // CHECK-NEXT: llvm.return -func @dead_slice() { +func.func @dead_slice() { %c0 = arith.constant 0 : index %0 = fir.slice %c0, %c0, %c0 : (index, index, index) -> !fir.slice<1> return @@ -1460,7 +1460,7 @@ // Test `fir.box_tdesc` conversion. -func @box_tdesc(%arg0: !fir.box) { +func.func @box_tdesc(%arg0: !fir.box) { %0 = fir.box_tdesc %arg0 : (!fir.box) -> !fir.tdesc return } @@ -1481,7 +1481,7 @@ // position of the fields in the descriptor as defined in `CFI_cdesc_t` in // flang/ISO_Fortran_binding.h. -func @embox0(%arg0: !fir.ref>) { +func.func @embox0(%arg0: !fir.ref>) { %0 = fir.embox %arg0() : (!fir.ref>) -> !fir.box> return } @@ -1530,7 +1530,7 @@ // attribute in the descriptor is set to 1 (value of CFI_attribute_pointer // in flang/ISO_Fortran_binding.h). -func @embox_pointer(%arg0: !fir.ref) { +func.func @embox_pointer(%arg0: !fir.ref) { %0 = fir.embox %arg0 : (!fir.ref) -> !fir.box> return } @@ -1546,7 +1546,7 @@ // attribute in the descriptor is set to 2 (value of CFI_attribute_allocatable // in flang/ISO_Fortran_binding.h). -func @embox_allocatable(%arg0: !fir.heap>>) { +func.func @embox_allocatable(%arg0: !fir.heap>>) { %0 = fir.embox %arg0 : (!fir.heap>>) -> !fir.box>>> return } @@ -1558,7 +1558,7 @@ // Check `fir.embox` conversion of a type code. -func @embox_typecode0(%arg0: !fir.ref) { +func.func @embox_typecode0(%arg0: !fir.ref) { %0 = fir.embox %arg0 : (!fir.ref) -> !fir.box> return } @@ -1568,7 +1568,7 @@ // CHECK: %[[TYPE_CODE_I64_I8:.*]] = llvm.trunc %[[TYPE_CODE_I64]] : i32 to i8 // CHECK: %{{.*}} = llvm.insertvalue %[[TYPE_CODE_I64_I8]], %{{.*}}[4 : i32] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}})> -func @embox_typecode1(%arg0: !fir.ref) { +func.func @embox_typecode1(%arg0: !fir.ref) { %0 = fir.embox %arg0 : (!fir.ref) -> !fir.box> return } @@ -1578,7 +1578,7 @@ // CHECK: %[[TYPE_CODE_F32_I8:.*]] = llvm.trunc %[[TYPE_CODE_I64]] : i32 to i8 // CHECK: %{{.*}} = llvm.insertvalue %[[TYPE_CODE_F32_I8]], %{{.*}}[4 : i32] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}})> -func @embox_typecode2(%arg0: !fir.ref) { +func.func @embox_typecode2(%arg0: !fir.ref) { %0 = fir.embox %arg0 : (!fir.ref) -> !fir.box> return } @@ -1588,7 +1588,7 @@ // CHECK: %[[TYPE_CODE_F128_I8:.*]] = llvm.trunc %[[TYPE_CODE_F128]] : i32 to i8 // CHECK: %{{.*}} = llvm.insertvalue %[[TYPE_CODE_F128_I8]], %{{.*}}[4 : i32] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}})> -func @embox_typecode3(%arg0: !fir.ref>) { +func.func @embox_typecode3(%arg0: !fir.ref>) { %0 = fir.embox %arg0 : (!fir.ref>) -> !fir.box>> return } @@ -1598,7 +1598,7 @@ // CHECK: %[[TYPE_CODE_CPLX4_I8:.*]] = llvm.trunc %[[TYPE_CODE_F128]] : i32 to i8 // CHECK: %{{.*}} = llvm.insertvalue %[[TYPE_CODE_CPLX4_I8]], %{{.*}}[4 : i32] : !llvm.struct<(ptr>, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}})> -func @embox_typecode4(%arg0: !fir.ref>) { +func.func @embox_typecode4(%arg0: !fir.ref>) { %0 = fir.embox %arg0 : (!fir.ref>) -> !fir.box>> return } @@ -1619,7 +1619,7 @@ fir.global linkonce @_QMtest_dinitE.dt.tseq constant : i8 -func @embox1(%arg0: !fir.ref>) { +func.func @embox1(%arg0: !fir.ref>) { %0 = fir.embox %arg0() : (!fir.ref>) -> !fir.box> return } @@ -1640,7 +1640,7 @@ // Test `fir.field_index` -func @field_index_static_size_1_elem() -> () { +func.func @field_index_static_size_1_elem() -> () { %1 = fir.field_index i, !fir.type return } @@ -1649,7 +1649,7 @@ // CHECK-NEXT: %{{.*}} = llvm.mlir.constant(0 : i32) : i32 // CHECK-NEXT: llvm.return -func @field_index_static_size_3_elems() -> () { +func.func @field_index_static_size_3_elems() -> () { %1 = fir.field_index k, !fir.type return } @@ -1661,10 +1661,10 @@ // When converting `fir.field_index` for a dynamically sized record, the // offset will be calculated at runtime by calling methods like the ones // below. Note that these methods would normally be generated by the compiler. -func private @custom_typeP.field_1.offset() -> i32 -func private @custom_typeP.field_2.offset() -> i32 +func.func private @custom_typeP.field_1.offset() -> i32 +func.func private @custom_typeP.field_2.offset() -> i32 -func @field_index_dynamic_size() -> () { +func.func @field_index_dynamic_size() -> () { %1 = fir.field_index field_1, !fir.type}> %2 = fir.field_index field_2, !fir.type}> return @@ -1679,7 +1679,7 @@ // Check `fir.no_reassoc` conversion to LLVM IR dialect -func @no_reassoc(%arg0: !fir.ref) { +func.func @no_reassoc(%arg0: !fir.ref) { %0 = fir.alloca i32 %1 = fir.load %arg0 : !fir.ref %2 = fir.no_reassoc %1 : i32 @@ -1701,7 +1701,7 @@ // Check complete `fircg.ext_embox`. -func @xembox0(%arg0: !fir.ref>) { +func.func @xembox0(%arg0: !fir.ref>) { %c0 = arith.constant 0 : i64 %0 = fircg.ext_embox %arg0(%c0) origin %c0[%c0, %c0, %c0] : (!fir.ref>, i64, i64, i64, i64, i64) -> !fir.box> return @@ -1754,7 +1754,7 @@ // Check adjustment of element scaling factor. -func @xembox1(%arg0: !fir.ref>>) { +func.func @xembox1(%arg0: !fir.ref>>) { %c0 = arith.constant 0 : i64 %0 = fircg.ext_embox %arg0(%c0) origin %c0[%c0, %c0, %c0] : (!fir.ref>>, i64, i64, i64, i64, i64) -> !fir.box>> return @@ -1779,7 +1779,7 @@ // ``` // N is the upperbound, sh1 and sh2 are the shifts or lowerbounds -func @_QPsb(%N: index, %sh1: index, %sh2: index) { +func.func @_QPsb(%N: index, %sh1: index, %sh2: index) { %c4 = arith.constant 4 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index @@ -1794,7 +1794,7 @@ fir.call @_QPxb(%box) : (!fir.box>) -> () return } -func private @_QPxb(!fir.box>) +func.func private @_QPxb(!fir.box>) // CHECK-LABEL: llvm.func @_QPsb( // CHECK-SAME: %[[N:.*]]: i64, %[[SH1:.*]]: i64, %[[SH2:.*]]: i64) { @@ -1865,7 +1865,7 @@ // Conversion with a subcomponent. -func @_QPtest_dt_slice() { +func.func @_QPtest_dt_slice() { %c20 = arith.constant 20 : index %c1_i64 = arith.constant 1 : i64 %c10_i64 = arith.constant 10 : i64 @@ -1877,7 +1877,7 @@ fir.call @_QPtest_dt_callee(%5) : (!fir.box>) -> () return } -func private @_QPtest_dt_callee(%arg0: !fir.box>) +func.func private @_QPtest_dt_callee(%arg0: !fir.box>) // CHECK-LABEL: llvm.func @_QPtest_dt_slice // CHECK: %[[ALLOCA_SIZE:.*]] = llvm.mlir.constant(1 : i32) : i32 @@ -1937,7 +1937,7 @@ // Conversion with only shape and indice. -func @ext_array_coor0(%arg0: !fir.ref>) { +func.func @ext_array_coor0(%arg0: !fir.ref>) { %c0 = arith.constant 0 : i64 %1 = fircg.ext_array_coor %arg0(%c0) <%c0> : (!fir.ref>, i64, i64) -> !fir.ref return @@ -1957,7 +1957,7 @@ // Conversion with shift and slice. -func @ext_array_coor1(%arg0: !fir.ref>) { +func.func @ext_array_coor1(%arg0: !fir.ref>) { %c0 = arith.constant 0 : i64 %1 = fircg.ext_array_coor %arg0(%c0) origin %c0[%c0, %c0, %c0]<%c0> : (!fir.ref>, i64, i64, i64, i64, i64, i64) -> !fir.ref return @@ -1979,7 +1979,7 @@ // Conversion for a dynamic length char. -func @ext_array_coor2(%arg0: !fir.ref>>) { +func.func @ext_array_coor2(%arg0: !fir.ref>>) { %c0 = arith.constant 0 : i64 %1 = fircg.ext_array_coor %arg0(%c0) <%c0> : (!fir.ref>>, i64, i64) -> !fir.ref return @@ -1999,7 +1999,7 @@ // Conversion for a `fir.box`. -func @ext_array_coor3(%arg0: !fir.box>) { +func.func @ext_array_coor3(%arg0: !fir.box>) { %c0 = arith.constant 0 : i64 %1 = fircg.ext_array_coor %arg0(%c0) <%c0> : (!fir.box>, i64, i64) -> !fir.ref return @@ -2028,7 +2028,7 @@ // Conversion with non zero shift and slice. -func @ext_array_coor4(%arg0: !fir.ref>) { +func.func @ext_array_coor4(%arg0: !fir.ref>) { %c0 = arith.constant 0 : i64 %c10 = arith.constant 10 : i64 %c20 = arith.constant 20 : i64 @@ -2064,8 +2064,8 @@ // call bar(x(5, 6:80:3)) // end subroutine -func private @bar1(!fir.box>) -func @test_rebox_1(%arg0: !fir.box>) { +func.func private @bar1(!fir.box>) +func.func @test_rebox_1(%arg0: !fir.box>) { %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index @@ -2143,8 +2143,8 @@ // Test a rebox of an array section like x(3:60:9)%c(2:8) with both a triplet, a component and a substring where x is a fir.box. -func private @bar(!fir.box>>) -func @foo(%arg0: !fir.box}>>>) { +func.func private @bar(!fir.box>>) +func.func @foo(%arg0: !fir.box}>>>) { %c3_i64 = arith.constant 3 : i64 %c60_i64 = arith.constant 60 : i64 %c9_i64 = arith.constant 9 : i64 @@ -2218,7 +2218,7 @@ // 1. COMPLEX TYPE (`fir.complex` is a special case) // Complex type wrapped in `fir.ref` -func @coordinate_ref_complex(%arg0: !fir.ref>) { +func.func @coordinate_ref_complex(%arg0: !fir.ref>) { %arg1 = llvm.mlir.constant(0 : i32) : i32 %p = fir.coordinate_of %arg0, %arg1 : (!fir.ref>, i32) -> !fir.ref return @@ -2232,7 +2232,7 @@ // ----- // Complex type wrapped in `fir.box` -func @coordinate_box_complex(%arg0: !fir.box>) { +func.func @coordinate_box_complex(%arg0: !fir.box>) { %arg1 = llvm.mlir.constant(0 : i32) : i32 %p = fir.coordinate_of %arg0, %arg1 : (!fir.box>, i32) -> !fir.ref return @@ -2249,7 +2249,7 @@ // 2. BOX TYPE (objects wrapped in `fir.box`) // Derived type - basic case (1 index) -func @coordinate_box_derived_1(%arg0: !fir.box>) { +func.func @coordinate_box_derived_1(%arg0: !fir.box>) { %idx = fir.field_index field_2, !fir.type %q = fir.coordinate_of %arg0, %idx : (!fir.box>, !fir.field) -> !fir.ref return @@ -2268,7 +2268,7 @@ // CHECK-NEXT: llvm.return // Derived type - basic case (2 indices) -func @coordinate_box_derived_2(%arg0: !fir.box, field_2:i32}>>) { +func.func @coordinate_box_derived_2(%arg0: !fir.box, field_2:i32}>>) { %idx0 = fir.field_index field_1, !fir.type, field_2:i32}> %idx1 = fir.field_index inner2, !fir.type %q = fir.coordinate_of %arg0, %idx0, %idx1 : (!fir.box, field_2:i32}>>, !fir.field, !fir.field) -> !fir.ref @@ -2300,7 +2300,7 @@ // 3. BOX TYPE - `fir.array` wrapped in `fir.box` // `fir.array` inside a `fir.box` (1d) -func @coordinate_box_array_1d(%arg0: !fir.box>, %arg1: index) { +func.func @coordinate_box_array_1d(%arg0: !fir.box>, %arg1: index) { %p = fir.coordinate_of %arg0, %arg1 : (!fir.box>, index) -> !fir.ref return } @@ -2331,7 +2331,7 @@ // CHECK-NEXT: llvm.return // `fir.array` inside a `fir.box` (1d) - dynamic size -func @coordinate_of_box_dynamic_array_1d(%arg0: !fir.box>, %arg1: index) { +func.func @coordinate_of_box_dynamic_array_1d(%arg0: !fir.box>, %arg1: index) { %p = fir.coordinate_of %arg0, %arg1 : (!fir.box>, index) -> !fir.ref return } @@ -2365,7 +2365,7 @@ // ----- // `fir.array` inside a `fir.box` (2d) -func @coordinate_box_array_2d(%arg0: !fir.box>, %arg1: index, %arg2: index) { +func.func @coordinate_box_array_2d(%arg0: !fir.box>, %arg1: index, %arg2: index) { %p = fir.coordinate_of %arg0, %arg1, %arg2 : (!fir.box>, index, index) -> !fir.ref return } @@ -2413,7 +2413,7 @@ // Test `fir.coordinate_of` conversion (items inside `!fir.box`) // 4. BOX TYPE - `fir.derived` inside `fir.array` -func @coordinate_box_derived_inside_array(%arg0: !fir.box>>, %arg1 : index) { +func.func @coordinate_box_derived_inside_array(%arg0: !fir.box>>, %arg1 : index) { %idx0 = fir.field_index field_2, !fir.type %q = fir.coordinate_of %arg0, %arg1, %idx0 : (!fir.box>>, index, !fir.field) -> !fir.ref return @@ -2447,7 +2447,7 @@ // Test `fir.coordinate_of` conversion (items inside `!fir.ref`) // 5.1. `fir.array` -func @coordinate_array_unknown_size_1d(%arg0: !fir.ref>, %arg1 : index) { +func.func @coordinate_array_unknown_size_1d(%arg0: !fir.ref>, %arg1 : index) { %q = fir.coordinate_of %arg0, %arg1 : (!fir.ref>, index) -> !fir.ref return } @@ -2460,7 +2460,7 @@ // ----- -func @coordinate_array_known_size_1d(%arg0: !fir.ref>, %arg1 : index) { +func.func @coordinate_array_known_size_1d(%arg0: !fir.ref>, %arg1 : index) { %q = fir.coordinate_of %arg0, %arg1 : (!fir.ref>, index) -> !fir.ref return } @@ -2474,7 +2474,7 @@ // ----- -func @coordinate_array_known_size_2d_get_i32(%arg0: !fir.ref>, %arg1 : index, %arg2 : index) { +func.func @coordinate_array_known_size_2d_get_i32(%arg0: !fir.ref>, %arg1 : index, %arg2 : index) { %q = fir.coordinate_of %arg0, %arg1, %arg2 : (!fir.ref>, index, index) -> !fir.ref return } @@ -2489,7 +2489,7 @@ // ----- -func @coordinate_array_known_size_2d_get_array(%arg0: !fir.ref>, %arg1 : index) { +func.func @coordinate_array_known_size_2d_get_array(%arg0: !fir.ref>, %arg1 : index) { %q = fir.coordinate_of %arg0, %arg1 : (!fir.ref>, index) -> !fir.ref> return } @@ -2504,7 +2504,7 @@ // ----- // 5.2. `fir.derived` -func @coordinate_ref_derived(%arg0: !fir.ref>) { +func.func @coordinate_ref_derived(%arg0: !fir.ref>) { %idx = fir.field_index field_2, !fir.type %q = fir.coordinate_of %arg0, %idx : (!fir.ref>, !fir.field) -> !fir.ref return @@ -2518,7 +2518,7 @@ // ----- -func @coordinate_ref_derived_nested(%arg0: !fir.ref, field_2:i32}>>) { +func.func @coordinate_ref_derived_nested(%arg0: !fir.ref, field_2:i32}>>) { %idx0 = fir.field_index field_1, !fir.type, field_2:i32}> %idx1 = fir.field_index inner2, !fir.type %q = fir.coordinate_of %arg0, %idx0, %idx1 : (!fir.ref, field_2:i32}>>, !fir.field, !fir.field) -> !fir.ref @@ -2534,7 +2534,7 @@ // ----- // 5.3 `fir.char` -func @test_coordinate_of_char(%arr : !fir.ref>) { +func.func @test_coordinate_of_char(%arr : !fir.ref>) { %1 = arith.constant 10 : i32 %2 = fir.coordinate_of %arr, %1 : (!fir.ref>, i32) -> !fir.ref return @@ -2549,7 +2549,7 @@ // ----- // 5.4 `mlir.tuple` -func @test_coordinate_of_tuple(%tup : !fir.ref>>) { +func.func @test_coordinate_of_tuple(%tup : !fir.ref>>) { %1 = arith.constant 0 : i32 %2 = fir.coordinate_of %tup, %1 : (!fir.ref>>, i32) -> !fir.ref return @@ -2568,7 +2568,7 @@ // gen). Instead of duplicating the tests, only one for sanity-checking is added. // 6.1. `fir.array` -func @coordinate_array_unknown_size_1d(%arg0: !fir.ptr>, %arg1 : index) { +func.func @coordinate_array_unknown_size_1d(%arg0: !fir.ptr>, %arg1 : index) { %q = fir.coordinate_of %arg0, %arg1 : (!fir.ptr>, index) -> !fir.ref return } diff --git a/flang/test/Fir/cse.fir b/flang/test/Fir/cse.fir --- a/flang/test/Fir/cse.fir +++ b/flang/test/Fir/cse.fir @@ -1,7 +1,7 @@ // RUN: fir-opt --cse -split-input-file %s | FileCheck %s // Check that the redundant fir.load is removed. -func @fun(%arg0: !fir.ref) -> i64 { +func.func @fun(%arg0: !fir.ref) -> i64 { %0 = fir.load %arg0 : !fir.ref %1 = fir.load %arg0 : !fir.ref %2 = arith.addi %0, %1 : i64 @@ -16,7 +16,7 @@ // CHECK-LABEL: func @fun( // CHECK-SAME: %[[A:.*]]: !fir.ref -func @fun(%a : !fir.ref) -> i64 { +func.func @fun(%a : !fir.ref) -> i64 { // CHECK: %[[LOAD:.*]] = fir.load %[[A]] : !fir.ref %1 = fir.load %a : !fir.ref %2 = fir.load %a : !fir.ref @@ -43,7 +43,7 @@ // ----- -func @fun(%a : !fir.ref) -> i64 { +func.func @fun(%a : !fir.ref) -> i64 { cf.br ^bb1 ^bb1: %1 = fir.load %a : !fir.ref diff --git a/flang/test/Fir/embox.fir b/flang/test/Fir/embox.fir --- a/flang/test/Fir/embox.fir +++ b/flang/test/Fir/embox.fir @@ -2,12 +2,12 @@ // CHECK-LABEL: define void @_QPtest_callee({ i32*, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }* %0) -func @_QPtest_callee(%arg0: !fir.box>) { +func.func @_QPtest_callee(%arg0: !fir.box>) { return } // CHECK-LABEL: define void @_QPtest_slice() -func @_QPtest_slice() { +func.func @_QPtest_slice() { // CHECK: %[[a1:.*]] = alloca { i32*, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8, // CHECK: %[[a2:.*]] = alloca [20 x i32], i64 1, align 4, // CHECK: %[[a3:.*]] = getelementptr [20 x i32], [20 x i32]* %[[a2]], i64 0, i64 0, @@ -29,12 +29,12 @@ } // CHECK-LABEL: define void @_QPtest_dt_callee({ i32*, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }* %0) -func @_QPtest_dt_callee(%arg0: !fir.box>) { +func.func @_QPtest_dt_callee(%arg0: !fir.box>) { return } // CHECK-LABEL: define void @_QPtest_dt_slice() -func @_QPtest_dt_slice() { +func.func @_QPtest_dt_slice() { // CHECK: %[[a1:.*]] = alloca { i32*, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8, // CHECK: %[[a3:.*]] = alloca [20 x %_QFtest_dt_sliceTt], i64 1, align 8, // CHECK: %[[a4:.*]] = getelementptr [20 x %_QFtest_dt_sliceTt], [20 x %_QFtest_dt_sliceTt]* %[[a3]], i64 0, i64 0, i32 0, @@ -60,10 +60,10 @@ return } -func private @do_something(!fir.box>) -> () +func.func private @do_something(!fir.box>) -> () // CHECK: define void @fir_dev_issue_1416 // CHECK-SAME: [40 x float]* %[[base_addr:.*]], i64 %[[low:.*]], i64 %[[up:.*]], i64 %[[at:.*]]) -func @fir_dev_issue_1416(%arg0: !fir.ref>, %low: index, %up: index, %at : index) { +func.func @fir_dev_issue_1416(%arg0: !fir.ref>, %low: index, %up: index, %at : index) { // Test fir.embox with a constant interior array shape. %c1 = arith.constant 1 : index %c40 = arith.constant 40 : index diff --git a/flang/test/Fir/external-mangling-emboxproc.fir b/flang/test/Fir/external-mangling-emboxproc.fir --- a/flang/test/Fir/external-mangling-emboxproc.fir +++ b/flang/test/Fir/external-mangling-emboxproc.fir @@ -1,11 +1,11 @@ // RUN: fir-opt --external-name-interop %s | FileCheck %s -func @_QPfoo() { +func.func @_QPfoo() { %e6 = fir.alloca tuple %ao = fir.address_of(@_QPfoo_impl) : (!fir.box>) -> () %0 = fir.emboxproc %ao, %e6 : ((!fir.box>) -> (), !fir.ref>) -> !fir.boxproc<(!fir.box>) -> ()> return } -func private @_QPfoo_impl(!fir.ref) +func.func private @_QPfoo_impl(!fir.ref) // CHECK: fir.address_of(@foo_impl_) diff --git a/flang/test/Fir/external-mangling.fir b/flang/test/Fir/external-mangling.fir --- a/flang/test/Fir/external-mangling.fir +++ b/flang/test/Fir/external-mangling.fir @@ -1,6 +1,6 @@ // RUN: fir-opt --external-name-interop %s | FileCheck %s -func @_QPfoo() { +func.func @_QPfoo() { %c0 = arith.constant 0 : index %0 = fir.address_of(@_QBa) : !fir.ref> %1 = fir.convert %0 : (!fir.ref>) -> !fir.ref> @@ -16,8 +16,8 @@ } fir.global common @_QBa(dense<0> : vector<4xi8>) : !fir.array<4xi8> fir.global common @_QB(dense<0> : vector<4xi8>) : !fir.array<4xi8> -func private @_QPbar(!fir.ref) -func private @_QPbar2(!fir.ref) +func.func private @_QPbar(!fir.ref) +func.func private @_QPbar2(!fir.ref) // CHECK: func @foo_ // CHECK: %{{.*}} = fir.address_of(@a_) : !fir.ref> diff --git a/flang/test/Fir/fir-ops.fir b/flang/test/Fir/fir-ops.fir --- a/flang/test/Fir/fir-ops.fir +++ b/flang/test/Fir/fir-ops.fir @@ -6,34 +6,34 @@ // CHECK: func private @box1() -> !fir.boxchar<2> // CHECK: func private @box2() -> !fir.boxproc<(i32, i32) -> i64> // CHECK: func private @box3() -> !fir.box> -func private @it1() -> !fir.int<4> -func private @box1() -> !fir.boxchar<2> -func private @box2() -> !fir.boxproc<(i32, i32) -> i64> -func private @box3() -> !fir.box> +func.func private @it1() -> !fir.int<4> +func.func private @box1() -> !fir.boxchar<2> +func.func private @box2() -> !fir.boxproc<(i32, i32) -> i64> +func.func private @box3() -> !fir.box> // Fortran SUBROUTINE and FUNCTION // CHECK-LABEL: func private @print_index3(index, index, index) // CHECK: func private @user_i64(i64) // CHECK: func private @user_tdesc(!fir.tdesc>) -func private @print_index3(index, index, index) -func private @user_i64(i64) -func private @user_tdesc(!fir.tdesc>) +func.func private @print_index3(index, index, index) +func.func private @user_i64(i64) +func.func private @user_tdesc(!fir.tdesc>) // expect the void return to be omitted // CHECK-LABEL: func private @store_tuple(tuple>) // CHECK: func private @get_method_box() -> !fir.box> // CHECK: func private @method_impl(!fir.box>) -func private @store_tuple(tuple>) -> () -func private @get_method_box() -> !fir.box> -func private @method_impl(!fir.box>) +func.func private @store_tuple(tuple>) -> () +func.func private @get_method_box() -> !fir.box> +func.func private @method_impl(!fir.box>) // CHECK-LABEL: func private @nop() // CHECK-LABEL: func private @get_func() -> (() -> ()) -func private @nop() -func private @get_func() -> (() -> ()) +func.func private @nop() +func.func private @get_func() -> (() -> ()) // CHECK-LABEL: func @instructions() { -func @instructions() { +func.func @instructions() { // CHECK: [[VAL_0:%.*]] = fir.alloca !fir.array<10xi32> // CHECK: [[VAL_1:%.*]] = fir.load [[VAL_0]] : !fir.ref> // CHECK: [[VAL_2:%.*]] = fir.alloca i32 @@ -143,7 +143,7 @@ } // CHECK-LABEL: func @boxing_match() { -func @boxing_match() { +func.func @boxing_match() { // CHECK: [[VAL_38:%.*]] = fir.alloca i32 // CHECK: [[VAL_39:%.*]] = fir.alloca !fir.type // CHECK: [[VAL_40:%.*]] = fir.alloca !fir.char<1> @@ -198,7 +198,7 @@ } // CHECK-LABEL: func @loop() { -func @loop() { +func.func @loop() { // CHECK: [[VAL_62:%.*]] = arith.constant 1 : index // CHECK: [[VAL_63:%.*]] = arith.constant 10 : index // CHECK: [[VAL_64:%.*]] = arith.constant true @@ -226,7 +226,7 @@ } // CHECK: func @bar_select([[VAL_66:%.*]]: i32, [[VAL_67:%.*]]: i32) -> i32 { -func @bar_select(%arg : i32, %arg2 : i32) -> i32 { +func.func @bar_select(%arg : i32, %arg2 : i32) -> i32 { // CHECK: [[VAL_68:%.*]] = arith.constant 1 : i32 // CHECK: [[VAL_69:%.*]] = arith.constant 2 : i32 // CHECK: [[VAL_70:%.*]] = arith.constant 3 : i32 @@ -271,7 +271,7 @@ // CHECK-LABEL: func @bar_select_rank( // CHECK-SAME: [[VAL_83:%.*]]: i32, [[VAL_84:%.*]]: i32) -> i32 { -func @bar_select_rank(%arg : i32, %arg2 : i32) -> i32 { +func.func @bar_select_rank(%arg : i32, %arg2 : i32) -> i32 { // CHECK: [[VAL_85:%.*]] = arith.constant 1 : i32 // CHECK: [[VAL_86:%.*]] = arith.constant 2 : i32 // CHECK: [[VAL_87:%.*]] = arith.constant 3 : i32 @@ -323,7 +323,7 @@ // CHECK-LABEL: func @bar_select_type( // CHECK-SAME: [[VAL_101:%.*]]: !fir.box}>>) -> i32 { -func @bar_select_type(%arg : !fir.box}>>) -> i32 { +func.func @bar_select_type(%arg : !fir.box}>>) -> i32 { // CHECK: [[VAL_102:%.*]] = arith.constant 1 : i32 // CHECK: [[VAL_103:%.*]] = arith.constant 2 : i32 @@ -369,7 +369,7 @@ // CHECK: [[VAL_114:%.*]] = arith.constant 2 : i32 // CHECK: [[VAL_115:%.*]] = arith.constant 3 : i32 // CHECK: [[VAL_116:%.*]] = arith.constant 4 : i32 -func @bar_select_case(%arg : i32, %arg2 : i32) -> i32 { +func.func @bar_select_case(%arg : i32, %arg2 : i32) -> i32 { %0 = arith.constant 1 : i32 %1 = arith.constant 2 : i32 %2 = arith.constant 3 : i32 @@ -459,7 +459,7 @@ // CHECK-LABEL: func @compare_complex( // CHECK-SAME: [[VAL_151:%.*]]: !fir.complex<16>, [[VAL_152:%.*]]: !fir.complex<16>) { -func @compare_complex(%a : !fir.complex<16>, %b : !fir.complex<16>) { +func.func @compare_complex(%a : !fir.complex<16>, %b : !fir.complex<16>) { // CHECK: [[VAL_153:%.*]] = fir.cmpc "false", [[VAL_151]], [[VAL_152]] : !fir.complex<16> // CHECK: [[VAL_154:%.*]] = fir.cmpc "oeq", [[VAL_151]], [[VAL_152]] : !fir.complex<16> @@ -503,7 +503,7 @@ // CHECK-LABEL: func @arith_real( // CHECK-SAME: [[VAL_169:%.*]]: f128, [[VAL_170:%.*]]: f128) -> f128 { -func @arith_real(%a : f128, %b : f128) -> f128 { +func.func @arith_real(%a : f128, %b : f128) -> f128 { // CHECK: [[VAL_171:%.*]] = arith.constant 1.0 // CHECK: [[VAL_172:%.*]] = fir.convert [[VAL_171]] : (f32) -> f128 @@ -526,7 +526,7 @@ // CHECK-LABEL: func @arith_complex( // CHECK-SAME: [[VAL_179:%.*]]: !fir.complex<16>, [[VAL_180:%.*]]: !fir.complex<16>) -> !fir.complex<16> { -func @arith_complex(%a : !fir.complex<16>, %b : !fir.complex<16>) -> !fir.complex<16> { +func.func @arith_complex(%a : !fir.complex<16>, %b : !fir.complex<16>) -> !fir.complex<16> { // CHECK: [[VAL_181:%.*]] = fir.negc [[VAL_179]] : !fir.complex<16> // CHECK: [[VAL_182:%.*]] = fir.addc [[VAL_180]], [[VAL_181]] : !fir.complex<16> // CHECK: [[VAL_183:%.*]] = fir.subc [[VAL_182]], [[VAL_180]] : !fir.complex<16> @@ -543,7 +543,7 @@ } // CHECK-LABEL: func @character_literal() -> !fir.char<1,13> { -func @character_literal() -> !fir.char<1,13> { +func.func @character_literal() -> !fir.char<1,13> { // CHECK: [[VAL_186:%.*]] = fir.string_lit "Hello, World!"(13) : !fir.char<1,13> %0 = fir.string_lit "Hello, World!"(13) : !fir.char<1,13> // CHECK: return [[VAL_186]] : !fir.char<1,13> @@ -552,22 +552,22 @@ } // CHECK-LABEL: func private @earlyexit2(i32) -> i1 -func private @earlyexit2(%a : i32) -> i1 +func.func private @earlyexit2(%a : i32) -> i1 // CHECK-LABEL: func @early_exit( // CHECK-SAME: [[VAL_187:%.*]]: i1, [[VAL_188:%.*]]: i32) -> i1 { -func @early_exit(%ok : i1, %k : i32) -> i1 { +func.func @early_exit(%ok : i1, %k : i32) -> i1 { // CHECK: [[VAL_189:%.*]] = arith.constant 1 : index // CHECK: [[VAL_190:%.*]] = arith.constant 100 : index %c1 = arith.constant 1 : index %c100 = arith.constant 100 : index // CHECK: %[[VAL_191:.*]]:2 = fir.iterate_while ([[VAL_192:%.*]] = [[VAL_189]] to [[VAL_190]] step [[VAL_189]]) and ([[VAL_193:%.*]] = [[VAL_187]]) iter_args([[VAL_194:%.*]] = [[VAL_188]]) -> (i32) { -// CHECK: [[VAL_195:%.*]] = call @earlyexit2([[VAL_194]]) : (i32) -> i1 +// CHECK: [[VAL_195:%.*]] = func.call @earlyexit2([[VAL_194]]) : (i32) -> i1 // CHECK: fir.result [[VAL_195]], [[VAL_194]] : i1, i32 // CHECK: } %newOk:2 = fir.iterate_while (%i = %c1 to %c100 step %c1) and (%ok_ = %ok) iter_args(%v = %k) -> (i32) { - %stop = call @earlyexit2(%v) : (i32) -> i1 + %stop = func.call @earlyexit2(%v) : (i32) -> i1 fir.result %stop, %v : i1, i32 } // CHECK: return %[[VAL_191]]#0 : i1 @@ -576,7 +576,7 @@ } // CHECK-LABEL: @array_access -func @array_access(%arr : !fir.ref>) { +func.func @array_access(%arr : !fir.ref>) { // CHECK-DAG: %[[c1:.*]] = arith.constant 100 // CHECK-DAG: %[[c2:.*]] = arith.constant 50 %c100 = arith.constant 100 : index @@ -607,13 +607,13 @@ } // CHECK-LABEL: @test_is_present -func @test_is_present(%arg0: !fir.box>) -> i1 { +func.func @test_is_present(%arg0: !fir.box>) -> i1 { // CHECK: fir.is_present %{{.*}} : (!fir.box>) -> i1 %0 = fir.is_present %arg0 : (!fir.box>) -> i1 return %0 : i1 } // CHECK-LABEL: @test_absent -func @test_absent() -> i1 { +func.func @test_absent() -> i1 { // CHECK: fir.absent !fir.box> %0 = fir.absent !fir.box> %1 = fir.call @_QPfoo(%0) : (!fir.box>) -> i1 @@ -622,7 +622,7 @@ // CHECK-LABEL: @test_misc_ops( // CHECK-SAME: [[ARR1:%.*]]: !fir.ref>, [[INDXM:%.*]]: index, [[INDXN:%.*]]: index, [[INDXO:%.*]]: index, [[INDXP:%.*]]: index) -func @test_misc_ops(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index) { +func.func @test_misc_ops(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index) { // CHECK: [[I10:%.*]] = arith.constant 10 : index // CHECK: [[J20:%.*]] = arith.constant 20 : index // CHECK: [[C2:%.*]] = arith.constant 2 : index @@ -666,7 +666,7 @@ } // CHECK-LABEL: @test_const_complex -func @test_const_complex() { +func.func @test_const_complex() { // CHECK-DAG: {{%.*}} = fir.constc(#fir.real<2, i x3000>, #fir.real<2, i x4C40>) : !fir.complex<2> // CHECK-DAG: {{%.*}} = fir.constc(#fir.real<3, i x3E80>, #fir.real<3, i x4202>) : !fir.complex<3> // CHECK-DAG: {{%.*}} = fir.constc(#fir.real<4, i x3E800000>, #fir.real<4, i x42028000>) : !fir.complex<4> @@ -684,14 +684,14 @@ // CHECK-LABEL: @insert_on_range_multi_dim // CHECK-SAME: %[[ARR:.*]]: !fir.array<10x20xi32>, %[[CST:.*]]: i32 -func @insert_on_range_multi_dim(%arr : !fir.array<10x20xi32>, %cst : i32) { +func.func @insert_on_range_multi_dim(%arr : !fir.array<10x20xi32>, %cst : i32) { // CHECK: fir.insert_on_range %[[ARR]], %[[CST]] from (2, 3) to (5, 6) : (!fir.array<10x20xi32>, i32) -> !fir.array<10x20xi32> %arr3 = fir.insert_on_range %arr, %cst from (2, 3) to (5, 6) : (!fir.array<10x20xi32>, i32) -> !fir.array<10x20xi32> return } // CHECK-LABEL: @test_shift -func @test_shift(%arg0: !fir.box>) -> !fir.ref { +func.func @test_shift(%arg0: !fir.box>) -> !fir.ref { %c4 = arith.constant 4 : index %c100 = arith.constant 100 : index // CHECK: fir.shift %{{.*}} : (index) -> !fir.shift<1> @@ -700,9 +700,9 @@ return %1 : !fir.ref } -func private @bar_rebox_test(!fir.box>) +func.func private @bar_rebox_test(!fir.box>) // CHECK-LABEL: @test_rebox( -func @test_rebox(%arg0: !fir.box>) { +func.func @test_rebox(%arg0: !fir.box>) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index @@ -721,9 +721,9 @@ return } -func private @bar_rebox_test_char(!fir.box>>) +func.func private @bar_rebox_test_char(!fir.box>>) // CHECK-LABEL: @test_rebox_char( -func @test_rebox_char(%arg0: !fir.box>>) { +func.func @test_rebox_char(%arg0: !fir.box>>) { %c7_i64 = arith.constant 7 : i64 %c1_i64 = arith.constant 1 : i64 %c0 = arith.constant 0 : index @@ -737,9 +737,9 @@ } -func private @array_func() -> !fir.array> +func.func private @array_func() -> !fir.array> // CHECK-LABEL: @test_save_result( -func @test_save_result(%buffer: !fir.ref>>) { +func.func @test_save_result(%buffer: !fir.ref>>) { %c100 = arith.constant 100 : index %c50 = arith.constant 50 : index %shape = fir.shape %c100 : (index) -> !fir.shape<1> @@ -749,7 +749,7 @@ return } -func @char_convert() { +func.func @char_convert() { %1 = fir.undefined i32 %2 = fir.undefined !fir.ref> %3 = fir.undefined !fir.ref>> @@ -758,7 +758,7 @@ return } -func @slice_substr() { +func.func @slice_substr() { %lb = arith.constant 0 : index %ub = arith.constant 42 : index %c1 = arith.constant 1 : index @@ -771,7 +771,7 @@ // Test load, store, coordinate_of with llvmptr type // CHECK-LABEL: llvm_ptr_load_store_coordinate // CHECK-SAME: (%[[ARG0:.*]]: !fir.ref>>, !fir.ref>>>>, %[[ARG1:.*]]: !fir.ref>>) -func @llvm_ptr_load_store_coordinate(%arg0: !fir.ref>>, !fir.ref>>>>, %arg1: !fir.ref>>) -> !fir.ref>> { +func.func @llvm_ptr_load_store_coordinate(%arg0: !fir.ref>>, !fir.ref>>>>, %arg1: !fir.ref>>) -> !fir.ref>> { // CHECK-NEXT: %[[C0:.*]] = arith.constant 0 : i32 %c0_i32 = arith.constant 0 : i32 // CHECK-NEXT: %[[LLVMPTR:.*]] = fir.coordinate_of %[[ARG0]], %[[C0]] : (!fir.ref>>, !fir.ref>>>>, i32) -> !fir.llvm_ptr>>> @@ -783,7 +783,7 @@ return %1 : !fir.ref>> } -func @array_access_ops(%a : !fir.ref>) { +func.func @array_access_ops(%a : !fir.ref>) { %c1 = arith.constant 1 : index %n = arith.constant 0 : index %m = arith.constant 50 : index @@ -794,7 +794,7 @@ return } -func @array_amend_ops(%a : !fir.ref>) { +func.func @array_amend_ops(%a : !fir.ref>) { %c1 = arith.constant 1 : index %n = arith.constant 0 : index %m = arith.constant 50 : index diff --git a/flang/test/Fir/fir-types.fir b/flang/test/Fir/fir-types.fir --- a/flang/test/Fir/fir-types.fir +++ b/flang/test/Fir/fir-types.fir @@ -10,13 +10,13 @@ // CHECK-LABEL: func private @it5() -> !fir.char<1> // CHECK-LABEL: func private @it6() -> !fir.char<2,10> // CHECK-LABEL: func private @it7() -> !fir.char<4,?> -func private @it1() -> !fir.int<4> -func private @it2() -> !fir.real<8> -func private @it3() -> !fir.complex<8> -func private @it4() -> !fir.logical<1> -func private @it5() -> !fir.char<1> -func private @it6() -> !fir.char<2,10> -func private @it7() -> !fir.char<4,?> +func.func private @it1() -> !fir.int<4> +func.func private @it2() -> !fir.real<8> +func.func private @it3() -> !fir.complex<8> +func.func private @it4() -> !fir.logical<1> +func.func private @it5() -> !fir.char<1> +func.func private @it6() -> !fir.char<2,10> +func.func private @it7() -> !fir.char<4,?> // Fortran Derived types (records) // CHECK-LABEL: func private @dvd1() -> !fir.type @@ -26,13 +26,13 @@ // CHECK-LABEL: func private @dvd5() -> !fir.type // CHECK-LABEL: func private @dvd6() -> !fir.type>}> // CHECK-LABEL: func private @dvd7() -> !fir.type -func private @dvd1() -> !fir.type -func private @dvd2() -> !fir.type -func private @dvd3() -> !fir.type -func private @dvd4() -> !fir.type -func private @dvd5() -> !fir.type -func private @dvd6() -> !fir.type>}> -func private @dvd7() -> !fir.type +func.func private @dvd1() -> !fir.type +func.func private @dvd2() -> !fir.type +func.func private @dvd3() -> !fir.type +func.func private @dvd4() -> !fir.type +func.func private @dvd5() -> !fir.type +func.func private @dvd6() -> !fir.type>}> +func.func private @dvd7() -> !fir.type // FIR array types // CHECK-LABEL: func private @arr1() -> !fir.array<10xf32> @@ -42,13 +42,13 @@ // CHECK-LABEL: func private @arr5() -> !fir.array // CHECK-LABEL: func private @arr6() -> !fir.array<*:f32> // CHECK-LABEL: func private @arr7() -> !fir.array<1x2x?x4x5x6x7x8x9xf32> -func private @arr1() -> !fir.array<10xf32> -func private @arr2() -> !fir.array<10x10xf32> -func private @arr3() -> !fir.array -func private @arr4() -> !fir.array<10x?xf32> -func private @arr5() -> !fir.array -func private @arr6() -> !fir.array<*:f32> -func private @arr7() -> !fir.array<1x2x?x4x5x6x7x8x9xf32> +func.func private @arr1() -> !fir.array<10xf32> +func.func private @arr2() -> !fir.array<10x10xf32> +func.func private @arr3() -> !fir.array +func.func private @arr4() -> !fir.array<10x?xf32> +func.func private @arr5() -> !fir.array +func.func private @arr6() -> !fir.array<*:f32> +func.func private @arr7() -> !fir.array<1x2x?x4x5x6x7x8x9xf32> // FIR pointer-like types // CHECK-LABEL: func private @mem1() -> !fir.ref @@ -57,12 +57,12 @@ // CHECK-LABEL: func private @mem4() -> !fir.ref<() -> ()> // CHECK-LABEL: func private @mem5() -> !fir.llvm_ptr> // CHECK-LABEL: func private @mem6() -> !fir.llvm_ptr -func private @mem1() -> !fir.ref -func private @mem2() -> !fir.ptr -func private @mem3() -> !fir.heap -func private @mem4() -> !fir.ref<() -> ()> -func private @mem5() -> !fir.llvm_ptr> -func private @mem6() -> !fir.llvm_ptr +func.func private @mem1() -> !fir.ref +func.func private @mem2() -> !fir.ptr +func.func private @mem3() -> !fir.heap +func.func private @mem4() -> !fir.ref<() -> ()> +func.func private @mem5() -> !fir.llvm_ptr> +func.func private @mem6() -> !fir.llvm_ptr // FIR box types (descriptors) // CHECK-LABEL: func private @box1() -> !fir.box> @@ -70,11 +70,11 @@ // CHECK-LABEL: func private @box3() -> !fir.boxproc<(i32, i32) -> i64> // CHECK-LABEL: func private @box4() -> !fir.box // CHECK-LABEL: func private @box5() -> !fir.box> -func private @box1() -> !fir.box> -func private @box2() -> !fir.boxchar<2> -func private @box3() -> !fir.boxproc<(i32, i32) -> i64> -func private @box4() -> !fir.box -func private @box5() -> !fir.box> +func.func private @box1() -> !fir.box> +func.func private @box2() -> !fir.boxchar<2> +func.func private @box3() -> !fir.boxproc<(i32, i32) -> i64> +func.func private @box4() -> !fir.box +func.func private @box5() -> !fir.box> // FIR misc. types // CHECK-LABEL: func private @oth1() -> !fir.shape<1> @@ -82,12 +82,12 @@ // CHECK-LABEL: func private @oth3() -> !fir.tdesc> // CHECK-LABEL: func private @oth4() -> !fir.shapeshift<15> // CHECK-LABEL: func private @oth5() -> !fir.slice<8> -func private @oth1() -> !fir.shape<1> -func private @oth2() -> !fir.field -func private @oth3() -> !fir.tdesc> -func private @oth4() -> !fir.shapeshift<15> -func private @oth5() -> !fir.slice<8> +func.func private @oth1() -> !fir.shape<1> +func.func private @oth2() -> !fir.field +func.func private @oth3() -> !fir.tdesc> +func.func private @oth4() -> !fir.shapeshift<15> +func.func private @oth5() -> !fir.slice<8> // FIR vector // CHECK-LABEL: func private @vecty(i1) -> !fir.vector<10:i32> -func private @vecty(i1) -> !fir.vector<10:i32> +func.func private @vecty(i1) -> !fir.vector<10:i32> diff --git a/flang/test/Fir/ignore-missing-type-descriptor.fir b/flang/test/Fir/ignore-missing-type-descriptor.fir --- a/flang/test/Fir/ignore-missing-type-descriptor.fir +++ b/flang/test/Fir/ignore-missing-type-descriptor.fir @@ -6,9 +6,9 @@ !some_freestyle_type = type !fir.type -func private @bar(!fir.box) +func.func private @bar(!fir.box) -func @test_embox(%addr: !fir.ref) { +func.func @test_embox(%addr: !fir.ref) { %0 = fir.embox %addr : (!fir.ref) -> !fir.box fir.call @bar(%0) : (!fir.box) -> () return diff --git a/flang/test/Fir/inline.fir b/flang/test/Fir/inline.fir --- a/flang/test/Fir/inline.fir +++ b/flang/test/Fir/inline.fir @@ -1,7 +1,7 @@ // RUN: tco --target=x86_64-unknown-linux-gnu --inline-all %s -o - | FileCheck %s // CHECK-LABEL: @add -func @add(%a : i32, %b : i32) -> i32 { +func.func @add(%a : i32, %b : i32) -> i32 { // CHECK: %[[add:.*]] = add i32 %p = arith.addi %a, %b : i32 // CHECK: ret i32 %[[add]] @@ -9,7 +9,7 @@ } // CHECK-LABEL: @test -func @test(%a : i32, %b : i32, %c : i32) -> i32 { +func.func @test(%a : i32, %b : i32, %c : i32) -> i32 { // CHECK: %[[add:.*]] = add i32 %m = fir.call @add(%a, %b) : (i32, i32) -> i32 // CHECK: %[[mul:.*]] = mul i32 %[[add]], diff --git a/flang/test/Fir/invalid-types.fir b/flang/test/Fir/invalid-types.fir --- a/flang/test/Fir/invalid-types.fir +++ b/flang/test/Fir/invalid-types.fir @@ -2,168 +2,168 @@ // RUN: fir-opt -split-input-file -verify-diagnostics %s // expected-error@+1 {{expected non-function type}} -func private @box3() -> !fir.boxproc<> +func.func private @box3() -> !fir.boxproc<> // ----- // expected-error@+2 {{expected attribute value}} // expected-error@+1 {{expected affine map}} -func private @box1() -> !fir.box, > +func.func private @box1() -> !fir.box, > // ----- // expected-error@+1 {{expected non-function type}} -func private @box1() -> !fir.box<> +func.func private @box1() -> !fir.box<> // ----- // expected-error@+1 {{expected integer value}} -func private @box2() -> !fir.boxchar<> +func.func private @box2() -> !fir.boxchar<> // ----- // expected-error@+1 {{expected integer value}} -func private @it6() -> !fir.char<> +func.func private @it6() -> !fir.char<> // ----- // expected-error@+1 {{expected integer value}} -func private @it6() -> !fir.char<2, > +func.func private @it6() -> !fir.char<2, > // ----- // expected-error@+1 {{expected integer value}} -func private @it3() -> !fir.complex<> +func.func private @it3() -> !fir.complex<> // ----- // expected-error@+1 {{expected non-function type}} -func private @mem3() -> !fir.heap<> +func.func private @mem3() -> !fir.heap<> // ----- // expected-error@+1 {{expected integer value}} -func private @it1() -> !fir.int +func.func private @it1() -> !fir.int // ----- // expected-error@+1 {{expected integer value}} -func private @it1() -> !fir.logical +func.func private @it1() -> !fir.logical // ----- // expected-error@+1 {{expected non-function type}} -func private @mem3() -> !fir.ptr<> +func.func private @mem3() -> !fir.ptr<> // ----- // expected-error@+1 {{expected integer value}} -func private @mem3() -> !fir.real<> +func.func private @mem3() -> !fir.real<> // ----- // expected-error@+1 {{expected valid keyword}} -func private @mem3() -> !fir.type<> +func.func private @mem3() -> !fir.type<> // ----- // expected-error@+2 {{expected valid keyword}} // expected-error@+1 {{expected LEN parameter list}} -func private @dvd4() -> !fir.type +func.func private @dvd4() -> !fir.type // ----- // expected-error@+2 {{expected ':'}} // expected-error@+1 {{expected LEN parameter list}} -func private @dvd4() -> !fir.type +func.func private @dvd4() -> !fir.type // ----- // expected-error@+2 {{expected non-function type}} // expected-error@+1 {{expected LEN parameter list}} -func private @dvd4() -> !fir.type +func.func private @dvd4() -> !fir.type // ----- // expected-error@+2 {{expected valid keyword}} // expected-error@+1 {{expected field type list}} -func private @dvd4() -> !fir.type +func.func private @dvd4() -> !fir.type // ----- // expected-error@+2 {{expected ':'}} // expected-error@+1 {{expected field type list}} -func private @dvd4() -> !fir.type +func.func private @dvd4() -> !fir.type // ----- // expected-error@+2 {{expected non-function type}} // expected-error@+1 {{expected field type list}} -func private @dvd4() -> !fir.type +func.func private @dvd4() -> !fir.type // ----- // expected-error@+2 {{expected valid keyword}} // expected-error@+1 {{expected field type list}} -func private @dvd4() -> !fir.type +func.func private @dvd4() -> !fir.type // ----- // expected-error@+2 {{expected valid keyword}} // expected-error@+1 {{expected field type list}} -func private @dvd4() -> !fir.type +func.func private @dvd4() -> !fir.type // ----- // expected-error@+1 {{expected non-function type}} -func private @mem3() -> !fir.ref<> +func.func private @mem3() -> !fir.ref<> // ----- // expected-error@+1 {{expected ':'}} -func private @arr1() -> !fir.array<*> +func.func private @arr1() -> !fir.array<*> // ----- // expected-error@+1 {{expected non-function type}} -func private @arr1() -> !fir.array<*:> +func.func private @arr1() -> !fir.array<*:> // ----- // expected-error@+1 {{expected integer value}} -func private @oth1() -> !fir.shape<> +func.func private @oth1() -> !fir.shape<> // ----- // expected-error@+1 {{expected integer value}} -func private @oth1() -> !fir.shapeshift<> +func.func private @oth1() -> !fir.shapeshift<> // ----- // expected-error@+1 {{expected integer value}} -func private @oth1() -> !fir.shift<> +func.func private @oth1() -> !fir.shift<> // ----- // expected-error@+1 {{expected integer value}} -func private @oth1() -> !fir.slice<> +func.func private @oth1() -> !fir.slice<> // ----- // expected-error@+1 {{expected non-function type}} -func private @oth3() -> !fir.tdesc +func.func private @oth3() -> !fir.tdesc // ----- // expected-error@+1 {{expected integer value}} -func private @oth3() -> !fir.vector<> +func.func private @oth3() -> !fir.vector<> // ----- // expected-error@+1 {{expected ':'}} -func private @oth3() -> !fir.vector<10> +func.func private @oth3() -> !fir.vector<10> // ----- // expected-error@+1 {{expected non-function type}} -func private @oth3() -> !fir.vector<10:> +func.func private @oth3() -> !fir.vector<10:> diff --git a/flang/test/Fir/invalid.fir b/flang/test/Fir/invalid.fir --- a/flang/test/Fir/invalid.fir +++ b/flang/test/Fir/invalid.fir @@ -17,7 +17,7 @@ // ----- -func @bad_rebox_1(%arg0: !fir.ref>) { +func.func @bad_rebox_1(%arg0: !fir.ref>) { %c10 = arith.constant 10 : index %0 = fir.shape %c10 : (index) -> !fir.shape<1> // expected-error@+1{{op operand #0 must be The type of a Fortran descriptor, but got '!fir.ref>'}} @@ -27,7 +27,7 @@ // ----- -func @bad_rebox_2(%arg0: !fir.box>) { +func.func @bad_rebox_2(%arg0: !fir.box>) { %c10 = arith.constant 10 : index %0 = fir.shape %c10 : (index) -> !fir.shape<1> // expected-error@+1{{op result #0 must be The type of a Fortran descriptor, but got '!fir.ref>'}} @@ -37,7 +37,7 @@ // ----- -func @bad_rebox_3(%arg0: !fir.box>) { +func.func @bad_rebox_3(%arg0: !fir.box>) { %c10 = arith.constant 10 : index %0 = fir.shape %c10 : (index) -> !fir.shape<1> // expected-error@+1{{op box operand must not have unknown rank or type}} @@ -47,7 +47,7 @@ // ----- -func @bad_rebox_4(%arg0: !fir.box>) { +func.func @bad_rebox_4(%arg0: !fir.box>) { // expected-error@+1{{op result type must not have unknown rank or type}} %0 = fir.rebox %arg0 : (!fir.box>) -> !fir.box> return @@ -55,7 +55,7 @@ // ----- -func @bad_rebox_5(%arg0: !fir.box>) { +func.func @bad_rebox_5(%arg0: !fir.box>) { %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %0 = fir.slice %c1, %c10, %c1 : (index, index, index) -> !fir.slice<1> @@ -66,7 +66,7 @@ // ----- -func @bad_rebox_6(%arg0: !fir.box>) { +func.func @bad_rebox_6(%arg0: !fir.box>) { %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %0 = fir.slice %c1, %c10, %c1 : (index, index, index) -> !fir.slice<1> @@ -78,7 +78,7 @@ // ----- -func @bad_rebox_7(%arg0: !fir.box>) { +func.func @bad_rebox_7(%arg0: !fir.box>) { %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %0 = fir.slice %c1, %c10, %c1 : (index, index, index) -> !fir.slice<1> @@ -90,7 +90,7 @@ // ----- -func @bad_rebox_8(%arg0: !fir.box>) { +func.func @bad_rebox_8(%arg0: !fir.box>) { %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %undef = fir.undefined index @@ -102,7 +102,7 @@ // ----- -func @bad_rebox_9(%arg0: !fir.box>) { +func.func @bad_rebox_9(%arg0: !fir.box>) { %c10 = arith.constant 10 : index %0 = fir.shift %c10, %c10 : (index, index) -> !fir.shift<2> // expected-error@+1{{shape operand and input box ranks must match when the shape is a fir.shift}} @@ -112,7 +112,7 @@ // ----- -func @bad_rebox_10(%arg0: !fir.box>) { +func.func @bad_rebox_10(%arg0: !fir.box>) { %c10 = arith.constant 10 : index %0 = fir.shape %c10, %c10 : (index, index) -> !fir.shape<2> // expected-error@+1{{result type and shape operand ranks must match}} @@ -122,7 +122,7 @@ // ----- -func @bad_rebox_11(%arg0: !fir.box>) { +func.func @bad_rebox_11(%arg0: !fir.box>) { %c42 = arith.constant 42 : index %0 = fir.shape %c42 : (index) -> !fir.shape<1> // expected-error@+1{{op input and output element types must match for intrinsic types}} @@ -132,7 +132,7 @@ // ----- -func @test_rebox_char(%arg0: !fir.box>>) { +func.func @test_rebox_char(%arg0: !fir.box>>) { %c10 = arith.constant 10 : index %1 = fir.shape %c10, %c10 : (index, index) -> !fir.shape<2> // expected-error@+1{{op input and output element types must match for intrinsic types}} @@ -142,7 +142,7 @@ // ----- -func @array_access(%arr : !fir.ref>) { +func.func @array_access(%arr : !fir.ref>) { %c1 = arith.constant 1 : index %c100 = arith.constant 100 : index %c50 = arith.constant 50 : index @@ -154,7 +154,7 @@ // ----- -func @array_access(%arr : !fir.ref) { +func.func @array_access(%arr : !fir.ref) { %c1 = arith.constant 1 : index %c100 = arith.constant 100 : index %c50 = arith.constant 50 : index @@ -166,7 +166,7 @@ // ----- -func @array_access(%arr : !fir.ref>) { +func.func @array_access(%arr : !fir.ref>) { %c1 = arith.constant 1 : index %c100 = arith.constant 100 : index %c50 = arith.constant 50 : index @@ -182,7 +182,7 @@ // ----- -func @array_access(%arr : !fir.ref>) { +func.func @array_access(%arr : !fir.ref>) { %c1 = arith.constant 1 : index %c100 = arith.constant 100 : index %shape = fir.shape %c100 : (index) -> !fir.shape<1> @@ -193,7 +193,7 @@ // ----- -func @array_access(%arr : !fir.ref>) { +func.func @array_access(%arr : !fir.ref>) { %c1 = arith.constant 1 : index %c100 = arith.constant 100 : index %shift = fir.shift %c1 : (index) -> !fir.shift<1> @@ -204,7 +204,7 @@ // ----- -func @array_access(%arr : !fir.ref>) { +func.func @array_access(%arr : !fir.ref>) { %c1 = arith.constant 1 : index %c100 = arith.constant 100 : index %c50 = arith.constant 50 : index @@ -216,7 +216,7 @@ // ----- -func @test_misc_ops(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index) { +func.func @test_misc_ops(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index) { %c2 = arith.constant 2 : index %s = fir.shape_shift %m, %n, %o, %p : (index, index, index, index) -> !fir.shapeshift<2> // expected-error@+1 {{'fir.array_load' op operand #0 must be any reference or box, but got 'index'}} @@ -226,7 +226,7 @@ // ----- -func @test_misc_ops(%arr1 : !fir.ref, %m : index, %n : index, %o : index, %p : index) { +func.func @test_misc_ops(%arr1 : !fir.ref, %m : index, %n : index, %o : index, %p : index) { %s = fir.shape_shift %m, %n, %o, %p : (index, index, index, index) -> !fir.shapeshift<2> // expected-error@+1 {{'fir.array_load' op must be a reference to an array}} %av1 = fir.array_load %arr1(%s) : (!fir.ref, !fir.shapeshift<2>) -> !fir.array @@ -235,7 +235,7 @@ // ----- -func @test_misc_ops(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index) { +func.func @test_misc_ops(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index) { %s = fir.shape_shift %m, %n: (index, index) -> !fir.shapeshift<1> // expected-error@+1 {{'fir.array_load' op rank of dimension mismatched}} %av1 = fir.array_load %arr1(%s) : (!fir.ref>, !fir.shapeshift<1>) -> !fir.array @@ -244,7 +244,7 @@ // ----- -func @test_misc_ops(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index) { +func.func @test_misc_ops(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index) { %c2 = arith.constant 2 : index %shift = fir.shift %c2 : (index) -> !fir.shift<1> // expected-error@+1 {{'fir.array_load' op shift can only be provided with fir.box memref}} @@ -254,7 +254,7 @@ // ----- -func @test_misc_ops(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index) { +func.func @test_misc_ops(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index) { %c47 = arith.constant 47 : index %c78 = arith.constant 78 : index %c3 = arith.constant 3 : index @@ -267,7 +267,7 @@ // ----- -func @test_coordinate_of(%arr : !fir.ref>) { +func.func @test_coordinate_of(%arr : !fir.ref>) { %1 = arith.constant 10 : i32 // expected-error@+1 {{'fir.coordinate_of' op cannot find coordinate with unknown extents}} %2 = fir.coordinate_of %arr, %1 : (!fir.ref>, i32) -> !fir.ref @@ -276,7 +276,7 @@ // ----- -func @test_coordinate_of(%arr : !fir.ref>) { +func.func @test_coordinate_of(%arr : !fir.ref>) { %1 = arith.constant 10 : i32 // expected-error@+1 {{'fir.coordinate_of' op cannot find coordinate in unknown shape}} %2 = fir.coordinate_of %arr, %1 : (!fir.ref>, i32) -> !fir.ref @@ -285,7 +285,7 @@ // ----- -func @test_coordinate_of(%arr : !fir.ref>) { +func.func @test_coordinate_of(%arr : !fir.ref>) { %1 = arith.constant 10 : i32 // expected-error@+1 {{'fir.coordinate_of' op cannot apply coordinate_of to this type}} %2 = fir.coordinate_of %arr, %1 : (!fir.ref>, i32) -> !fir.ref @@ -294,7 +294,7 @@ // ----- -func @test_coordinate_of(%arr : !fir.ref>) { +func.func @test_coordinate_of(%arr : !fir.ref>) { %1 = arith.constant 10 : i32 // expected-error@+1 {{'fir.coordinate_of' op cannot apply coordinate_of to this type}} %2 = fir.coordinate_of %arr, %1 : (!fir.ref>, i32) -> !fir.ref @@ -309,7 +309,7 @@ // ----- -func @fun(%0 : !fir.ref) { +func.func @fun(%0 : !fir.ref) { %c_100 = arith.constant 100 : index %1 = fir.shape %c_100 : (index) -> !fir.shape<1> // expected-error@+1 {{'fir.embox' op shape must not be provided for a scalar}} @@ -318,7 +318,7 @@ // ----- -func @fun(%0 : !fir.ref) { +func.func @fun(%0 : !fir.ref) { %c_100 = arith.constant 100 : index %1 = fir.slice %c_100, %c_100, %c_100 : (index, index, index) -> !fir.slice<1> // expected-error@+1 {{'fir.embox' op operand #1 must be any legal shape type, but got '!fir.slice<1>'}} @@ -327,7 +327,7 @@ // ----- -func @fun(%0 : !fir.ref) { +func.func @fun(%0 : !fir.ref) { %c_100 = arith.constant 100 : index %1 = fir.shape %c_100 : (index) -> !fir.shape<1> // expected-error@+1 {{'fir.embox' op operand #1 must be FIR slice, but got '!fir.shape<1>'}} @@ -336,7 +336,7 @@ // ----- -func @fun(%0 : !fir.ref) { +func.func @fun(%0 : !fir.ref) { %c_100 = arith.constant 100 : index %1 = fir.slice %c_100, %c_100, %c_100 : (index, index, index) -> !fir.slice<1> // expected-error@+1 {{'fir.embox' op slice must not be provided for a scalar}} @@ -399,7 +399,7 @@ // ----- -func @ugly_char_convert() { +func.func @ugly_char_convert() { %1 = fir.undefined i32 %2 = fir.undefined !fir.ref> %3 = fir.undefined !fir.ref>> @@ -410,7 +410,7 @@ // ----- -func @ugly_char_convert() { +func.func @ugly_char_convert() { %1 = fir.undefined i32 %2 = fir.undefined !fir.ref> %3 = fir.undefined !fir.ref> @@ -421,7 +421,7 @@ // ----- -func @ugly_char_convert() { +func.func @ugly_char_convert() { %1 = fir.undefined i32 %2 = fir.undefined !fir.ref> %3 = fir.undefined !fir.ref>> @@ -432,7 +432,7 @@ // ----- -func @ugly_char_convert() { +func.func @ugly_char_convert() { %1 = fir.undefined i32 %2 = fir.undefined !fir.ref> %3 = fir.undefined !fir.ref>> @@ -503,7 +503,7 @@ // ----- -func @bad_save_result(%buffer : !fir.ref>, %n :index) { +func.func @bad_save_result(%buffer : !fir.ref>, %n :index) { %res = fir.call @array_func() : () -> !fir.array %shape = fir.shape %n : (index) -> !fir.shape<1> // expected-error@+1 {{'fir.save_result' op value type must match memory reference type}} @@ -513,7 +513,7 @@ // ----- -func @bad_save_result(%buffer : !fir.ref>>) { +func.func @bad_save_result(%buffer : !fir.ref>>) { %res = fir.call @array_func() : () -> !fir.box> // expected-error@+1 {{'fir.save_result' op cannot save !fir.box of unknown rank or type}} fir.save_result %res to %buffer : !fir.box>, !fir.ref>> @@ -522,7 +522,7 @@ // ----- -func @bad_save_result(%buffer : !fir.ref) { +func.func @bad_save_result(%buffer : !fir.ref) { %res = fir.call @array_func() : () -> f64 // expected-error@+1 {{'fir.save_result' op operand #0 must be fir.box, fir.array or fir.type, but got 'f64'}} fir.save_result %res to %buffer : f64, !fir.ref @@ -531,7 +531,7 @@ // ----- -func @bad_save_result(%buffer : !fir.ref>>, %n : index) { +func.func @bad_save_result(%buffer : !fir.ref>>, %n : index) { %res = fir.call @array_func() : () -> !fir.box> %shape = fir.shape %n : (index) -> !fir.shape<1> // expected-error@+1 {{'fir.save_result' op must not have shape or length operands if the value is a fir.box}} @@ -541,7 +541,7 @@ // ----- -func @bad_save_result(%buffer : !fir.ref>, %n :index) { +func.func @bad_save_result(%buffer : !fir.ref>, %n :index) { %res = fir.call @array_func() : () -> !fir.array %shape = fir.shape %n, %n : (index, index) -> !fir.shape<2> // expected-error@+1 {{'fir.save_result' op shape operand must be provided and have the value rank when the value is a fir.array}} @@ -551,7 +551,7 @@ // ----- -func @bad_save_result(%buffer : !fir.ref>, %n :index) { +func.func @bad_save_result(%buffer : !fir.ref>, %n :index) { %res = fir.call @array_func() : () -> !fir.type %shape = fir.shape %n : (index) -> !fir.shape<1> // expected-error@+1 {{'fir.save_result' op shape operand should only be provided if the value is a fir.array}} @@ -561,7 +561,7 @@ // ----- -func @bad_save_result(%buffer : !fir.ref>, %n :index) { +func.func @bad_save_result(%buffer : !fir.ref>, %n :index) { %res = fir.call @array_func() : () -> !fir.type // expected-error@+1 {{'fir.save_result' op length parameters number must match with the value type length parameters}} fir.save_result %res to %buffer typeparams %n : !fir.type, !fir.ref>, index @@ -570,7 +570,7 @@ // ----- -func @bad_save_result(%buffer : !fir.ref>, %n :index) { +func.func @bad_save_result(%buffer : !fir.ref>, %n :index) { %res = fir.call @array_func() : () -> !fir.array %shape = fir.shape %n : (index) -> !fir.shape<1> // expected-error@+1 {{'fir.save_result' op length parameters must not be provided for this value type}} @@ -580,7 +580,7 @@ // ----- -func @test_misc_ops(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index) { +func.func @test_misc_ops(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index) { %s = fir.shape_shift %m, %n, %o, %p : (index, index, index, index) -> !fir.shapeshift<2> %av1 = fir.array_load %arr1(%s) : (!fir.ref>, !fir.shapeshift<2>) -> !fir.array // expected-error@+1 {{'fir.array_fetch' op number of indices != dimension of array}} @@ -590,7 +590,7 @@ // ----- -func @test_misc_ops(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index) { +func.func @test_misc_ops(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index) { %s = fir.shape_shift %m, %n, %o, %p : (index, index, index, index) -> !fir.shapeshift<2> %av1 = fir.array_load %arr1(%s) : (!fir.ref>, !fir.shapeshift<2>) -> !fir.array // expected-error@+1 {{'fir.array_fetch' op return type does not match array}} @@ -600,7 +600,7 @@ // ----- -func @test_misc_ops(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index) { +func.func @test_misc_ops(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index) { %s = fir.shape_shift %m, %n, %o, %p : (index, index, index, index) -> !fir.shapeshift<2> %av1 = fir.array_load %arr1(%s) : (!fir.ref>, !fir.shapeshift<2>) -> !fir.array %f = fir.array_fetch %av1, %m, %n : (!fir.array, index, index) -> f32 @@ -611,7 +611,7 @@ // ----- -func @test_misc_ops(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index) { +func.func @test_misc_ops(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index) { %s = fir.shape_shift %m, %n, %o, %p : (index, index, index, index) -> !fir.shapeshift<2> %av1 = fir.array_load %arr1(%s) : (!fir.ref>, !fir.shapeshift<2>) -> !fir.array %c0 = arith.constant 0 : i32 @@ -622,7 +622,7 @@ // ----- -func @test_misc_ops(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index, %f: !fir.ref) { +func.func @test_misc_ops(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index, %f: !fir.ref) { %s = fir.shape_shift %m, %n, %o, %p : (index, index, index, index) -> !fir.shapeshift<2> %av1 = fir.array_load %arr1(%s) : (!fir.ref>, !fir.shapeshift<2>) -> !fir.array // expected-error@+1 {{'fir.array_update' op does not support reference type for merge}} @@ -632,7 +632,7 @@ // ----- -func @test_misc_ops(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index) { +func.func @test_misc_ops(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index) { %s = fir.shape_shift %m, %n, %o, %p : (index, index, index, index) -> !fir.shapeshift<2> %av1 = fir.array_load %arr1(%s) : (!fir.ref>, !fir.shapeshift<2>) -> !fir.array %f = fir.array_fetch %av1, %m, %n : (!fir.array, index, index) -> f32 @@ -644,7 +644,7 @@ // ----- -func @bad_array_modify(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index, %f : f32) { +func.func @bad_array_modify(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index, %f : f32) { %i10 = arith.constant 10 : index %j20 = arith.constant 20 : index %s = fir.shape_shift %m, %n, %o, %p : (index, index, index, index) -> !fir.shapeshift<2> @@ -658,7 +658,7 @@ // ----- -func @slice_must_be_integral() { +func.func @slice_must_be_integral() { %0 = arith.constant 42 : i32 %1 = fir.field_index field, !fir.type (%0 : i32) // expected-error@+1 {{'fir.slice' op operand #0 must be any integer, but got '!fir.field'}} @@ -668,7 +668,7 @@ // ----- -func @array_coor_no_slice_substr(%a : !fir.ref>) { +func.func @array_coor_no_slice_substr(%a : !fir.ref>) { %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %slice = fir.slice %c1, %c10, %c1 substr %c1, %c10 : (index, index, index, index, index) -> !fir.slice<1> @@ -679,7 +679,7 @@ // ----- -func @array_coor_no_slice_substr(%a : !fir.ref>) { +func.func @array_coor_no_slice_substr(%a : !fir.ref>) { %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %slice = fir.slice %c1, %c10, %c1 substr %c1, %c10 : (index, index, index, index, index) -> !fir.slice<1> @@ -690,7 +690,7 @@ // ----- -func @array_merge_store_no_slice_substr(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index, %f : f32) { +func.func @array_merge_store_no_slice_substr(%arr1 : !fir.ref>, %m : index, %n : index, %o : index, %p : index, %f : f32) { %i10 = arith.constant 10 : index %j20 = arith.constant 20 : index %c1 = arith.constant 1 : index @@ -707,7 +707,7 @@ // ----- -func @array_access(%a : !fir.ref>) { +func.func @array_access(%a : !fir.ref>) { %c1 = arith.constant 1 : index %n = arith.constant 0 : index %m = arith.constant 50 : index @@ -720,7 +720,7 @@ // ----- -func @array_access(%a : !fir.ref>) { +func.func @array_access(%a : !fir.ref>) { %c1 = arith.constant 1 : index %n = arith.constant 0 : index %m = arith.constant 50 : index @@ -733,7 +733,7 @@ // ----- -func @foo(%arg0: !fir.ref}>>>) { +func.func @foo(%arg0: !fir.ref}>>>) { %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %c9 = arith.constant 9 : index @@ -755,4 +755,4 @@ fir.array_merge_store %1, %2 to %arg0 : !fir.array<30x!fir.type}>>, !fir.array<30x!fir.type}>>, !fir.ref}>>> return } -func private @ifoo(!fir.ref) -> i32 +func.func private @ifoo(!fir.ref) -> i32 diff --git a/flang/test/Fir/loop01.fir b/flang/test/Fir/loop01.fir --- a/flang/test/Fir/loop01.fir +++ b/flang/test/Fir/loop01.fir @@ -1,6 +1,6 @@ // RUN: fir-opt --split-input-file --cfg-conversion %s | FileCheck %s -func @x(%lb : index, %ub : index, %step : index, %b : i1, %addr : !fir.ref) { +func.func @x(%lb : index, %ub : index, %step : index, %b : i1, %addr : !fir.ref) { fir.do_loop %iv = %lb to %ub step %step unordered { // expect following conditional blocks to get fused fir.if %b { @@ -13,7 +13,7 @@ return } -func private @f2() -> i1 +func.func private @f2() -> i1 // CHECK: func @x(%[[VAL_0:.*]]: index, %[[VAL_1:.*]]: index, %[[VAL_2:.*]]: index, %[[VAL_3:.*]]: i1, %[[VAL_4:.*]]: !fir.ref) { // CHECK: %[[VAL_5:.*]] = arith.subi %[[VAL_1]], %[[VAL_0]] : index @@ -45,7 +45,7 @@ // ----- -func @x2(%lo : index, %up : index, %ok : i1) { +func.func @x2(%lo : index, %up : index, %ok : i1) { %c1 = arith.constant 1 : index %unused = fir.iterate_while (%i = %lo to %up step %c1) and (%ok1 = %ok) { %ok2 = fir.call @f2() : () -> i1 @@ -54,7 +54,7 @@ return } -func private @f3(i16) +func.func private @f3(i16) // CHECK: func @x2(%[[VAL_0:.*]]: index, %[[VAL_1:.*]]: index, %[[VAL_2:.*]]: i1) { // CHECK: %[[VAL_3:.*]] = arith.constant 1 : index @@ -82,7 +82,7 @@ // ----- // do_loop with an extra loop-carried value -func @x3(%lo : index, %up : index) -> i1 { +func.func @x3(%lo : index, %up : index) -> i1 { %c1 = arith.constant 1 : index %ok1 = arith.constant true %ok2 = fir.do_loop %i = %lo to %up step %c1 iter_args(%j = %ok1) -> i1 { @@ -118,7 +118,7 @@ // ----- // iterate_while with an extra loop-carried value -func @y3(%lo : index, %up : index) -> i1 { +func.func @y3(%lo : index, %up : index) -> i1 { %c1 = arith.constant 1 : index %ok1 = arith.constant true %ok4 = fir.call @f2() : () -> i1 @@ -130,7 +130,7 @@ return %andok : i1 } -func private @f4(i32) -> i1 +func.func private @f4(i32) -> i1 // CHECK-LABEL: func @y3( // CHECK-SAME: %[[VAL_0:.*]]: index, @@ -163,7 +163,7 @@ // ----- // do_loop that returns the final value of the induction -func @x4(%lo : index, %up : index) -> index { +func.func @x4(%lo : index, %up : index) -> index { %c1 = arith.constant 1 : index %v = fir.do_loop %i = %lo to %up step %c1 -> index { %i1 = fir.convert %i : (index) -> i32 @@ -199,7 +199,7 @@ // ----- // iterate_while that returns the final value of both inductions -func @y4(%lo : index, %up : index) -> index { +func.func @y4(%lo : index, %up : index) -> index { %c1 = arith.constant 1 : index %ok1 = arith.constant true %v:2 = fir.iterate_while (%i = %lo to %up step %c1) and (%ok2 = %ok1) -> (index, i1) { @@ -240,7 +240,7 @@ // do_loop that returns the final induction value // and an extra loop-carried value -func @x5(%lo : index, %up : index) -> index { +func.func @x5(%lo : index, %up : index) -> index { %c1 = arith.constant 1 : index %s1 = arith.constant 42 : i16 %v:2 = fir.do_loop %i = %lo to %up step %c1 iter_args(%s = %s1) -> (index, i16) { @@ -281,7 +281,7 @@ // iterate_while that returns the both induction values // and an extra loop-carried value -func @y5(%lo : index, %up : index) -> index { +func.func @y5(%lo : index, %up : index) -> index { %c1 = arith.constant 1 : index %s1 = arith.constant 42 : i16 %ok1 = arith.constant true diff --git a/flang/test/Fir/loop02.fir b/flang/test/Fir/loop02.fir --- a/flang/test/Fir/loop02.fir +++ b/flang/test/Fir/loop02.fir @@ -1,7 +1,7 @@ // RUN: fir-opt --cfg-conversion="always-execute-loop-body=true" %s | FileCheck %s // RUN: fir-opt --cfg-conversion %s | FileCheck %s --check-prefix=NOOPT -func @x(%addr : !fir.ref) { +func.func @x(%addr : !fir.ref) { %bound = arith.constant 452 : index %step = arith.constant 1 : index fir.do_loop %iv = %bound to %bound step %step { @@ -10,7 +10,7 @@ return } -func private @y(%addr : !fir.ref) +func.func private @y(%addr : !fir.ref) // CHECK-LABEL: func @x( diff --git a/flang/test/Fir/memory-allocation-opt.fir b/flang/test/Fir/memory-allocation-opt.fir --- a/flang/test/Fir/memory-allocation-opt.fir +++ b/flang/test/Fir/memory-allocation-opt.fir @@ -8,7 +8,7 @@ // CHECK: fir.freemem %[[mem]] // CHECK-NEXT: return -func @_QPs1() { +func.func @_QPs1() { %0 = fir.alloca !fir.array<1000123xi32> {bindc_name = "array", uniq_name = "_QFs1Earray"} fir.call @_QPs3(%0) : (!fir.ref>) -> () return @@ -22,7 +22,7 @@ // CHECK: fir.freemem %[[mem]] // CHECK-NEXT: return -func @_QPs2(%arg0: !fir.ref) { +func.func @_QPs2(%arg0: !fir.ref) { %0 = fir.load %arg0 : !fir.ref %1 = fir.convert %0 : (i32) -> index %2 = fir.alloca !fir.array, %1 {bindc_name = "array", uniq_name = "_QFs2Earray"} @@ -30,5 +30,5 @@ fir.call @_QPs3(%3) : (!fir.ref>) -> () return } -func private @_QPs3(!fir.ref>) +func.func private @_QPs3(!fir.ref>) diff --git a/flang/test/Fir/memref-data-flow.fir b/flang/test/Fir/memref-data-flow.fir --- a/flang/test/Fir/memref-data-flow.fir +++ b/flang/test/Fir/memref-data-flow.fir @@ -2,7 +2,7 @@ // Test that all load-store chains are removed -func @load_store_chain_removal(%arg0: !fir.ref>, %arg1: !fir.ref>, %arg2: !fir.ref>) { +func.func @load_store_chain_removal(%arg0: !fir.ref>, %arg1: !fir.ref>, %arg2: !fir.ref>) { %c1_i64 = arith.constant 1 : i64 %c60 = arith.constant 60 : index %c0 = arith.constant 0 : index diff --git a/flang/test/Fir/optional.fir b/flang/test/Fir/optional.fir --- a/flang/test/Fir/optional.fir +++ b/flang/test/Fir/optional.fir @@ -3,7 +3,7 @@ // Test fir.is_present and fir.absent codegen // CHECK-LABEL: @foo1 -func @foo1(%arg0: !fir.box>) -> i1 { +func.func @foo1(%arg0: !fir.box>) -> i1 { // CHECK: %[[ptr:.*]] = ptrtoint { float*, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }* %{{.*}} to i64 // CHECK: icmp ne i64 %[[ptr]], 0 %0 = fir.is_present %arg0 : (!fir.box>) -> i1 @@ -11,7 +11,7 @@ } // CHECK-LABEL: @bar1 -func @bar1() -> i1 { +func.func @bar1() -> i1 { %0 = fir.absent !fir.box> // CHECK: call i1 @foo1({ float*, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }* null) %1 = fir.call @foo1(%0) : (!fir.box>) -> i1 @@ -19,7 +19,7 @@ } // CHECK-LABEL: @foo2 -func @foo2(%arg0: !fir.ref) -> i1 { +func.func @foo2(%arg0: !fir.ref) -> i1 { // CHECK: %[[ptr:.*]] = ptrtoint i64* %{{.*}} to i64 // CHECK: icmp ne i64 %[[ptr]], 0 %0 = fir.is_present %arg0 : (!fir.ref) -> i1 @@ -27,7 +27,7 @@ } // CHECK-LABEL: @bar2 -func @bar2() -> i1 { +func.func @bar2() -> i1 { %0 = fir.absent !fir.ref // CHECK: call i1 @foo2(i64* null) %1 = fir.call @foo2(%0) : (!fir.ref) -> i1 @@ -35,7 +35,7 @@ } // CHECK-LABEL: @foo3 -func @foo3(%arg0: !fir.boxchar<1>) -> i1 { +func.func @foo3(%arg0: !fir.boxchar<1>) -> i1 { // CHECK: %[[extract:.*]] = extractvalue { i8*, i64 } %{{.*}}, 0 // CHECK: %[[ptr:.*]] = ptrtoint i8* %[[extract]] to i64 // CHECK: icmp ne i64 %[[ptr]], 0 @@ -44,7 +44,7 @@ } // CHECK-LABEL: @bar3 -func @bar3() -> i1 { +func.func @bar3() -> i1 { %0 = fir.absent !fir.boxchar<1> // CHECK: call i1 @foo3(i8* null, i64 undef) %1 = fir.call @foo3(%0) : (!fir.boxchar<1>) -> i1 diff --git a/flang/test/Fir/peephole.fir b/flang/test/Fir/peephole.fir --- a/flang/test/Fir/peephole.fir +++ b/flang/test/Fir/peephole.fir @@ -6,7 +6,7 @@ // CHECK-SAME: i256 %[[arg:.*]]) // CHECK-NEXT: = trunc i256 %[[arg]] to i8 // CHECK-NEXT: ret i8 -func @test_trunc(%0 : i256) -> i8 { +func.func @test_trunc(%0 : i256) -> i8 { %1 = fir.convert %0 : (i256) -> i128 %2 = fir.convert %1 : (i128) -> i64 %3 = fir.convert %2 : (i64) -> i32 @@ -19,7 +19,7 @@ // CHECK-SAME: i8 %[[arg:.*]]) // CHECK-NEXT: = sext i8 %[[arg]] to i256 // CHECK-NEXT: ret i256 -func @test_sext(%0 : i8) -> i256 { +func.func @test_sext(%0 : i8) -> i256 { %1 = fir.convert %0 : (i8) -> i16 %2 = fir.convert %1 : (i16) -> i32 %3 = fir.convert %2 : (i32) -> i64 @@ -32,7 +32,7 @@ // CHECK-SAME: fp128 %[[arg:.*]]) // CHECK-NEXT: %[[res:.*]] = fptrunc fp128 %[[arg]] to half // CHECK-NEXT: ret half %[[res]] -func @test_fptrunc(%0 : f128) -> f16 { +func.func @test_fptrunc(%0 : f128) -> f16 { %2 = fir.convert %0 : (f128) -> f64 %3 = fir.convert %2 : (f64) -> f32 %4 = fir.convert %3 : (f32) -> f16 @@ -43,7 +43,7 @@ // CHECK-SAME: bfloat %[[arg:.*]]) // CHECK-NEXT: = fpext bfloat %[[arg]] to x86_fp80 // CHECK-NEXT: ret x86_fp80 -func @test_fpext(%0 : bf16) -> f80 { +func.func @test_fpext(%0 : bf16) -> f80 { %2 = fir.convert %0 : (bf16) -> f32 %3 = fir.convert %2 : (f32) -> f64 %4 = fir.convert %3 : (f64) -> f80 @@ -54,7 +54,7 @@ // CHECK-SAME: i8 %[[arg:.*]]) // CHECK-NEXT: = sext i8 %[[arg]] to i64 // CHECK-NEXT: ret i64 -func @test_ascending(%0 : i8) -> index { +func.func @test_ascending(%0 : i8) -> index { %1 = fir.convert %0 : (i8) -> i16 %2 = fir.convert %1 : (i16) -> i32 %3 = fir.convert %2 : (i32) -> i64 @@ -66,7 +66,7 @@ // CHECK-SAME: i64 %[[arg:.*]]) // CHECK-NEXT: = trunc i64 %[[arg]] to i8 // CHECK-NEXT: ret i8 -func @test_descending(%0 : index) -> i8 { +func.func @test_descending(%0 : index) -> i8 { %2 = fir.convert %0 : (index) -> i64 %3 = fir.convert %2 : (i64) -> i32 %4 = fir.convert %3 : (i32) -> i16 @@ -77,7 +77,7 @@ // CHECK-LABEL: define float @test_useless( // CHECK-SAME: float %[[arg:.*]]) // CHECK-NEXT: ret float %[[arg]] -func @test_useless(%0 : f32) -> f32 { +func.func @test_useless(%0 : f32) -> f32 { %1 = fir.convert %0 : (f32) -> f32 return %1 : f32 } @@ -86,7 +86,7 @@ // CHECK-SAME: i32 %[[arg:.*]]) // CHECK-NEXT: %[[res:.*]] = sitofp i32 %[[arg]] to float // CHECK-NEXT: ret float %[[res]] -func @test_useless_sext(%0 : i32) -> f32 { +func.func @test_useless_sext(%0 : i32) -> f32 { %1 = fir.convert %0 : (i32) -> i64 %2 = fir.convert %1 : (i64) -> i32 %3 = fir.convert %2 : (i32) -> f32 @@ -97,7 +97,7 @@ // CHECK-SAME: i32 %[[arg:.*]]) // CHECK-NEXT: trunc i32 %[[arg]] to i16 // CHECK-NEXT: ret i16 -func @test_hump(%0 : i32) -> i16 { +func.func @test_hump(%0 : i32) -> i16 { %1 = fir.convert %0 : (i32) -> i64 %2 = fir.convert %1 : (i64) -> i16 return %2 : i16 @@ -108,7 +108,7 @@ // CHECK-NEXT: %[[i:.*]] = trunc i32 %[[arg]] to i8 // CHECK-NEXT: sext i8 %[[i]] to i16 // CHECK-NEXT: ret i16 -func @test_slump(%0 : i32) -> i16 { +func.func @test_slump(%0 : i32) -> i16 { %1 = fir.convert %0 : (i32) -> i8 %2 = fir.convert %1 : (i8) -> i16 return %2 : i16 @@ -119,7 +119,7 @@ // CHECK-NEXT: %[[i:.*]] = trunc i64 %[[arg]] to i16 // CHECK-NEXT: sext i16 %[[i]] to i64 // CHECK-NEXT: ret i64 -func @test_slump2(%0 : index) -> index { +func.func @test_slump2(%0 : index) -> index { %1 = fir.convert %0 : (index) -> i16 %2 = fir.convert %1 : (i16) -> index return %2 : index diff --git a/flang/test/Fir/rebox-susbtring.fir b/flang/test/Fir/rebox-susbtring.fir --- a/flang/test/Fir/rebox-susbtring.fir +++ b/flang/test/Fir/rebox-susbtring.fir @@ -7,7 +7,7 @@ // CHECK-LABEL: llvm.func @char_section( // CHECK-SAME: %[[VAL_0:.*]]: !llvm.ptr<[[char20_descriptor_t:.*]]>)>>) { -func @char_section(%arg0: !fir.box>>) { +func.func @char_section(%arg0: !fir.box>>) { %c7_i64 = arith.constant 7 : i64 %c1_i64 = arith.constant 1 : i64 %c0 = arith.constant 0 : index @@ -38,8 +38,8 @@ // CHECK-LABEL: llvm.func @foo( // CHECK-SAME: %[[VAL_0:.*]]: !llvm.ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)>>) { -func private @bar(!fir.box>>) -func @foo(%arg0: !fir.box}>>>) { +func.func private @bar(!fir.box>>) +func.func @foo(%arg0: !fir.box}>>>) { %c7_i64 = arith.constant 7 : i64 %c1_i64 = arith.constant 1 : i64 %c9_i64 = arith.constant 9 : i64 diff --git a/flang/test/Fir/rebox.fir b/flang/test/Fir/rebox.fir --- a/flang/test/Fir/rebox.fir +++ b/flang/test/Fir/rebox.fir @@ -6,10 +6,10 @@ // call bar(x(5, 6:80:3)) // end subroutine -func private @bar1(!fir.box>) +func.func private @bar1(!fir.box>) // CHECK-LABEL: define void @test_rebox_1( // CHECK-SAME: { float*, i64, i32, i8, i8, i8, i8, [2 x [3 x i64]] }* %[[INBOX:.*]]) -func @test_rebox_1(%arg0: !fir.box>) { +func.func @test_rebox_1(%arg0: !fir.box>) { // CHECK: %[[OUTBOX_ALLOC:.*]] = alloca { float*, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index @@ -49,10 +49,10 @@ // call bar(x(4:30:1, 4:30:1)) // end subroutine -func private @bar_rebox_test2(!fir.box>>) +func.func private @bar_rebox_test2(!fir.box>>) // CHECK-LABEL: define void @test_rebox_2( // CHECK-SAME: { i8*, i64, i32, i8, i8, i8, i8, [2 x [3 x i64]] }* %[[INBOX:.*]]) -func @test_rebox_2(%arg0: !fir.box>>) { +func.func @test_rebox_2(%arg0: !fir.box>>) { %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %c30 = arith.constant 30 : index @@ -76,10 +76,10 @@ // call bar(p) // end subroutine -func private @bar_rebox_test3(!fir.box>) +func.func private @bar_rebox_test3(!fir.box>) // CHECK-LABEL: define void @test_rebox_3( // CHECK-SAME: { float*, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }* %[[INBOX:.*]]) -func @test_rebox_3(%arg0: !fir.box>) { +func.func @test_rebox_3(%arg0: !fir.box>) { // CHECK: %[[OUTBOX_ALLOC:.*]] = alloca { float*, i64, i32, i8, i8, i8, i8, [3 x [3 x i64]] } %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index @@ -115,7 +115,7 @@ // CHECK-LABEL: define void @test_rebox_4( // CHECK-SAME: { i8*, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }* %[[INPUT:.*]]) -func @test_rebox_4(%arg0: !fir.box>>) { +func.func @test_rebox_4(%arg0: !fir.box>>) { // CHECK: %[[NEWBOX_STORAGE:.*]] = alloca { [10 x i8]*, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } // CHECK: %[[EXTENT_GEP:.*]] = getelementptr {{{.*}}}, { i8*, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }* %[[INPUT]], i32 0, i32 7, i64 0, i32 1 // CHECK: %[[EXTENT:.*]] = load i64, i64* %[[EXTENT_GEP]] @@ -134,4 +134,4 @@ fir.call @bar_test_rebox_4(%1) : (!fir.box>>>) -> () return } -func private @bar_test_rebox_4(!fir.box>>>) +func.func private @bar_test_rebox_4(!fir.box>>>) diff --git a/flang/test/Fir/recursive-type.fir b/flang/test/Fir/recursive-type.fir --- a/flang/test/Fir/recursive-type.fir +++ b/flang/test/Fir/recursive-type.fir @@ -14,6 +14,6 @@ // CHECK-SAME: %{{.*}}: !llvm.struct<"[[T1:.*]]", (ptr>)> // CHECK-SAME: %{{.*}}: !llvm.struct<"[[T2:.*]]", (f32, ptr>, i32, ptr>)> // CHECK-SAME: %{{.*}}: !llvm.struct<"[[T3:.*]]", (ptr>)>>)>, %{{.*}}: !llvm.struct<"[[T4]]", (ptr>)>>)>) -func @recursiveTypes(%a : !t1, %b : !t2, %c : !t3, %d : !t4) { +func.func @recursiveTypes(%a : !t1, %b : !t2, %c : !t3, %d : !t4) { return } diff --git a/flang/test/Fir/select.fir b/flang/test/Fir/select.fir --- a/flang/test/Fir/select.fir +++ b/flang/test/Fir/select.fir @@ -3,7 +3,7 @@ // RUN: tco %s | FileCheck %s // CHECK-LABEL: @f -func @f(%a : i32) -> i32 { +func.func @f(%a : i32) -> i32 { %1 = arith.constant 1 : i32 %2 = arith.constant 42 : i32 // CHECK: switch i32 %{{.*}}, label %{{.*}} [ @@ -19,7 +19,7 @@ } // CHECK-LABEL: @g -func @g(%a : i32) -> i32 { +func.func @g(%a : i32) -> i32 { %1 = arith.constant 1 : i32 %2 = arith.constant 42 : i32 @@ -39,7 +39,7 @@ } // CHECK-LABEL: @h -func @h(%a : i32) -> i32 { +func.func @h(%a : i32) -> i32 { %1 = arith.constant 1 : i32 %2 = arith.constant 42 : i32 %b1 = arith.constant 4 : i32 diff --git a/flang/test/Fir/target-rewrite-boxchar.fir b/flang/test/Fir/target-rewrite-boxchar.fir --- a/flang/test/Fir/target-rewrite-boxchar.fir +++ b/flang/test/Fir/target-rewrite-boxchar.fir @@ -9,7 +9,7 @@ // INT32-SAME: ([[ARG0:%[0-9A-Za-z]+]]: !fir.ref>, [[ARG1:%[0-9A-Za-z]+]]: !fir.ref>, [[ARG2:%[0-9A-Za-z]+]]: i32, [[ARG3:%[0-9A-Za-z]+]]: i32) -> i64 // INT64-LABEL: @boxcharparams // INT64-SAME: ([[ARG0:%[0-9A-Za-z]+]]: !fir.ref>, [[ARG1:%[0-9A-Za-z]+]]: !fir.ref>, [[ARG2:%[0-9A-Za-z]+]]: i64, [[ARG3:%[0-9A-Za-z]+]]: i64) -> i64 -func @boxcharparams(%arg0 : !fir.boxchar<1>, %arg1 : !fir.boxchar<1>) -> i64 { +func.func @boxcharparams(%arg0 : !fir.boxchar<1>, %arg1 : !fir.boxchar<1>) -> i64 { // INT32-DAG: [[B0:%[0-9]+]] = fir.emboxchar [[ARG1]], [[ARG3]] : (!fir.ref>, i32) -> !fir.boxchar<1> // INT32-DAG: [[B1:%[0-9]+]] = fir.emboxchar [[ARG0]], [[ARG2]] : (!fir.ref>, i32) -> !fir.boxchar<1> // INT32-DAG: fir.unboxchar [[B0]] : (!fir.boxchar<1>) -> (!fir.ref>, i64) @@ -30,7 +30,7 @@ // INT32-SAME: ([[ARG0:%[0-9A-Za-z]+]]: !fir.ref> {llvm.sret}, [[ARG1:%[0-9A-Za-z]+]]: i32, [[ARG2:%[0-9A-Za-z]+]]: !fir.ref>, [[ARG3:%[0-9A-Za-z]+]]: i32) // INT64-LABEL: @boxcharsret // INT64-SAME: ([[ARG0:%[0-9A-Za-z]+]]: !fir.ref> {llvm.sret}, [[ARG1:%[0-9A-Za-z]+]]: i64, [[ARG2:%[0-9A-Za-z]+]]: !fir.ref>, [[ARG3:%[0-9A-Za-z]+]]: i64) -func @boxcharsret(%arg0 : !fir.boxchar<1> {llvm.sret}, %arg1 : !fir.boxchar<1>) { +func.func @boxcharsret(%arg0 : !fir.boxchar<1> {llvm.sret}, %arg1 : !fir.boxchar<1>) { // INT32-DAG: [[B0:%[0-9]+]] = fir.emboxchar [[ARG0]], [[ARG1]] : (!fir.ref>, i32) -> !fir.boxchar<1> // INT32-DAG: [[B1:%[0-9]+]] = fir.emboxchar [[ARG2]], [[ARG3]] : (!fir.ref>, i32) -> !fir.boxchar<1> // INT32-DAG: fir.unboxchar [[B0]] : (!fir.boxchar<1>) -> (!fir.ref>>, i64) @@ -60,18 +60,18 @@ // INT32-SAME: ({{%[0-9A-Za-z]+}}: !fir.ref> {llvm.sret}, {{%[0-9A-Za-z]+}}: i32, {{%[0-9A-Za-z]+}}: !fir.ref>, {{%[0-9A-Za-z]+}}: !fir.ref>, {{%[0-9A-Za-z]+}}: i32, {{%[0-9A-Za-z]+}}: i32) // INT64-LABEL: @boxcharmultiple // INT64-SAME: ({{%[0-9A-Za-z]+}}: !fir.ref> {llvm.sret}, {{%[0-9A-Za-z]+}}: i64, {{%[0-9A-Za-z]+}}: !fir.ref>, {{%[0-9A-Za-z]+}}: !fir.ref>, {{%[0-9A-Za-z]+}}: i64, {{%[0-9A-Za-z]+}}: i64) -func @boxcharmultiple(%arg0 : !fir.boxchar<1> {llvm.sret}, %arg1 : !fir.boxchar<1>, %arg2 : !fir.boxchar<1>) { +func.func @boxcharmultiple(%arg0 : !fir.boxchar<1> {llvm.sret}, %arg1 : !fir.boxchar<1>, %arg2 : !fir.boxchar<1>) { return } // Test that we rewrite calls to functions that take boxchar arguments. // INT32-LABEL: @boxcharcallee(!fir.ref>, i32) // INT64-LABEL: @boxcharcallee(!fir.ref>, i64) -func private @boxcharcallee(%x : !fir.boxchar<1>) +func.func private @boxcharcallee(%x : !fir.boxchar<1>) // INT32: @boxchararg // INT64: @boxchararg -func @boxchararg() { +func.func @boxchararg() { %1 = fir.address_of (@name) : !fir.ref> %2 = arith.constant 9 : i64 %3 = fir.convert %1 : (!fir.ref>) -> !fir.ref> @@ -97,7 +97,7 @@ // Test that we rewrite the fir.address_of operator // INT32-LABEL: @addrof // INT64-LABEL: @addrof -func @addrof() { +func.func @addrof() { // INT32: {{.*}} = fir.address_of(@boxcharcallee) : (!fir.ref>, i32) -> () // INT64: {{.*}} = fir.address_of(@boxcharcallee) : (!fir.ref>, i64) -> () %f = fir.address_of(@boxcharcallee) : (!fir.boxchar<1>) -> () diff --git a/flang/test/Fir/target-rewrite-char-proc.fir b/flang/test/Fir/target-rewrite-char-proc.fir --- a/flang/test/Fir/target-rewrite-char-proc.fir +++ b/flang/test/Fir/target-rewrite-char-proc.fir @@ -4,12 +4,12 @@ // RUN: fir-opt --target-rewrite="target=x86_64-unknown-linux-gnu" %s | FileCheck %s // CHECK: func private @takes_char_proc(() -> () {fir.char_proc}, i64) -func private @takes_char_proc(tuple<() -> (), i64> {fir.char_proc}) +func.func private @takes_char_proc(tuple<() -> (), i64> {fir.char_proc}) -func private @takes_char(!fir.boxchar<1>) -func private @char_proc(!fir.ref>, index) -> !fir.boxchar<1> +func.func private @takes_char(!fir.boxchar<1>) +func.func private @char_proc(!fir.ref>, index) -> !fir.boxchar<1> -func @_QPcst_len() { +func.func @_QPcst_len() { %0 = fir.address_of(@char_proc) : (!fir.ref>, index) -> !fir.boxchar<1> %c7_i64 = arith.constant 7 : i64 %1 = fir.convert %0 : ((!fir.ref>, index) -> !fir.boxchar<1>) -> (() -> ()) @@ -26,7 +26,7 @@ // CHECK: func @test_dummy_proc_that_takes_dummy_char_proc( // CHECK-SAME: %[[ARG0:.*]]: () -> ()) { -func @test_dummy_proc_that_takes_dummy_char_proc(%arg0: () -> ()) { +func.func @test_dummy_proc_that_takes_dummy_char_proc(%arg0: () -> ()) { %0 = fir.address_of(@char_proc) : (!fir.ref>, index) -> !fir.boxchar<1> %c7_i64 = arith.constant 7 : i64 %1 = fir.convert %0 : ((!fir.ref>, index) -> !fir.boxchar<1>) -> (() -> ()) @@ -48,7 +48,7 @@ // CHECK-SAME: %[[C_ADDR:.*]]: !fir.ref>, // CHECK-SAME: %[[PROC_LEN:.*]]: i64, // CHECK-SAME: %[[C_LEN:.*]]: i64) { -func @takes_dummy_char_proc_impl(%arg0: tuple<() -> (), i64> {fir.char_proc}, %arg1: !fir.boxchar<1>) { +func.func @takes_dummy_char_proc_impl(%arg0: tuple<() -> (), i64> {fir.char_proc}, %arg1: !fir.boxchar<1>) { // CHECK: %[[UNDEF:.*]] = fir.undefined tuple<() -> (), i64> // CHECK: %[[TUPLE0:.*]] = fir.insert_value %[[UNDEF]], %[[PROC_ADDR]], [0 : index] : (tuple<() -> (), i64>, () -> ()) -> tuple<() -> (), i64> // CHECK: %[[TUPLE1:.*]] = fir.insert_value %[[TUPLE0]], %[[PROC_LEN]], [1 : index] : (tuple<() -> (), i64>, i64) -> tuple<() -> (), i64> diff --git a/flang/test/Fir/target-rewrite-complex.fir b/flang/test/Fir/target-rewrite-complex.fir --- a/flang/test/Fir/target-rewrite-complex.fir +++ b/flang/test/Fir/target-rewrite-complex.fir @@ -9,7 +9,7 @@ // X64-LABEL: func @returncomplex4() -> !fir.vector<2:!fir.real<4>> // AARCH64-LABEL: func @returncomplex4() -> tuple, !fir.real<4>> // PPC-LABEL: func @returncomplex4() -> tuple, !fir.real<4>> -func @returncomplex4() -> !fir.complex<4> { +func.func @returncomplex4() -> !fir.complex<4> { // I32: fir.insert_value // I32: [[VAL:%[0-9A-Za-z]+]] = fir.insert_value // X64: fir.insert_value @@ -57,7 +57,7 @@ // X64-LABEL: func @returncomplex8() -> tuple, !fir.real<8>> // AARCH64-LABEL: func @returncomplex8() -> tuple, !fir.real<8>> // PPC-LABEL: func @returncomplex8() -> tuple, !fir.real<8>> -func @returncomplex8() -> !fir.complex<8> { +func.func @returncomplex8() -> !fir.complex<8> { // I32: fir.insert_value // I32: [[VAL:%[0-9A-Za-z]+]] = fir.insert_value {{.*}} // X64: fir.insert_value @@ -100,14 +100,14 @@ // X64-LABEL: func private @paramcomplex4(!fir.vector<2:!fir.real<4>>) // AARCH64-LABEL: func private @paramcomplex4(!fir.array<2x!fir.real<4>>) // PPC-LABEL: func private @paramcomplex4(!fir.real<4>, !fir.real<4>) -func private @paramcomplex4(!fir.complex<4>) -> () +func.func private @paramcomplex4(!fir.complex<4>) -> () // Test that we rewrite calls to functions that return or accept complex<4>. // I32-LABEL: func @callcomplex4() // X64-LABEL: func @callcomplex4() // AARCH64-LABEL: func @callcomplex4() // PPC-LABEL: func @callcomplex4() -func @callcomplex4() { +func.func @callcomplex4() { // I32: [[RES:%[0-9A-Za-z]+]] = fir.call @returncomplex4() : () -> i64 // X64: [[RES:%[0-9A-Za-z]+]] = fir.call @returncomplex4() : () -> !fir.vector<2:!fir.real<4>> @@ -160,14 +160,14 @@ // X64-LABEL: func private @paramcomplex8(!fir.real<8>, !fir.real<8>) // AARCH64-LABEL: func private @paramcomplex8(!fir.array<2x!fir.real<8>>) // PPC-LABEL: func private @paramcomplex8(!fir.real<8>, !fir.real<8>) -func private @paramcomplex8(!fir.complex<8>) -> () +func.func private @paramcomplex8(!fir.complex<8>) -> () // Test that we rewrite calls to functions that return or accept complex<8>. // I32-LABEL: func @callcomplex8() // X64-LABEL: func @callcomplex8() // AARCH64-LABEL: func @callcomplex8() // PPC-LABEL: func @callcomplex8() -func @callcomplex8() { +func.func @callcomplex8() { // I32: [[RES:%[0-9A-Za-z]+]] = fir.alloca tuple, !fir.real<8>> // I32: fir.call @returncomplex8([[RES]]) : (!fir.ref, !fir.real<8>>>) -> () // X64: [[RES:%[0-9A-Za-z]+]] = fir.call @returncomplex8() : () -> tuple, !fir.real<8>> @@ -216,7 +216,7 @@ // X64-LABEL: func private @calleemultipleparamscomplex4(!fir.vector<2:!fir.real<4>>, !fir.vector<2:!fir.real<4>>, !fir.vector<2:!fir.real<4>>) // AARCH64-LABEL: func private @calleemultipleparamscomplex4(!fir.array<2x!fir.real<4>>, !fir.array<2x!fir.real<4>>, !fir.array<2x!fir.real<4>>) // PPC-LABEL: func private @calleemultipleparamscomplex4(!fir.real<4>, !fir.real<4>, !fir.real<4>, !fir.real<4>, !fir.real<4>, !fir.real<4>) -func private @calleemultipleparamscomplex4(!fir.complex<4>, !fir.complex<4>, !fir.complex<4>) -> () +func.func private @calleemultipleparamscomplex4(!fir.complex<4>, !fir.complex<4>, !fir.complex<4>) -> () // I32-LABEL: func @multipleparamscomplex4 // I32-SAME: ([[Z1:%[0-9A-Za-z]+]]: !fir.ref, !fir.real<4>>> {llvm.align = 4 : i32, llvm.byval}, [[Z2:%[0-9A-Za-z]+]]: !fir.ref, !fir.real<4>>> {llvm.align = 4 : i32, llvm.byval}, [[Z3:%[0-9A-Za-z]+]]: !fir.ref, !fir.real<4>>> {llvm.align = 4 : i32, llvm.byval}) @@ -226,7 +226,7 @@ // AARCH64-SAME: ([[Z1:%[0-9A-Za-z]+]]: !fir.array<2x!fir.real<4>>, [[Z2:%[0-9A-Za-z]+]]: !fir.array<2x!fir.real<4>>, [[Z3:%[0-9A-Za-z]+]]: !fir.array<2x!fir.real<4>>) // PPC-LABEL: func @multipleparamscomplex4 // PPC-SAME: ([[A1:%[0-9A-Za-z]+]]: !fir.real<4>, [[B1:%[0-9A-Za-z]+]]: !fir.real<4>, [[A2:%[0-9A-Za-z]+]]: !fir.real<4>, [[B2:%[0-9A-Za-z]+]]: !fir.real<4>, [[A3:%[0-9A-Za-z]+]]: !fir.real<4>, [[B3:%[0-9A-Za-z]+]]: !fir.real<4>) -func @multipleparamscomplex4(%z1 : !fir.complex<4>, %z2 : !fir.complex<4>, %z3 : !fir.complex<4>) { +func.func @multipleparamscomplex4(%z1 : !fir.complex<4>, %z2 : !fir.complex<4>, %z3 : !fir.complex<4>) { // I32-DAG: [[Z1_ADDR:%[0-9A-Za-z]+]] = fir.convert [[Z1]] : (!fir.ref, !fir.real<4>>>) -> !fir.ref> // I32-DAG: [[Z1_VAL:%[0-9A-Za-z]+]] = fir.load [[Z1_ADDR]] : !fir.ref> // I32-DAG: [[Z2_ADDR:%[0-9A-Za-z]+]] = fir.convert [[Z2]] : (!fir.ref, !fir.real<4>>>) -> !fir.ref> @@ -340,7 +340,7 @@ // PPC-LABEL: func private @mlircomplexf32 // PPC-SAME: ([[A1:%[0-9A-Za-z]+]]: f32, [[B1:%[0-9A-Za-z]+]]: f32, [[A2:%[0-9A-Za-z]+]]: f32, [[B2:%[0-9A-Za-z]+]]: f32) // PPC-SAME: -> tuple -func private @mlircomplexf32(%z1: complex, %z2: complex) -> complex { +func.func private @mlircomplexf32(%z1: complex, %z2: complex) -> complex { // I32-DAG: [[Z1_ADDR:%[0-9A-Za-z]+]] = fir.convert [[Z1]] : (!fir.ref>) -> !fir.ref> // I32-DAG: [[Z1_VAL:%[0-9A-Za-z]+]] = fir.load [[Z1_ADDR]] : !fir.ref> @@ -459,7 +459,7 @@ // X64-LABEL: func @addrof() // AARCH64-LABEL: func @addrof() // PPC-LABEL: func @addrof() -func @addrof() { +func.func @addrof() { // I32: {{%.*}} = fir.address_of(@returncomplex4) : () -> i64 // X64: {{%.*}} = fir.address_of(@returncomplex4) : () -> !fir.vector<2:!fir.real<4>> // AARCH64: {{%.*}} = fir.address_of(@returncomplex4) : () -> tuple, !fir.real<4>> diff --git a/flang/test/Fir/target-rewrite-triple.fir b/flang/test/Fir/target-rewrite-triple.fir --- a/flang/test/Fir/target-rewrite-triple.fir +++ b/flang/test/Fir/target-rewrite-triple.fir @@ -5,7 +5,7 @@ // CHANGED: llvm.target_triple = "x86_64-unknown-linux-gnu" // CHANGED-NOT: llvm.target_triple = "aarch64-unknown-linux-gnu" module attributes {llvm.target_triple = "aarch64-unknown-linux-gnu"} { - func @dummyfunc() -> () { + func.func @dummyfunc() -> () { return } } diff --git a/flang/test/Fir/types-to-llvm.fir b/flang/test/Fir/types-to-llvm.fir --- a/flang/test/Fir/types-to-llvm.fir +++ b/flang/test/Fir/types-to-llvm.fir @@ -6,31 +6,31 @@ // Test sequence types `!fir.array` // Note that we're switching from column-major to row-major here. -func private @foo0(%arg0: !fir.array<10x12xi64>) +func.func private @foo0(%arg0: !fir.array<10x12xi64>) // CHECK-LABEL: foo0 // CHECK-SAME: !llvm.array<12 x array<10 x i64>> -func private @foo1(%arg0: !fir.array) +func.func private @foo1(%arg0: !fir.array) // CHECK-LABEL: foo1 // CHECK-SAME: !llvm.ptr -func private @foo2(%arg0: !fir.array) +func.func private @foo2(%arg0: !fir.array) // CHECK-LABEL: foo2 // CHECK-SAME: !llvm.ptr -func private @foo3(%arg0: !fir.array<*:i32>) +func.func private @foo3(%arg0: !fir.array<*:i32>) // CHECK-LABEL: foo3 // CHECK-SAME: !llvm.ptr -func private @foo4(%arg0: !fir.array<3x?xi32>) +func.func private @foo4(%arg0: !fir.array<3x?xi32>) // CHECK-LABEL: foo4 // CHECK-SAME: !llvm.ptr> -func private @foo5(%arg0: !fir.array) +func.func private @foo5(%arg0: !fir.array) // CHECK-LABEL: foo5 // CHECK-SAME: !llvm.ptr -func private @foo6(%arg0: !fir.array<2x?x3x?x4xi32>) +func.func private @foo6(%arg0: !fir.array<2x?x3x?x4xi32>) // CHECK-LABEL: foo6 // CHECK-SAME: !llvm.ptr -func private @foo7(%arg0: !fir.array<6x?x!fir.char<1,?>>) +func.func private @foo7(%arg0: !fir.array<6x?x!fir.char<1,?>>) // CHECK-LABEL: foo7 // CHECK-SAME: !llvm.ptr -func private @foo8(%arg0: !fir.array<6x?x!fir.char<1,3>>) +func.func private @foo8(%arg0: !fir.array<6x?x!fir.char<1,3>>) // CHECK-LABEL: foo8 // CHECK-SAME: !llvm.ptr @@ -38,28 +38,28 @@ // Test reference types `!fir.ref` -func private @foo0(%arg0: !fir.ref) +func.func private @foo0(%arg0: !fir.ref) // CHECK-LABEL: foo0 // CHECK-SAME: !llvm.ptr -func private @foo1(%arg0: !fir.ref>) +func.func private @foo1(%arg0: !fir.ref>) // CHECK-LABEL: foo1 // CHECK-SAME: !llvm.ptr> -func private @foo2(%arg0: !fir.ref>>>) +func.func private @foo2(%arg0: !fir.ref>>>) // CHECK-LABEL: foo2 // CHECK-SAME: !llvm.ptr>, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, ptr, array<1 x i{{.*}}>)>> -func private @foo3(%arg0: !fir.ref>) +func.func private @foo3(%arg0: !fir.ref>) // CHECK-LABEL: foo3 // CHECK-SAME: !llvm.ptr -func private @foo4(%arg0: !fir.ref>) +func.func private @foo4(%arg0: !fir.ref>) // CHECK-LABEL: foo4 // CHECK-SAME: !llvm.ptr>> -func private @foo5(%arg0: !fir.ref>>) +func.func private @foo5(%arg0: !fir.ref>>) // CHECK-LABEL: foo5 // CHECK-SAME: !llvm.ptr -func private @foo6(%arg0: !fir.ref>>) +func.func private @foo6(%arg0: !fir.ref>>) // CHECK-LABEL: foo6 // CHECK-SAME: !llvm.ptr -func private @foo7(%arg0: !fir.ref>>) +func.func private @foo7(%arg0: !fir.ref>>) // CHECK-LABEL: foo7 // CHECK-SAME: !llvm.ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<1 x array<3 x i{{.*}}>>)>> @@ -67,11 +67,11 @@ // Test pointer types `!fir.ptr` -func private @foo0(%arg0: !fir.ptr) +func.func private @foo0(%arg0: !fir.ptr) // CHECK-LABEL: foo0 // CHECK-SAME: !llvm.ptr -func private @foo1(%arg0: !fir.ptr>) +func.func private @foo1(%arg0: !fir.ptr>) // CHECK-LABEL: foo1 // CHECK-SAME: !llvm.ptr> @@ -79,23 +79,23 @@ // Test box types `!fir.box` -func private @foo0(%arg0: !fir.box>) +func.func private @foo0(%arg0: !fir.box>) // CHECK-LABEL: foo0 // CHECK-SAME: !llvm.ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<1 x array<3 x i{{.*}}>>)>> -func private @foo1(%arg0: !fir.box>) +func.func private @foo1(%arg0: !fir.box>) // CHECK-LABEL: foo1 // CHECK-SAME: !llvm.ptr>, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<1 x array<3 x i{{.*}}>>)>> -func private @foo2(%arg0: !fir.box>) +func.func private @foo2(%arg0: !fir.box>) // CHECK-LABEL: foo2 // CHECK-SAME: !llvm.ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}})>> -func private @foo3(%arg0: !fir.box>) +func.func private @foo3(%arg0: !fir.box>) // CHECK-LABEL: foo3 // CHECK-SAME: !llvm.ptr>, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, ptr, array<1 x i{{.*}}>)>> -func private @foo4(%arg0: !fir.box>>) +func.func private @foo4(%arg0: !fir.box>>) // CHECK-LABEL: foo4 // CHECK-SAME: !llvm.ptr>, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, ptr, array<1 x i{{.*}}>)>> @@ -103,17 +103,17 @@ // Test char types `!fir.char` -func private @foo0(%arg0: !fir.char<1, 4>, %arg1: !fir.char<1, ?>) +func.func private @foo0(%arg0: !fir.char<1, 4>, %arg1: !fir.char<1, ?>) // CHECK-LABEL: foo0 // CHECK-SAME: !llvm.array<4 x i8> // CHECK-SAME: i8 -func private @foo1(%arg0: !fir.char<2, 12>, %arg1: !fir.char<2, ?>) +func.func private @foo1(%arg0: !fir.char<2, 12>, %arg1: !fir.char<2, ?>) // CHECK-LABEL: foo1 // CHECK-SAME: !llvm.array<12 x i16> // CHECK-SAME: i16 -func private @foo2(%arg0: !fir.char<4, 8>, %arg1: !fir.char<4, ?>) +func.func private @foo2(%arg0: !fir.char<4, 8>, %arg1: !fir.char<4, ?>) // CHECK-LABEL: foo2 // CHECK-SAME: !llvm.array<8 x i32> // CHECK-SAME: i32 @@ -121,39 +121,39 @@ // ----- // Test `!fir.heap<>` conversion. -func private @foo0(%arg0: !fir.heap) +func.func private @foo0(%arg0: !fir.heap) // CHECK-LABEL: foo0 // CHECK-SAME: !llvm.ptr -func private @foo1(%arg0: !fir.heap>) +func.func private @foo1(%arg0: !fir.heap>) // CHECK-LABEL: foo1 // CHECK-SAME: !llvm.ptr> -func private @foo2(%arg0: !fir.heap>) +func.func private @foo2(%arg0: !fir.heap>) // CHECK-LABEL: foo2 // CHECK-SAME: !llvm.ptr -func private @foo3(%arg0: !fir.heap>) +func.func private @foo3(%arg0: !fir.heap>) // CHECK-LABEL: foo3 // CHECK-SAME: !llvm.ptr> -func private @foo4(%arg0: !fir.heap>) +func.func private @foo4(%arg0: !fir.heap>) // CHECK-LABEL: foo4 // CHECK-SAME: !llvm.ptr -func private @foo5(%arg0: !fir.heap>) +func.func private @foo5(%arg0: !fir.heap>) // CHECK-LABEL: foo5 // CHECK-SAME: !llvm.ptr> -func private @foo6(%arg0: !fir.heap>) +func.func private @foo6(%arg0: !fir.heap>) // CHECK-LABEL: foo6 // CHECK-SAME: !llvm.ptr -func private @foo7(%arg0: !fir.heap>) +func.func private @foo7(%arg0: !fir.heap>) // CHECK-LABEL: foo7 // CHECK-SAME: !llvm.ptr> -func private @foo8(%arg0: !fir.heap>) +func.func private @foo8(%arg0: !fir.heap>) // CHECK-LABEL: foo8 // CHECK-SAME: !llvm.ptr> @@ -161,23 +161,23 @@ // Test `!fir.integer` conversion. -func private @foo0(%arg0: !fir.int<1>) +func.func private @foo0(%arg0: !fir.int<1>) // CHECK-LABEL: foo0 // CHECK-SAME: i8 -func private @foo1(%arg0: !fir.int<2>) +func.func private @foo1(%arg0: !fir.int<2>) // CHECK-LABEL: foo1 // CHECK-SAME: i16 -func private @foo2(%arg0: !fir.int<4>) +func.func private @foo2(%arg0: !fir.int<4>) // CHECK-LABEL: foo2 // CHECK-SAME: i32 -func private @foo3(%arg0: !fir.int<8>) +func.func private @foo3(%arg0: !fir.int<8>) // CHECK-LABEL: foo3 // CHECK-SAME: i64 -func private @foo4(%arg0: !fir.int<16>) +func.func private @foo4(%arg0: !fir.int<16>) // CHECK-LABEL: foo4 // CHECK-SAME: i128 @@ -185,23 +185,23 @@ // Test `!fir.logical` conversion. -func private @foo0(%arg0: !fir.logical<1>) +func.func private @foo0(%arg0: !fir.logical<1>) // CHECK-LABEL: foo0 // CHECK-SAME: i8 -func private @foo1(%arg0: !fir.logical<2>) +func.func private @foo1(%arg0: !fir.logical<2>) // CHECK-LABEL: foo1 // CHECK-SAME: i16 -func private @foo2(%arg0: !fir.logical<4>) +func.func private @foo2(%arg0: !fir.logical<4>) // CHECK-LABEL: foo2 // CHECK-SAME: i32 -func private @foo3(%arg0: !fir.logical<8>) +func.func private @foo3(%arg0: !fir.logical<8>) // CHECK-LABEL: foo3 // CHECK-SAME: i64 -func private @foo4(%arg0: !fir.logical<16>) +func.func private @foo4(%arg0: !fir.logical<16>) // CHECK-LABEL: foo4 // CHECK-SAME: i128 @@ -209,19 +209,19 @@ // Test `!fir.llvm_ptr` conversion. -func private @foo0(%arg0: !fir.llvm_ptr) +func.func private @foo0(%arg0: !fir.llvm_ptr) // CHECK-LABEL: foo0 // CHECK-SAME: !llvm.ptr -func private @foo1(%arg0: !fir.llvm_ptr>) +func.func private @foo1(%arg0: !fir.llvm_ptr>) // CHECK-LABEL: foo1 // CHECK-SAME: !llvm.ptr> -func private @foo2(%arg0: !fir.llvm_ptr>>>) +func.func private @foo2(%arg0: !fir.llvm_ptr>>>) // CHECK-LABEL: foo2 // CHECK-SAME: !llvm.ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}})>>> -func private @foo3(%arg0: !fir.llvm_ptr>) +func.func private @foo3(%arg0: !fir.llvm_ptr>) // CHECK-LABEL: foo3 // CHECK-SAME: !llvm.ptr> @@ -229,27 +229,27 @@ // Test MLIR `complex` conversion. -func private @foo0(%arg0: complex) +func.func private @foo0(%arg0: complex) // CHECK-LABEL: foo0 // CHECK-SAME: !llvm.struct<(f16, f16)>) -func private @foo1(%arg0: complex) +func.func private @foo1(%arg0: complex) // CHECK-LABEL: foo1 // CHECK-SAME: !llvm.struct<(bf16, bf16)>) -func private @foo2(%arg0: complex) +func.func private @foo2(%arg0: complex) // CHECK-LABEL: foo2 // CHECK-SAME: !llvm.struct<(f32, f32)>) -func private @foo3(%arg0: complex) +func.func private @foo3(%arg0: complex) // CHECK-LABEL: foo3 // CHECK-SAME: !llvm.struct<(f64, f64)>) -func private @foo4(%arg0: complex) +func.func private @foo4(%arg0: complex) // CHECK-LABEL: foo4 // CHECK-SAME: !llvm.struct<(f80, f80)>) -func private @foo5(%arg0: complex) +func.func private @foo5(%arg0: complex) // CHECK-LABEL: foo5 // CHECK-SAME: !llvm.struct<(f128, f128)>) @@ -257,27 +257,27 @@ // Test `!fir.complex` conversion. -func private @foo0(%arg0: !fir.complex<2>) +func.func private @foo0(%arg0: !fir.complex<2>) // CHECK-LABEL: foo0 // CHECK-SAME: !llvm.struct<(f16, f16)>) -func private @foo1(%arg0: !fir.complex<3>) +func.func private @foo1(%arg0: !fir.complex<3>) // CHECK-LABEL: foo1 // CHECK-SAME: !llvm.struct<(bf16, bf16)>) -func private @foo2(%arg0: !fir.complex<4>) +func.func private @foo2(%arg0: !fir.complex<4>) // CHECK-LABEL: foo2 // CHECK-SAME: !llvm.struct<(f32, f32)>) -func private @foo3(%arg0: !fir.complex<8>) +func.func private @foo3(%arg0: !fir.complex<8>) // CHECK-LABEL: foo3 // CHECK-SAME: !llvm.struct<(f64, f64)>) -func private @foo4(%arg0: !fir.complex<10>) +func.func private @foo4(%arg0: !fir.complex<10>) // CHECK-LABEL: foo4 // CHECK-SAME: !llvm.struct<(f80, f80)>) -func private @foo5(%arg0: !fir.complex<16>) +func.func private @foo5(%arg0: !fir.complex<16>) // CHECK-LABEL: foo5 // CHECK-SAME: !llvm.struct<(f128, f128)>) @@ -285,71 +285,71 @@ // Test `!fir.vector<>` conversion. -func private @foo0(%arg0: !fir.vector<2:f16>) +func.func private @foo0(%arg0: !fir.vector<2:f16>) // CHECK-LABEL: foo0 // CHECK-SAME: vector<2xf16> -func private @foo1(%arg0: !fir.vector<20:bf16>) +func.func private @foo1(%arg0: !fir.vector<20:bf16>) // CHECK-LABEL: foo1 // CHECK-SAME: vector<20xbf16> -func private @foo2(%arg0: !fir.vector<30:f32>) +func.func private @foo2(%arg0: !fir.vector<30:f32>) // CHECK-LABEL: foo2 // CHECK-SAME: vector<30xf32> -func private @foo3(%arg0: !fir.vector<55:f64>) +func.func private @foo3(%arg0: !fir.vector<55:f64>) // CHECK-LABEL: foo3 // CHECK-SAME: vector<55xf64> -func private @foo4(%arg0: !fir.vector<15:f80>) +func.func private @foo4(%arg0: !fir.vector<15:f80>) // CHECK-LABEL: foo4 // CHECK-SAME: vector<15xf80> -func private @foo5(%arg0: !fir.vector<28:f128>) +func.func private @foo5(%arg0: !fir.vector<28:f128>) // CHECK-LABEL: foo5 // CHECK-SAME: vector<28xf128> -func private @foo6(%arg0: !fir.vector<100:i1>) +func.func private @foo6(%arg0: !fir.vector<100:i1>) // CHECK-LABEL: foo6 // CHECK-SAME: vector<100xi1> -func private @foo7(%arg0: !fir.vector<10:i8>) +func.func private @foo7(%arg0: !fir.vector<10:i8>) // CHECK-LABEL: foo7 // CHECK-SAME: vector<10xi8> -func private @foo8(%arg0: !fir.vector<12:i16>) +func.func private @foo8(%arg0: !fir.vector<12:i16>) // CHECK-LABEL: foo8 // CHECK-SAME: vector<12xi16> -func private @foo9(%arg0: !fir.vector<20:i32>) +func.func private @foo9(%arg0: !fir.vector<20:i32>) // CHECK-LABEL: foo9 // CHECK-SAME: vector<20xi32> -func private @foo10(%arg0: !fir.vector<30:i64>) +func.func private @foo10(%arg0: !fir.vector<30:i64>) // CHECK-LABEL: foo10 // CHECK-SAME: vector<30xi64> -func private @foo11(%arg0: !fir.vector<2:!fir.real<2>>) +func.func private @foo11(%arg0: !fir.vector<2:!fir.real<2>>) // CHECK-LABEL: foo11 // CHECK-SAME: vector<2xf16> -func private @foo12(%arg0: !fir.vector<2:!fir.real<3>>) +func.func private @foo12(%arg0: !fir.vector<2:!fir.real<3>>) // CHECK-LABEL: foo12 // CHECK-SAME: vector<2xbf16> -func private @foo13(%arg0: !fir.vector<2:!fir.real<4>>) +func.func private @foo13(%arg0: !fir.vector<2:!fir.real<4>>) // CHECK-LABEL: foo13 // CHECK-SAME: vector<2xf32> -func private @foo14(%arg0: !fir.vector<2:!fir.real<8>>) +func.func private @foo14(%arg0: !fir.vector<2:!fir.real<8>>) // CHECK-LABEL: foo14 // CHECK-SAME: vector<2xf64> -func private @foo15(%arg0: !fir.vector<2:!fir.real<10>>) +func.func private @foo15(%arg0: !fir.vector<2:!fir.real<10>>) // CHECK-LABEL: foo15 // CHECK-SAME: vector<2xf80> -func private @foo16(%arg0: !fir.vector<2:!fir.real<16>>) +func.func private @foo16(%arg0: !fir.vector<2:!fir.real<16>>) // CHECK-LABEL: foo16 // CHECK-SAME: vector<2xf128> @@ -357,11 +357,11 @@ // Test `!fir.boxchar` conversion -func private @foo0(%arg0: !fir.boxchar<1>) +func.func private @foo0(%arg0: !fir.boxchar<1>) // CHECK-LABEL: foo0 // CHECK-SAME: !llvm.struct<(ptr, i64)> -func private @foo1(%arg0: !fir.boxchar<2>) +func.func private @foo1(%arg0: !fir.boxchar<2>) // CHECK-LABEL: foo1 // CHECK-SAME: !llvm.struct<(ptr, i64)> @@ -369,7 +369,7 @@ // Test `!fir.field` conversion -func private @foo0(%arg0: !fir.field) +func.func private @foo0(%arg0: !fir.field) // CHECK-LABEL: foo0 // CHECK-SAME: i32 @@ -377,7 +377,7 @@ // Test `!fir.len` conversion. -func private @foo0(%arg0: !fir.len) +func.func private @foo0(%arg0: !fir.len) // CHECK-LABEL: foo0 // CHECK-SAME: i64 @@ -385,37 +385,37 @@ // Test `!fir.tdesc` conversion. -func private @foo0(%arg0: !fir.tdesc>) +func.func private @foo0(%arg0: !fir.tdesc>) // CHECK-LABEL: foo0 // CHECK-SAME: !llvm.ptr -func private @foo1(%arg : !fir.tdesc>) +func.func private @foo1(%arg : !fir.tdesc>) // CHECK-LABEL: foo1 // CHECK-SAME: !llvm.ptr -func private @foo2(%arg : !fir.tdesc) +func.func private @foo2(%arg : !fir.tdesc) // CHECK-LABEL: foo2 // CHECK-SAME: !llvm.ptr -func private @foo3(%arg : !fir.tdesc>) +func.func private @foo3(%arg : !fir.tdesc>) // CHECK-LABEL: foo3 // CHECK-SAME: !llvm.ptr // ----- // Test nested tuple types -func private @foo0(%arg0: tuple>) +func.func private @foo0(%arg0: tuple>) // CHECK-LABEL: foo0 // CHECK-SAME: !llvm.struct<(i64, struct<(f32, i64)>)> // ----- // Test that fir.box inside tuple and derived type are lowered to struct type. -func private @foo0(%arg0: tuple>) +func.func private @foo0(%arg0: tuple>) // CHECK-LABEL: foo0 // CHECK-SAME: !llvm.struct<(i64, struct<(ptr, i{{.*}})>)> -func private @foo1(%arg0: !fir.type}>) +func.func private @foo1(%arg0: !fir.type}>) // CHECK-LABEL: foo1 // CHECK-SAME: !llvm.struct<"derived8", (i64, struct<(ptr, i{{.*}})>)> @@ -423,6 +423,6 @@ // Test fir.box translation. // `none` is used for polymorphic type. -func private @foo0(%arg0: !fir.box) +func.func private @foo0(%arg0: !fir.box) // CHECK-LABEL: foo0 // CHECK-SAME: !llvm.ptr>, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}})>>) diff --git a/flang/test/Fir/widechar.fir b/flang/test/Fir/widechar.fir --- a/flang/test/Fir/widechar.fir +++ b/flang/test/Fir/widechar.fir @@ -1,21 +1,21 @@ // RUN: tco %s | FileCheck %s // CHECK-LABEL: @character_literal1 -func @character_literal1() -> !fir.char<1,13> { +func.func @character_literal1() -> !fir.char<1,13> { %0 = fir.string_lit "Hello, World!"(13) : !fir.char<1,13> // CHECK: ret [13 x i8] c"Hello, World!" return %0 : !fir.char<1,13> } // CHECK-LABEL: @character_literal2 -func @character_literal2() -> !fir.char<2,2> { +func.func @character_literal2() -> !fir.char<2,2> { %0 = fir.string_lit [234, 456](2) : !fir.char<2,2> // CHECK: ret [2 x i16] [i16 234, i16 456] return %0 : !fir.char<2,2> } // CHECK-LABEL: @character_literal4 -func @character_literal4() -> !fir.char<4,3> { +func.func @character_literal4() -> !fir.char<4,3> { %0 = fir.string_lit [89123, 999256, 4](3) : !fir.char<4,3> // CHECK: ret [3 x i32] [i32 89123, i32 999256, i32 4] return %0 : !fir.char<4,3> diff --git a/mlir/include/mlir/Dialect/Func/IR/FuncOps.td b/mlir/include/mlir/Dialect/Func/IR/FuncOps.td --- a/mlir/include/mlir/Dialect/Func/IR/FuncOps.td +++ b/mlir/include/mlir/Dialect/Func/IR/FuncOps.td @@ -209,7 +209,7 @@ def FuncOp : Func_Op<"func", [ AffineScope, AutomaticAllocationScope, CallableOpInterface, - FunctionOpInterface, IsolatedFromAbove, Symbol + FunctionOpInterface, IsolatedFromAbove, OpAsmOpInterface, Symbol ]> { let summary = "An operation with a name containing a single `SSACFG` region"; let description = [{ @@ -308,6 +308,13 @@ /// Returns the result types of this function. ArrayRef getResultTypes() { return getFunctionType().getResults(); } + //===------------------------------------------------------------------===// + // OpAsmOpInterface Methods + //===------------------------------------------------------------------===// + + /// Allow the dialect prefix to be omitted. + static StringRef getDefaultDialect() { return "func"; } + //===------------------------------------------------------------------===// // SymbolOpInterface Methods //===------------------------------------------------------------------===// diff --git a/mlir/lib/IR/Operation.cpp b/mlir/lib/IR/Operation.cpp --- a/mlir/lib/IR/Operation.cpp +++ b/mlir/lib/IR/Operation.cpp @@ -630,10 +630,6 @@ StringRef name = op->getName().getStringRef(); if (name.startswith((defaultDialect + ".").str())) name = name.drop_front(defaultDialect.size() + 1); - // TODO: remove this special case (and update test/IR/parser.mlir) - else if ((defaultDialect.empty() || defaultDialect == "builtin") && - name.startswith("func.")) - name = name.drop_front(5); p.getStream() << name; } diff --git a/mlir/lib/Parser/Parser.cpp b/mlir/lib/Parser/Parser.cpp --- a/mlir/lib/Parser/Parser.cpp +++ b/mlir/lib/Parser/Parser.cpp @@ -1602,11 +1602,6 @@ // default dialect (set through OpAsmOpInterface). opInfo = RegisteredOperationName::lookup( Twine(defaultDialect + "." + opName).str(), getContext()); - // FIXME: Remove this in favor of using default dialects. - if (!opInfo && getContext()->getOrLoadDialect("func")) { - opInfo = RegisteredOperationName::lookup(Twine("func." + opName).str(), - getContext()); - } if (opInfo) { dialect = &opInfo->getDialect(); opName = opInfo->getStringRef().str(); diff --git a/mlir/test/Analysis/test-data-flow.mlir b/mlir/test/Analysis/test-data-flow.mlir --- a/mlir/test/Analysis/test-data-flow.mlir +++ b/mlir/test/Analysis/test-data-flow.mlir @@ -2,7 +2,7 @@ // CHECK-LABEL: Testing : "loop-arg-pessimistic" module attributes {test.name = "loop-arg-pessimistic"} { - func @f() -> index { + func.func @f() -> index { // CHECK: Visiting : %{{.*}} = arith.constant 0 // CHECK-NEXT: Result 0 moved from uninitialized to 1 %c0 = arith.constant 0 : index diff --git a/mlir/test/Analysis/test-liveness.mlir b/mlir/test/Analysis/test-liveness.mlir --- a/mlir/test/Analysis/test-liveness.mlir +++ b/mlir/test/Analysis/test-liveness.mlir @@ -211,7 +211,7 @@ // CHECK-NEXT: val_8 // CHECK-NEXT: %1 = arith.addi // CHECK-NEXT: scf.for - // CHECK: // return %1 + // CHECK: // func.return %1 // CHECK: EndLiveness %0 = arith.addi %arg3, %arg4 : i32 %1 = arith.addi %arg4, %arg5 : i32 @@ -245,7 +245,7 @@ // CHECK-NEXT: val_8 // CHECK-NEXT: %1 = arith.addi // CHECK-NEXT: scf.for - // CHECK: // return %1 + // CHECK: // func.return %1 // CHECK: EndLiveness %arg0 : index, %arg1 : index, %arg2 : index, %arg3 : i32, %arg4 : i32, %arg5 : i32, diff --git a/mlir/test/CAPI/ir.c b/mlir/test/CAPI/ir.c --- a/mlir/test/CAPI/ir.c +++ b/mlir/test/CAPI/ir.c @@ -387,7 +387,7 @@ fprintf(stderr, "Terminator: "); mlirOperationPrint(terminator, printToStderr, NULL); fprintf(stderr, "\n"); - // CHECK: Terminator: return + // CHECK: Terminator: func.return // Get the attribute by index. MlirNamedAttribute namedAttr0 = mlirOperationGetAttribute(operation, 0); @@ -1850,10 +1850,10 @@ int testSymbolTable(MlirContext ctx) { fprintf(stderr, "@testSymbolTable\n"); - const char *moduleString = "func private @foo()" - "func private @bar()"; - const char *otherModuleString = "func private @qux()" - "func private @foo()"; + const char *moduleString = "func.func private @foo()" + "func.func private @bar()"; + const char *otherModuleString = "func.func private @qux()" + "func.func private @foo()"; MlirModule module = mlirModuleCreateParse(ctx, mlirStringRefCreateFromCString(moduleString)); diff --git a/mlir/test/Dialect/Arithmetic/canonicalize.mlir b/mlir/test/Dialect/Arithmetic/canonicalize.mlir --- a/mlir/test/Dialect/Arithmetic/canonicalize.mlir +++ b/mlir/test/Dialect/Arithmetic/canonicalize.mlir @@ -1325,7 +1325,7 @@ // CHECK-LABEL: @test_remui( // CHECK: %[[res:.+]] = arith.constant dense<[0, 0, 4, 2]> : vector<4xi32> // CHECK: return %[[res]] -func @test_remui() -> (vector<4xi32>) { +func.func @test_remui() -> (vector<4xi32>) { %v1 = arith.constant dense<[9, 9, 9, 9]> : vector<4xi32> %v2 = arith.constant dense<[1, 3, 5, 7]> : vector<4xi32> %0 = arith.remui %v1, %v2 : vector<4xi32> @@ -1337,7 +1337,7 @@ // CHECK-LABEL: @test_remui_1( // CHECK: %[[res:.+]] = arith.constant dense<0> : vector<4xi32> // CHECK: return %[[res]] -func @test_remui_1(%arg : vector<4xi32>) -> (vector<4xi32>) { +func.func @test_remui_1(%arg : vector<4xi32>) -> (vector<4xi32>) { %v = arith.constant dense<[1, 1, 1, 1]> : vector<4xi32> %0 = arith.remui %arg, %v : vector<4xi32> return %0 : vector<4xi32> @@ -1348,7 +1348,7 @@ // CHECK-LABEL: @test_remsi( // CHECK: %[[res:.+]] = arith.constant dense<[0, 0, 4, 2]> : vector<4xi32> // CHECK: return %[[res]] -func @test_remsi() -> (vector<4xi32>) { +func.func @test_remsi() -> (vector<4xi32>) { %v1 = arith.constant dense<[9, 9, 9, 9]> : vector<4xi32> %v2 = arith.constant dense<[1, 3, 5, 7]> : vector<4xi32> %0 = arith.remsi %v1, %v2 : vector<4xi32> @@ -1360,7 +1360,7 @@ // CHECK-LABEL: @test_remsi_1( // CHECK: %[[res:.+]] = arith.constant dense<0> : vector<4xi32> // CHECK: return %[[res]] -func @test_remsi_1(%arg : vector<4xi32>) -> (vector<4xi32>) { +func.func @test_remsi_1(%arg : vector<4xi32>) -> (vector<4xi32>) { %v = arith.constant dense<[1, 1, 1, 1]> : vector<4xi32> %0 = arith.remsi %arg, %v : vector<4xi32> return %0 : vector<4xi32> diff --git a/mlir/test/Dialect/Bufferization/Transforms/one-shot-module-bufferize-analysis.mlir b/mlir/test/Dialect/Bufferization/Transforms/one-shot-module-bufferize-analysis.mlir --- a/mlir/test/Dialect/Bufferization/Transforms/one-shot-module-bufferize-analysis.mlir +++ b/mlir/test/Dialect/Bufferization/Transforms/one-shot-module-bufferize-analysis.mlir @@ -672,7 +672,7 @@ // ----- -func @matmul_on_tensors( +func.func @matmul_on_tensors( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) @@ -710,7 +710,7 @@ // ----- -func @matmul_on_tensors( +func.func @matmul_on_tensors( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) diff --git a/mlir/test/Dialect/GPU/ops.mlir b/mlir/test/Dialect/GPU/ops.mlir --- a/mlir/test/Dialect/GPU/ops.mlir +++ b/mlir/test/Dialect/GPU/ops.mlir @@ -31,7 +31,7 @@ } // CHECK-LABEL:func @launch_async(%{{.*}}: index, %{{.*}}: index) { - func @launch_async(%blk : index, %thrd : index) { + func.func @launch_async(%blk : index, %thrd : index) { // CHECK: gpu.launch async [%{{.+}}] blocks(%{{.*}}, %{{.*}}, %{{.*}}) in (%{{.*}} = %{{.*}}, %{{.*}} = %{{.*}}, %{{.*}} = %{{.*}}) threads(%{{.*}}, %{{.*}}, %{{.*}}) in (%{{.*}} = %{{.*}}, %{{.*}} = %{{.*}}, %{{.*}} = %{{.*}}) %t = gpu.wait async %name = gpu.launch async [%t] blocks(%arg0, %arg1, %arg2) in (%grid_x = %blk, %grid_y = %blk, %grid_z = %blk) @@ -42,7 +42,7 @@ } // CHECK-LABEL:func @launch_async_no_deps(%{{.*}}: index, %{{.*}}: index) { - func @launch_async_no_deps(%blk : index, %thrd : index) { + func.func @launch_async_no_deps(%blk : index, %thrd : index) { // CHECK: %{{.*}} = gpu.launch async blocks(%{{.*}}, %{{.*}}, %{{.*}}) in (%{{.*}} = %{{.*}}, %{{.*}} = %{{.*}}, %{{.*}} = %{{.*}}) threads(%{{.*}}, %{{.*}}, %{{.*}}) in (%{{.*}} = %{{.*}}, %{{.*}} = %{{.*}}, %{{.*}} = %{{.*}}) %t0 = gpu.launch async blocks(%arg0, %arg1, %arg2) in (%grid_x = %blk, %grid_y = %blk, %grid_z = %blk) threads(%arg3, %arg4, %arg5) in (%block_x = %thrd, %block_y = %thrd, %block_z = %thrd) { diff --git a/mlir/test/Dialect/Linalg/bubble-up-extract-slice-op.mlir b/mlir/test/Dialect/Linalg/bubble-up-extract-slice-op.mlir --- a/mlir/test/Dialect/Linalg/bubble-up-extract-slice-op.mlir +++ b/mlir/test/Dialect/Linalg/bubble-up-extract-slice-op.mlir @@ -160,7 +160,7 @@ //----- // The slice is not supposed to be bubbled up when it is rank-reducing. -func @rank_reducing_slice(%width : index) -> tensor<1x1x1x?xf32> { +func.func @rank_reducing_slice(%width : index) -> tensor<1x1x1x?xf32> { %cst = arith.constant 1.000000e+00 : f32 %init = linalg.init_tensor [1, %width] : tensor<1x?xf32> %fill = linalg.fill ins(%cst : f32) outs(%init : tensor<1x?xf32>) -> tensor<1x?xf32> diff --git a/mlir/test/Dialect/Linalg/fusion-elementwise-ops.mlir b/mlir/test/Dialect/Linalg/fusion-elementwise-ops.mlir --- a/mlir/test/Dialect/Linalg/fusion-elementwise-ops.mlir +++ b/mlir/test/Dialect/Linalg/fusion-elementwise-ops.mlir @@ -658,14 +658,14 @@ iterator_types = ["parallel", "parallel"]} outs(%arg0 : tensor<1x8xf64>) { ^bb0(%a: f64): - %r = call @compute1(%a) : (f64) -> f64 + %r = func.call @compute1(%a) : (f64) -> f64 linalg.yield %r : f64 } -> tensor<1x8xf64> // CHECK-NEXT: %[[R:.*]] = linalg.generic // CHECK: bb0(%[[BBA:[0-9a-z]*]]: f64, %[[BBB:[0-9a-z]*]]: i32): - // CHECK-NEXT: %[[A:.*]] = call @compute1(%[[BBA]]) : (f64) -> f64 - // CHECK-NEXT: %[[B:.*]] = call @compute2(%[[A]], %[[BBB]]) : (f64, i32) -> i32 + // CHECK-NEXT: %[[A:.*]] = func.call @compute1(%[[BBA]]) : (f64) -> f64 + // CHECK-NEXT: %[[B:.*]] = func.call @compute2(%[[A]], %[[BBB]]) : (f64, i32) -> i32 // CHECK-NEXT: linalg.yield %[[B]] : i32 // CHECK-NEXT: } -> tensor<1x8xi32> %1 = linalg.generic { @@ -674,7 +674,7 @@ ins(%0 : tensor<1x8xf64>) outs(%arg1 : tensor<1x8xi32>) { ^bb0(%a: f64, %b: i32): - %r = call @compute2(%a, %b) : (f64, i32) -> i32 + %r = func.call @compute2(%a, %b) : (f64, i32) -> i32 linalg.yield %r : i32 } -> tensor<1x8xi32> diff --git a/mlir/test/Dialect/Linalg/transform-ops.mlir b/mlir/test/Dialect/Linalg/transform-ops.mlir --- a/mlir/test/Dialect/Linalg/transform-ops.mlir +++ b/mlir/test/Dialect/Linalg/transform-ops.mlir @@ -21,7 +21,7 @@ // CHECK-SAME: %[[TB:[0-9a-z]+]]: tensor<128x128xf32> // CHECK-SAME: %[[TC:[0-9a-z]+]]: tensor<128x128xf32> // CHECK-SAME: -> tensor<128x128xf32> { -func @tile_linalg_matmul( +func.func @tile_linalg_matmul( %arg0: tensor<128x128xf32>, %arg1: tensor<128x128xf32>, %arg2: tensor<128x128xf32>) -> tensor<128x128xf32> { // CHECK: %[[TD0:.*]] = scf.for {{.*}} to {{.*}} step {{.*}} iter_args(%[[TC0:.*]] = %[[TC]]) -> (tensor<128x128xf32>) { diff --git a/mlir/test/Dialect/OpenMP/invalid.mlir b/mlir/test/Dialect/OpenMP/invalid.mlir --- a/mlir/test/Dialect/OpenMP/invalid.mlir +++ b/mlir/test/Dialect/OpenMP/invalid.mlir @@ -708,7 +708,7 @@ // ----- -func @omp_atomic_update(%x: memref, %expr: i32) { +func.func @omp_atomic_update(%x: memref, %expr: i32) { // expected-error @below {{the hints omp_sync_hint_uncontended and omp_sync_hint_contended cannot be combined}} omp.atomic.update hint(uncontended, contended) %x : memref { ^bb0(%xval: i32): @@ -720,7 +720,7 @@ // ----- -func @omp_atomic_update(%x: memref, %expr: i32) { +func.func @omp_atomic_update(%x: memref, %expr: i32) { // expected-error @below {{the hints omp_sync_hint_nonspeculative and omp_sync_hint_speculative cannot be combined}} omp.atomic.update hint(nonspeculative, speculative) %x : memref { ^bb0(%xval: i32): @@ -732,7 +732,7 @@ // ----- -func @omp_atomic_update(%x: memref, %expr: i32) { +func.func @omp_atomic_update(%x: memref, %expr: i32) { // expected-error @below {{invalid_hint is not a valid hint}} omp.atomic.update hint(invalid_hint) %x : memref { ^bb0(%xval: i32): @@ -884,7 +884,7 @@ // ----- -func @omp_atomic_capture(%x: memref, %v: memref, %expr: i32) { +func.func @omp_atomic_capture(%x: memref, %v: memref, %expr: i32) { // expected-error @below {{the hints omp_sync_hint_uncontended and omp_sync_hint_contended cannot be combined}} omp.atomic.capture hint(contended, uncontended) { omp.atomic.update %x : memref { @@ -899,7 +899,7 @@ // ----- -func @omp_atomic_capture(%x: memref, %v: memref, %expr: i32) { +func.func @omp_atomic_capture(%x: memref, %v: memref, %expr: i32) { // expected-error @below {{the hints omp_sync_hint_nonspeculative and omp_sync_hint_speculative cannot be combined}} omp.atomic.capture hint(nonspeculative, speculative) { omp.atomic.update %x : memref { @@ -914,7 +914,7 @@ // ----- -func @omp_atomic_capture(%x: memref, %v: memref, %expr: i32) { +func.func @omp_atomic_capture(%x: memref, %v: memref, %expr: i32) { // expected-error @below {{invalid_hint is not a valid hint}} omp.atomic.capture hint(invalid_hint) { omp.atomic.update %x : memref { @@ -929,7 +929,7 @@ // ----- -func @omp_atomic_capture(%x: memref, %v: memref, %expr: i32) { +func.func @omp_atomic_capture(%x: memref, %v: memref, %expr: i32) { // expected-error @below {{operations inside capture region must not have hint clause}} omp.atomic.capture { omp.atomic.update hint(uncontended) %x : memref { @@ -1146,7 +1146,7 @@ // ----- -func @omp_cancel() { +func.func @omp_cancel() { omp.sections { // expected-error @below {{cancel parallel must appear inside a parallel region}} omp.cancel cancellation_construct_type(parallel) @@ -1158,7 +1158,7 @@ // ----- -func @omp_cancel1() { +func.func @omp_cancel1() { omp.parallel { // expected-error @below {{cancel sections must appear inside a sections region}} omp.cancel cancellation_construct_type(sections) @@ -1170,7 +1170,7 @@ // ----- -func @omp_cancel2() { +func.func @omp_cancel2() { omp.sections { // expected-error @below {{cancel loop must appear inside a worksharing-loop region}} omp.cancel cancellation_construct_type(loop) @@ -1182,7 +1182,7 @@ // ----- -func @omp_cancel3(%arg1 : i32, %arg2 : i32, %arg3 : i32) -> () { +func.func @omp_cancel3(%arg1 : i32, %arg2 : i32, %arg3 : i32) -> () { omp.wsloop nowait for (%0) : i32 = (%arg1) to (%arg2) step (%arg3) { // expected-error @below {{A worksharing construct that is canceled must not have a nowait clause}} @@ -1195,7 +1195,7 @@ // ----- -func @omp_cancel4(%arg1 : i32, %arg2 : i32, %arg3 : i32) -> () { +func.func @omp_cancel4(%arg1 : i32, %arg2 : i32, %arg3 : i32) -> () { omp.wsloop ordered(1) for (%0) : i32 = (%arg1) to (%arg2) step (%arg3) { // expected-error @below {{A worksharing construct that is canceled must not have an ordered clause}} @@ -1208,7 +1208,7 @@ // ----- -func @omp_cancel5() -> () { +func.func @omp_cancel5() -> () { omp.sections nowait { omp.section { // expected-error @below {{A sections construct that is canceled must not have a nowait clause}} @@ -1223,7 +1223,7 @@ // ----- -func @omp_cancellationpoint() { +func.func @omp_cancellationpoint() { omp.sections { // expected-error @below {{cancellation point parallel must appear inside a parallel region}} omp.cancellationpoint cancellation_construct_type(parallel) @@ -1235,7 +1235,7 @@ // ----- -func @omp_cancellationpoint1() { +func.func @omp_cancellationpoint1() { omp.parallel { // expected-error @below {{cancellation point sections must appear inside a sections region}} omp.cancellationpoint cancellation_construct_type(sections) @@ -1247,7 +1247,7 @@ // ----- -func @omp_cancellationpoint2() { +func.func @omp_cancellationpoint2() { omp.sections { // expected-error @below {{cancellation point loop must appear inside a worksharing-loop region}} omp.cancellationpoint cancellation_construct_type(loop) diff --git a/mlir/test/Dialect/OpenMP/ops.mlir b/mlir/test/Dialect/OpenMP/ops.mlir --- a/mlir/test/Dialect/OpenMP/ops.mlir +++ b/mlir/test/Dialect/OpenMP/ops.mlir @@ -1277,7 +1277,7 @@ llvm.mlir.global internal @_QFsubEx() : i32 -func @omp_cancel_parallel(%if_cond : i1) -> () { +func.func @omp_cancel_parallel(%if_cond : i1) -> () { // Test with optional operand; if_expr. omp.parallel { // CHECK: omp.cancel cancellation_construct_type(parallel) if(%{{.*}}) @@ -1288,7 +1288,7 @@ return } -func @omp_cancel_wsloop(%lb : index, %ub : index, %step : index) { +func.func @omp_cancel_wsloop(%lb : index, %ub : index, %step : index) { omp.wsloop for (%iv) : index = (%lb) to (%ub) step (%step) { // CHECK: omp.cancel cancellation_construct_type(loop) @@ -1299,7 +1299,7 @@ return } -func @omp_cancel_sections() -> () { +func.func @omp_cancel_sections() -> () { omp.sections { omp.section { // CHECK: omp.cancel cancellation_construct_type(sections) @@ -1312,7 +1312,7 @@ return } -func @omp_cancellationpoint_parallel() -> () { +func.func @omp_cancellationpoint_parallel() -> () { omp.parallel { // CHECK: omp.cancellationpoint cancellation_construct_type(parallel) omp.cancellationpoint cancellation_construct_type(parallel) @@ -1323,7 +1323,7 @@ return } -func @omp_cancellationpoint_wsloop(%lb : index, %ub : index, %step : index) { +func.func @omp_cancellationpoint_wsloop(%lb : index, %ub : index, %step : index) { omp.wsloop for (%iv) : index = (%lb) to (%ub) step (%step) { // CHECK: omp.cancellationpoint cancellation_construct_type(loop) @@ -1336,7 +1336,7 @@ return } -func @omp_cancellationpoint_sections() -> () { +func.func @omp_cancellationpoint_sections() -> () { omp.sections { omp.section { // CHECK: omp.cancellationpoint cancellation_construct_type(sections) diff --git a/mlir/test/Dialect/SCF/canonicalize.mlir b/mlir/test/Dialect/SCF/canonicalize.mlir --- a/mlir/test/Dialect/SCF/canonicalize.mlir +++ b/mlir/test/Dialect/SCF/canonicalize.mlir @@ -137,7 +137,7 @@ func.func private @side_effect() func.func @one_unused(%cond: i1) -> (index) { %0, %1 = scf.if %cond -> (index, index) { - call @side_effect() : () -> () + func.call @side_effect() : () -> () %c0 = "test.value0"() : () -> (index) %c1 = "test.value1"() : () -> (index) scf.yield %c0, %c1 : index, index @@ -166,7 +166,7 @@ func.func @nested_unused(%cond1: i1, %cond2: i1) -> (index) { %0, %1 = scf.if %cond1 -> (index, index) { %2, %3 = scf.if %cond2 -> (index, index) { - call @side_effect() : () -> () + func.call @side_effect() : () -> () %c0 = "test.value0"() : () -> (index) %c1 = "test.value1"() : () -> (index) scf.yield %c0, %c1 : index, index @@ -208,10 +208,10 @@ %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0, %1 = scf.if %cond -> (index, index) { - call @side_effect() : () -> () + func.call @side_effect() : () -> () scf.yield %c0, %c1 : index, index } else { - call @side_effect() : () -> () + func.call @side_effect() : () -> () scf.yield %c0, %c1 : index, index } return @@ -370,7 +370,7 @@ %a = call @make_i32() : () -> (i32) %b = call @make_i32() : () -> (i32) %r:3 = scf.for %i = %lb to %ub step %step iter_args(%0 = %a, %1 = %a, %2 = %b) -> (i32, i32, i32) { - %c = call @make_i32() : () -> (i32) + %c = func.call @make_i32() : () -> (i32) scf.yield %0, %c, %2 : i32, i32, i32 } return %r#0, %r#1, %r#2 : i32, i32, i32 @@ -380,7 +380,7 @@ // CHECK-NEXT: %[[a:.*]] = call @make_i32() : () -> i32 // CHECK-NEXT: %[[b:.*]] = call @make_i32() : () -> i32 // CHECK-NEXT: %[[r1:.*]] = scf.for {{.*}} iter_args(%arg4 = %[[a]]) -> (i32) { -// CHECK-NEXT: %[[c:.*]] = call @make_i32() : () -> i32 +// CHECK-NEXT: %[[c:.*]] = func.call @make_i32() : () -> i32 // CHECK-NEXT: scf.yield %[[c]] : i32 // CHECK-NEXT: } // CHECK-NEXT: return %[[a]], %[[r1]], %[[b]] : i32, i32, i32 @@ -765,15 +765,15 @@ %m1 = bufferization.to_memref %arg2 : memref<128x128xf32> // CHECK-NEXT: call @process(%[[M0]]) : (memref<128x128xf32>) -> () - call @process(%m0) : (memref<128x128xf32>) -> () + func.call @process(%m0) : (memref<128x128xf32>) -> () // CHECK-NEXT: call @process(%[[M1]]) : (memref<128x128xf32>) -> () - call @process(%m1) : (memref<128x128xf32>) -> () + func.call @process(%m1) : (memref<128x128xf32>) -> () // This does not hoist (fails the bbArg has at most a single check). - // CHECK-NEXT: %[[T:.*]] = call @process_tensor(%[[BBARG_T2]]) : (tensor<128x128xf32>) -> memref<128x128xf32> + // CHECK-NEXT: %[[T:.*]] = func.call @process_tensor(%[[BBARG_T2]]) : (tensor<128x128xf32>) -> memref<128x128xf32> // CHECK-NEXT: %[[YIELD_T:.*]] = bufferization.to_tensor %[[T:.*]] - %m2 = call @process_tensor(%arg3): (tensor<128x128xf32>) -> memref<128x128xf32> + %m2 = func.call @process_tensor(%arg3): (tensor<128x128xf32>) -> memref<128x128xf32> %3 = bufferization.to_tensor %m2 : memref<128x128xf32> // All this stuff goes away, incrementally @@ -843,12 +843,12 @@ // CHECK-NOT: tensor.cast // CHECK: %[[FOR_RES:.*]] = scf.for {{.*}} iter_args(%[[ITER_T0:.*]] = %[[T0]]) -> (tensor<32x1024xf32>) { // CHECK: %[[CAST:.*]] = tensor.cast %[[ITER_T0]] : tensor<32x1024xf32> to tensor -// CHECK: %[[DONE:.*]] = call @do(%[[CAST]]) : (tensor) -> tensor +// CHECK: %[[DONE:.*]] = func.call @do(%[[CAST]]) : (tensor) -> tensor // CHECK: %[[UNCAST:.*]] = tensor.cast %[[DONE]] : tensor to tensor<32x1024xf32> // CHECK: scf.yield %[[UNCAST]] : tensor<32x1024xf32> %0 = tensor.cast %t0 : tensor<32x1024xf32> to tensor %1 = scf.for %i = %c0 to %c1024 step %c32 iter_args(%iter_t0 = %0) -> (tensor) { - %2 = call @do(%iter_t0) : (tensor) -> tensor + %2 = func.call @do(%iter_t0) : (tensor) -> tensor scf.yield %2 : tensor } // CHECK-NOT: tensor.cast diff --git a/mlir/test/Dialect/SparseTensor/conversion_sparse2dense.mlir b/mlir/test/Dialect/SparseTensor/conversion_sparse2dense.mlir --- a/mlir/test/Dialect/SparseTensor/conversion_sparse2dense.mlir +++ b/mlir/test/Dialect/SparseTensor/conversion_sparse2dense.mlir @@ -37,7 +37,7 @@ // CHECK-DAG: %[[M:.*]] = memref.alloc() : memref<13xi32> // CHECK-DAG: linalg.fill ins(%[[zeroI32]] : i32) outs(%[[M]] : memref<13xi32>) // CHECK: scf.while : () -> () { -// CHECK: %[[Cond:.*]] = call @getNextI32(%[[Iter]], %[[IndD]], %[[ElemBuffer]]) : (!llvm.ptr, memref, memref) -> i1 +// CHECK: %[[Cond:.*]] = func.call @getNextI32(%[[Iter]], %[[IndD]], %[[ElemBuffer]]) : (!llvm.ptr, memref, memref) -> i1 // CHECK: scf.condition(%[[Cond]]) // CHECK: } do { // CHECK: %[[Iv0:.*]] = memref.load %[[IndS]][%[[I0]]] : memref<1xindex> @@ -76,7 +76,7 @@ // CHECK-DAG: %[[M:.*]] = memref.alloc(%[[SizeI0]]) : memref // CHECK-DAG: linalg.fill ins(%[[zeroI32]] : i32) outs(%[[M]] : memref) // CHECK: scf.while : () -> () { -// CHECK: %[[Cond:.*]] = call @getNextI32(%[[Iter]], %[[IndD]], %[[ElemBuffer]]) : (!llvm.ptr, memref, memref) -> i1 +// CHECK: %[[Cond:.*]] = func.call @getNextI32(%[[Iter]], %[[IndD]], %[[ElemBuffer]]) : (!llvm.ptr, memref, memref) -> i1 // CHECK: scf.condition(%[[Cond]]) // CHECK: } do { // CHECK: %[[Iv0:.*]] = memref.load %[[IndS]][%[[I0]]] : memref<1xindex> @@ -119,7 +119,7 @@ // CHECK-DAG: %[[E0:.*]] = arith.constant 0.000000e+00 : f64 // CHECK-DAG: linalg.fill ins(%[[E0]] : f64) outs(%[[M]] : memref<2x4xf64>) // CHECK: scf.while : () -> () { -// CHECK: %[[Cond:.*]] = call @getNextF64(%[[Iter]], %[[IndD]], %[[ElemBuffer]]) : (!llvm.ptr, memref, memref) -> i1 +// CHECK: %[[Cond:.*]] = func.call @getNextF64(%[[Iter]], %[[IndD]], %[[ElemBuffer]]) : (!llvm.ptr, memref, memref) -> i1 // CHECK: scf.condition(%[[Cond]]) // CHECK: } do { // CHECK: %[[Iv0:.*]] = memref.load %[[IndS]][%[[I0]]] : memref<2xindex> @@ -163,7 +163,7 @@ // CHECK-DAG: %[[E0:.*]] = arith.constant 0.000000e+00 : f64 // CHECK-DAG: linalg.fill ins(%[[E0]] : f64) outs(%[[M]] : memref) // CHECK: scf.while : () -> () { -// CHECK: %[[Cond:.*]] = call @getNextF64(%[[Iter]], %[[IndD]], %[[ElemBuffer]]) : (!llvm.ptr, memref, memref) -> i1 +// CHECK: %[[Cond:.*]] = func.call @getNextF64(%[[Iter]], %[[IndD]], %[[ElemBuffer]]) : (!llvm.ptr, memref, memref) -> i1 // CHECK: scf.condition(%[[Cond]]) // CHECK: } do { // CHECK: %[[Iv0:.*]] = memref.load %[[IndS]][%[[I0]]] : memref<2xindex> @@ -207,7 +207,7 @@ // CHECK-DAG: %[[E0:.*]] = arith.constant 0.000000e+00 : f64 // CHECK-DAG: linalg.fill ins(%[[E0]] : f64) outs(%[[M]] : memref<2x?xf64>) // CHECK: scf.while : () -> () { -// CHECK: %[[Cond:.*]] = call @getNextF64(%[[Iter]], %[[IndD]], %[[ElemBuffer]]) : (!llvm.ptr, memref, memref) -> i1 +// CHECK: %[[Cond:.*]] = func.call @getNextF64(%[[Iter]], %[[IndD]], %[[ElemBuffer]]) : (!llvm.ptr, memref, memref) -> i1 // CHECK: scf.condition(%[[Cond]]) // CHECK: } do { // CHECK: %[[Iv0:.*]] = memref.load %[[IndS]][%[[I0]]] : memref<2xindex> @@ -251,7 +251,7 @@ // CHECK-DAG: %[[E0:.*]] = arith.constant 0.000000e+00 : f64 // CHECK-DAG: linalg.fill ins(%[[E0]] : f64) outs(%[[M]] : memref) // CHECK: scf.while : () -> () { -// CHECK: %[[Cond:.*]] = call @getNextF64(%[[Iter]], %[[IndD]], %[[ElemBuffer]]) : (!llvm.ptr, memref, memref) -> i1 +// CHECK: %[[Cond:.*]] = func.call @getNextF64(%[[Iter]], %[[IndD]], %[[ElemBuffer]]) : (!llvm.ptr, memref, memref) -> i1 // CHECK: scf.condition(%[[Cond]]) // CHECK: } do { // CHECK: %[[Iv0:.*]] = memref.load %[[IndS]][%[[I0]]] : memref<2xindex> @@ -299,7 +299,7 @@ // CHECK-DAG: %[[E0:.*]] = arith.constant 0.000000e+00 : f64 // CHECK-DAG: linalg.fill ins(%[[E0]] : f64) outs(%[[M]] : memref<2x3x4xf64>) // CHECK: scf.while : () -> () { -// CHECK: %[[Cond:.*]] = call @getNextF64(%[[Iter]], %[[IndD]], %[[ElemBuffer]]) : (!llvm.ptr, memref, memref) -> i1 +// CHECK: %[[Cond:.*]] = func.call @getNextF64(%[[Iter]], %[[IndD]], %[[ElemBuffer]]) : (!llvm.ptr, memref, memref) -> i1 // CHECK: scf.condition(%[[Cond]]) // CHECK: } do { // CHECK: %[[Iv0:.*]] = memref.load %[[IndS]][%[[I0]]] : memref<3xindex> diff --git a/mlir/test/Dialect/Vector/canonicalize.mlir b/mlir/test/Dialect/Vector/canonicalize.mlir --- a/mlir/test/Dialect/Vector/canonicalize.mlir +++ b/mlir/test/Dialect/Vector/canonicalize.mlir @@ -638,7 +638,7 @@ // CHECK-LABEL: func @fold_broadcast_shapecast // CHECK-SAME: (%[[V:.+]]: vector<4xf32>) // CHECK: return %[[V]] -func @fold_broadcast_shapecast(%arg0: vector<4xf32>) -> vector<4xf32> { +func.func @fold_broadcast_shapecast(%arg0: vector<4xf32>) -> vector<4xf32> { %0 = vector.broadcast %arg0 : vector<4xf32> to vector<1x1x4xf32> %1 = vector.shape_cast %0 : vector<1x1x4xf32> to vector<4xf32> return %1 : vector<4xf32> @@ -649,7 +649,7 @@ // CHECK-LABEL: func @dont_fold_broadcast_shapecast_scalar // CHECK: vector.broadcast // CHECK: vector.shape_cast -func @dont_fold_broadcast_shapecast_scalar(%arg0: f32) -> vector<1xf32> { +func.func @dont_fold_broadcast_shapecast_scalar(%arg0: f32) -> vector<1xf32> { %0 = vector.broadcast %arg0 : f32 to vector<1x1x1xf32> %1 = vector.shape_cast %0 : vector<1x1x1xf32> to vector<1xf32> return %1 : vector<1xf32> @@ -660,7 +660,7 @@ // CHECK-LABEL: func @dont_fold_broadcast_shapecast_diff_shape // CHECK: vector.broadcast // CHECK: vector.shape_cast -func @dont_fold_broadcast_shapecast_diff_shape(%arg0: vector<4xf32>) -> vector<8xf32> { +func.func @dont_fold_broadcast_shapecast_diff_shape(%arg0: vector<4xf32>) -> vector<8xf32> { %0 = vector.broadcast %arg0 : vector<4xf32> to vector<1x2x4xf32> %1 = vector.shape_cast %0 : vector<1x2x4xf32> to vector<8xf32> return %1 : vector<8xf32> @@ -1568,7 +1568,7 @@ // CHECK-SAME: (%[[V:.+]]: vector<1xf32>) // CHECK: %[[S:.+]] = vector.extract %[[V]][0] : vector<1xf32> // CHECK: return %[[S]] : f32 -func @reduce_one_element_vector_extract(%a : vector<1xf32>) -> f32 { +func.func @reduce_one_element_vector_extract(%a : vector<1xf32>) -> f32 { %s = vector.reduction , %a : vector<1xf32> into f32 return %s : f32 } @@ -1580,7 +1580,7 @@ // CHECK: %[[A:.+]] = vector.extract %[[V]][0] : vector<1xf32> // CHECK: %[[S:.+]] = arith.addf %[[A]], %arg1 : f32 // CHECK: return %[[S]] -func @reduce_one_element_vector_addf(%a : vector<1xf32>, %b: f32) -> f32 { +func.func @reduce_one_element_vector_addf(%a : vector<1xf32>, %b: f32) -> f32 { %s = vector.reduction , %a, %b : vector<1xf32> into f32 return %s : f32 } @@ -1592,7 +1592,7 @@ // CHECK: %[[A:.+]] = vector.extract %[[V]][0] : vector<1xf32> // CHECK: %[[S:.+]] = arith.mulf %[[A]], %arg1 : f32 // CHECK: return %[[S]] -func @reduce_one_element_vector_mulf(%a : vector<1xf32>, %b: f32) -> f32 { +func.func @reduce_one_element_vector_mulf(%a : vector<1xf32>, %b: f32) -> f32 { %s = vector.reduction , %a, %b : vector<1xf32> into f32 return %s : f32 } @@ -1601,7 +1601,7 @@ // CHECK-LABEL: func @dont_reduce_one_element_vector // CHECK: vector.reduction -func @dont_reduce_one_element_vector(%a : vector<4xf32>) -> f32 { +func.func @dont_reduce_one_element_vector(%a : vector<4xf32>) -> f32 { %s = vector.reduction , %a : vector<4xf32> into f32 return %s : f32 } diff --git a/mlir/test/IR/attribute-roundtrip.mlir b/mlir/test/IR/attribute-roundtrip.mlir --- a/mlir/test/IR/attribute-roundtrip.mlir +++ b/mlir/test/IR/attribute-roundtrip.mlir @@ -1,7 +1,7 @@ // RUN: mlir-opt -canonicalize %s | mlir-opt | FileCheck %s // CHECK-LABEL: @large_i1_tensor_roundtrip -func @large_i1_tensor_roundtrip() -> tensor<160xi1> { +func.func @large_i1_tensor_roundtrip() -> tensor<160xi1> { %cst_0 = arith.constant dense<"0xFFF00000FF000000FF000000FF000000FF000000"> : tensor<160xi1> %cst_1 = arith.constant dense<"0xFF000000FF000000FF000000FF000000FF0000F0"> : tensor<160xi1> // CHECK: dense<"0xFF000000FF000000FF000000FF000000FF000000"> diff --git a/mlir/test/IR/attribute.mlir b/mlir/test/IR/attribute.mlir --- a/mlir/test/IR/attribute.mlir +++ b/mlir/test/IR/attribute.mlir @@ -412,7 +412,7 @@ //===----------------------------------------------------------------------===// // CHECK-LABEL: func @allowed_cases_pass -func @allowed_cases_pass() { +func.func @allowed_cases_pass() { // CHECK: test.op_with_bit_enum "test.op_with_bit_enum"() {value = #test.bit_enum} : () -> () // CHECK: test.op_with_bit_enum @@ -423,7 +423,7 @@ // ----- // CHECK-LABEL: func @allowed_cases_pass -func @allowed_cases_pass() { +func.func @allowed_cases_pass() { // CHECK: test.op_with_bit_enum_vbar "test.op_with_bit_enum_vbar"() { value = #test.bit_enum_vbar @@ -435,7 +435,7 @@ // ----- -func @disallowed_case_sticky_fail() { +func.func @disallowed_case_sticky_fail() { // expected-error@+2 {{expected test::TestBitEnum to be one of: read, write, execute}} // expected-error@+1 {{failed to parse TestBitEnumAttr}} "test.op_with_bit_enum"() {value = #test.bit_enum} : () -> () diff --git a/mlir/test/IR/dynamic.mlir b/mlir/test/IR/dynamic.mlir --- a/mlir/test/IR/dynamic.mlir +++ b/mlir/test/IR/dynamic.mlir @@ -6,7 +6,7 @@ //===----------------------------------------------------------------------===// // CHECK-LABEL: func @succeededDynamicTypeVerifier -func @succeededDynamicTypeVerifier() { +func.func @succeededDynamicTypeVerifier() { // CHECK: %{{.*}} = "unregistered_op"() : () -> !test.dynamic_singleton "unregistered_op"() : () -> !test.dynamic_singleton // CHECK-NEXT: "unregistered_op"() : () -> !test.dynamic_pair @@ -18,7 +18,7 @@ // ----- -func @failedDynamicTypeVerifier() { +func.func @failedDynamicTypeVerifier() { // expected-error@+1 {{expected 0 type arguments, but had 1}} "unregistered_op"() : () -> !test.dynamic_singleton return @@ -26,7 +26,7 @@ // ----- -func @failedDynamicTypeVerifier2() { +func.func @failedDynamicTypeVerifier2() { // expected-error@+1 {{expected 2 type arguments, but had 1}} "unregistered_op"() : () -> !test.dynamic_pair return @@ -35,7 +35,7 @@ // ----- // CHECK-LABEL: func @customTypeParserPrinter -func @customTypeParserPrinter() { +func.func @customTypeParserPrinter() { // CHECK: "unregistered_op"() : () -> !test.dynamic_custom_assembly_format "unregistered_op"() : () -> !test.dynamic_custom_assembly_format return @@ -48,7 +48,7 @@ //===----------------------------------------------------------------------===// // CHECK-LABEL: func @succeededDynamicAttributeVerifier -func @succeededDynamicAttributeVerifier() { +func.func @succeededDynamicAttributeVerifier() { // CHECK: "unregistered_op"() {test_attr = #test.dynamic_singleton} : () -> () "unregistered_op"() {test_attr = #test.dynamic_singleton} : () -> () // CHECK-NEXT: "unregistered_op"() {test_attr = #test.dynamic_pair<3 : i32, 5 : i32>} : () -> () @@ -60,7 +60,7 @@ // ----- -func @failedDynamicAttributeVerifier() { +func.func @failedDynamicAttributeVerifier() { // expected-error@+1 {{expected 0 attribute arguments, but had 1}} "unregistered_op"() {test_attr = #test.dynamic_singleton} : () -> () return @@ -68,7 +68,7 @@ // ----- -func @failedDynamicAttributeVerifier2() { +func.func @failedDynamicAttributeVerifier2() { // expected-error@+1 {{expected 2 attribute arguments, but had 1}} "unregistered_op"() {test_attr = #test.dynamic_pair} : () -> () return @@ -77,7 +77,7 @@ // ----- // CHECK-LABEL: func @customAttributeParserPrinter -func @customAttributeParserPrinter() { +func.func @customAttributeParserPrinter() { // CHECK: "unregistered_op"() {test_attr = #test.dynamic_custom_assembly_format} : () -> () "unregistered_op"() {test_attr = #test.dynamic_custom_assembly_format} : () -> () return @@ -90,7 +90,7 @@ // ----- // CHECK-LABEL: func @succeededDynamicOpVerifier -func @succeededDynamicOpVerifier(%a: f32) { +func.func @succeededDynamicOpVerifier(%a: f32) { // CHECK: "test.dynamic_generic"() : () -> () // CHECK-NEXT: %{{.*}} = "test.dynamic_generic"(%{{.*}}) : (f32) -> f64 // CHECK-NEXT: %{{.*}}:2 = "test.dynamic_one_operand_two_results"(%{{.*}}) : (f32) -> (f64, f64) @@ -102,7 +102,7 @@ // ----- -func @failedDynamicOpVerifier() { +func.func @failedDynamicOpVerifier() { // expected-error@+1 {{expected 1 operand, but had 0}} "test.dynamic_one_operand_two_results"() : () -> (f64, f64) return @@ -110,7 +110,7 @@ // ----- -func @failedDynamicOpVerifier2(%a: f32) { +func.func @failedDynamicOpVerifier2(%a: f32) { // expected-error@+1 {{expected 2 results, but had 0}} "test.dynamic_one_operand_two_results"(%a) : (f32) -> () return @@ -119,7 +119,7 @@ // ----- // CHECK-LABEL: func @customOpParserPrinter -func @customOpParserPrinter() { +func.func @customOpParserPrinter() { // CHECK: test.dynamic_custom_parser_printer custom_keyword test.dynamic_custom_parser_printer custom_keyword return diff --git a/mlir/test/IR/invalid.mlir b/mlir/test/IR/invalid.mlir --- a/mlir/test/IR/invalid.mlir +++ b/mlir/test/IR/invalid.mlir @@ -826,7 +826,7 @@ func.func @f(f32) { ^bb0(%a : f32): %18 = arith.cmpi slt, %idx, %idx : index - tensor<42 x index // expected-error {{custom op 'tensor' is unknown}} + tensor<42 x index // expected-error {{custom op 'func.tensor' is unknown}} return } diff --git a/mlir/test/IR/print-value-users.mlir b/mlir/test/IR/print-value-users.mlir --- a/mlir/test/IR/print-value-users.mlir +++ b/mlir/test/IR/print-value-users.mlir @@ -2,7 +2,7 @@ module { // CHECK: %[[ARG0:.+]]: i32, %[[ARG1:.+]]: i32, %[[ARG2:.+]]: i32 - func @foo(%arg0: i32, %arg1: i32, %arg3: i32) -> i32 { + func.func @foo(%arg0: i32, %arg1: i32, %arg3: i32) -> i32 { // CHECK-NEXT: // %[[ARG0]] is used by %[[ARG0U1:.+]], %[[ARG0U2:.+]], %[[ARG0U3:.+]] // CHECK-NEXT: // %[[ARG1]] is used by %[[ARG1U1:.+]], %[[ARG1U2:.+]] // CHECK-NEXT: // %[[ARG2]] is unused diff --git a/mlir/test/IR/test-take-body.mlir b/mlir/test/IR/test-take-body.mlir --- a/mlir/test/IR/test-take-body.mlir +++ b/mlir/test/IR/test-take-body.mlir @@ -1,6 +1,6 @@ // RUN: mlir-opt -allow-unregistered-dialect %s --test-take-body -split-input-file -func @foo() { +func.func @foo() { %0 = "test.foo"() : () -> i32 cf.br ^header @@ -12,7 +12,7 @@ cf.br ^header } -func private @bar() { +func.func private @bar() { return } diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_binary.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_binary.mlir --- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_binary.mlir +++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_binary.mlir @@ -38,8 +38,8 @@ module { // Creates a new sparse vector using the minimum values from two input sparse vectors. // When there is no overlap, include the present value in the output. - func @vector_min(%arga: tensor, - %argb: tensor) -> tensor { + func.func @vector_min(%arga: tensor, + %argb: tensor) -> tensor { %c = arith.constant 0 : index %d = tensor.dim %arga, %c : tensor %xv = sparse_tensor.init [%d] : tensor @@ -63,8 +63,8 @@ // Creates a new sparse vector by multiplying a sparse vector with a dense vector. // When there is no overlap, leave the result empty. - func @vector_mul(%arga: tensor, - %argb: tensor) -> tensor { + func.func @vector_mul(%arga: tensor, + %argb: tensor) -> tensor { %c = arith.constant 0 : index %d = tensor.dim %arga, %c : tensor %xv = sparse_tensor.init [%d] : tensor @@ -87,8 +87,8 @@ // Take a set difference of two sparse vectors. The result will include only those // sparse elements present in the first, but not the second vector. - func @vector_setdiff(%arga: tensor, - %argb: tensor) -> tensor { + func.func @vector_setdiff(%arga: tensor, + %argb: tensor) -> tensor { %c = arith.constant 0 : index %d = tensor.dim %arga, %c : tensor %xv = sparse_tensor.init [%d] : tensor @@ -106,7 +106,7 @@ } // Return the index of each entry - func @vector_index(%arga: tensor) -> tensor { + func.func @vector_index(%arga: tensor) -> tensor { %c = arith.constant 0 : index %d = tensor.dim %arga, %c : tensor %xv = sparse_tensor.init [%d] : tensor @@ -130,8 +130,8 @@ // Adds two sparse matrices when they intersect. Where they don't intersect, // negate the 2nd argument's values; ignore 1st argument-only values. - func @matrix_intersect(%arga: tensor, - %argb: tensor) -> tensor { + func.func @matrix_intersect(%arga: tensor, + %argb: tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %d0 = tensor.dim %arga, %c0 : tensor @@ -159,7 +159,7 @@ } // Dumps a sparse vector of type f64. - func @dump_vec(%arg0: tensor) { + func.func @dump_vec(%arg0: tensor) { // Dump the values array to verify only sparse contents are stored. %c0 = arith.constant 0 : index %d0 = arith.constant -1.0 : f64 @@ -176,7 +176,7 @@ } // Dumps a sparse vector of type i32. - func @dump_vec_i32(%arg0: tensor) { + func.func @dump_vec_i32(%arg0: tensor) { // Dump the values array to verify only sparse contents are stored. %c0 = arith.constant 0 : index %d0 = arith.constant -1 : i32 @@ -193,7 +193,7 @@ } // Dump a sparse matrix. - func @dump_mat(%arg0: tensor) { + func.func @dump_mat(%arg0: tensor) { %d0 = arith.constant 0.0 : f64 %c0 = arith.constant 0 : index %dm = sparse_tensor.convert %arg0 : tensor to tensor @@ -205,7 +205,7 @@ } // Driver method to call and verify vector kernels. - func @entry() { + func.func @entry() { %c0 = arith.constant 0 : index // Setup sparse vectors. diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_tanh.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_tanh.mlir --- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_tanh.mlir +++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_tanh.mlir @@ -16,7 +16,7 @@ module { // Performs zero-preserving math to sparse vector. - func @sparse_tanh(%vec: tensor + func.func @sparse_tanh(%vec: tensor {linalg.inplaceable = true}) -> tensor { %0 = linalg.generic #trait_op @@ -29,7 +29,7 @@ } // Dumps a sparse vector of type f64. - func @dump_vec_f64(%arg0: tensor) { + func.func @dump_vec_f64(%arg0: tensor) { // Dump the values array to verify only sparse contents are stored. %c0 = arith.constant 0 : index %d0 = arith.constant -1.0 : f64 @@ -48,7 +48,7 @@ } // Driver method to call and verify vector kernels. - func @entry() { + func.func @entry() { // Setup sparse vector. %v1 = arith.constant sparse< [ [0], [3], [11], [17], [20], [21], [28], [29], [31] ], diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_unary.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_unary.mlir --- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_unary.mlir +++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_unary.mlir @@ -28,7 +28,7 @@ module { // Invert the structure of a sparse vector. Present values become missing. // Missing values are filled with 1 (i32). - func @vector_complement(%arga: tensor) -> tensor { + func.func @vector_complement(%arga: tensor) -> tensor { %c = arith.constant 0 : index %ci1 = arith.constant 1 : i32 %d = tensor.dim %arga, %c : tensor @@ -48,7 +48,7 @@ } // Negate existing values. Fill missing ones with +1. - func @vector_negation(%arga: tensor) -> tensor { + func.func @vector_negation(%arga: tensor) -> tensor { %c = arith.constant 0 : index %cf1 = arith.constant 1.0 : f64 %d = tensor.dim %arga, %c : tensor @@ -72,7 +72,7 @@ } // Clips values to the range [3, 7]. - func @matrix_clip(%argx: tensor) -> tensor { + func.func @matrix_clip(%argx: tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cfmin = arith.constant 3.0 : f64 @@ -100,7 +100,7 @@ } // Dumps a sparse vector of type f64. - func @dump_vec_f64(%arg0: tensor) { + func.func @dump_vec_f64(%arg0: tensor) { // Dump the values array to verify only sparse contents are stored. %c0 = arith.constant 0 : index %d0 = arith.constant -1.0 : f64 @@ -117,7 +117,7 @@ } // Dumps a sparse vector of type i32. - func @dump_vec_i32(%arg0: tensor) { + func.func @dump_vec_i32(%arg0: tensor) { // Dump the values array to verify only sparse contents are stored. %c0 = arith.constant 0 : index %d0 = arith.constant -1 : i32 @@ -134,7 +134,7 @@ } // Dump a sparse matrix. - func @dump_mat(%arg0: tensor) { + func.func @dump_mat(%arg0: tensor) { %c0 = arith.constant 0 : index %d0 = arith.constant -1.0 : f64 %0 = sparse_tensor.values %arg0 : tensor to memref @@ -149,7 +149,7 @@ } // Driver method to call and verify vector kernels. - func @entry() { + func.func @entry() { %c0 = arith.constant 0 : index // Setup sparse vectors. diff --git a/mlir/test/Transforms/scf-if-utils.mlir b/mlir/test/Transforms/scf-if-utils.mlir --- a/mlir/test/Transforms/scf-if-utils.mlir +++ b/mlir/test/Transforms/scf-if-utils.mlir @@ -11,10 +11,10 @@ // CHECK-NEXT: } // CHECK: func @outline_if_else( // CHECK-NEXT: %{{.*}} = scf.if %{{.*}} -> (i8) { -// CHECK-NEXT: %{{.*}} = call @outlined_then0(%{{.*}}, %{{.*}}) : (i1, memref) -> i8 +// CHECK-NEXT: %{{.*}} = func.call @outlined_then0(%{{.*}}, %{{.*}}) : (i1, memref) -> i8 // CHECK-NEXT: scf.yield %{{.*}} : i8 // CHECK-NEXT: } else { -// CHECK-NEXT: %{{.*}} = call @outlined_else0(%{{.*}}) : (i8) -> i8 +// CHECK-NEXT: %{{.*}} = func.call @outlined_else0(%{{.*}}) : (i8) -> i8 // CHECK-NEXT: scf.yield %{{.*}} : i8 // CHECK-NEXT: } // CHECK-NEXT: return @@ -37,7 +37,7 @@ // CHECK-NEXT: } // CHECK: func @outline_if( // CHECK-NEXT: scf.if %{{.*}} { -// CHECK-NEXT: call @outlined_then0(%{{.*}}, %{{.*}}) : (i1, memref) -> () +// CHECK-NEXT: func.call @outlined_then0(%{{.*}}, %{{.*}}) : (i1, memref) -> () // CHECK-NEXT: } // CHECK-NEXT: return // CHECK-NEXT: } @@ -60,9 +60,9 @@ // CHECK-NEXT: } // CHECK: func @outline_empty_if_else( // CHECK-NEXT: scf.if %{{.*}} { -// CHECK-NEXT: call @outlined_then0() : () -> () +// CHECK-NEXT: func.call @outlined_then0() : () -> () // CHECK-NEXT: } else { -// CHECK-NEXT: call @outlined_else0(%{{.*}}, %{{.*}}) : (i1, memref) -> () +// CHECK-NEXT: func.call @outlined_else0(%{{.*}}, %{{.*}}) : (i1, memref) -> () // CHECK-NEXT: } // CHECK-NEXT: return // CHECK-NEXT: } diff --git a/mlir/test/Transforms/test-legalize-erased-op-with-uses.mlir b/mlir/test/Transforms/test-legalize-erased-op-with-uses.mlir --- a/mlir/test/Transforms/test-legalize-erased-op-with-uses.mlir +++ b/mlir/test/Transforms/test-legalize-erased-op-with-uses.mlir @@ -5,6 +5,6 @@ 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}} + // expected-note@below {{found live user of result #0: func.return %0 : i32}} return %0 : i32 } diff --git a/mlir/test/Transforms/test-rewrite-dynamic-op.mlir b/mlir/test/Transforms/test-rewrite-dynamic-op.mlir --- a/mlir/test/Transforms/test-rewrite-dynamic-op.mlir +++ b/mlir/test/Transforms/test-rewrite-dynamic-op.mlir @@ -4,7 +4,7 @@ // `test.generic_dynamic_op`. // CHECK-LABEL: func @rewrite_dynamic_op -func @rewrite_dynamic_op(%arg0: i32) { +func.func @rewrite_dynamic_op(%arg0: i32) { // CHECK-NEXT: %{{.*}}:2 = "test.dynamic_generic"(%arg0) : (i32) -> (i32, i32) %0:2 = "test.dynamic_one_operand_two_results"(%arg0) : (i32) -> (i32, i32) // CHECK-NEXT: return diff --git a/mlir/test/python/ir/operation.py b/mlir/test/python/ir/operation.py --- a/mlir/test/python/ir/operation.py +++ b/mlir/test/python/ir/operation.py @@ -75,7 +75,7 @@ # CHECK: REGION 0: # CHECK: BLOCK 0: # CHECK: OP 0: %0 = "custom.addi" - # CHECK: OP 1: return + # CHECK: OP 1: func.return walk_operations("", op) @@ -114,7 +114,7 @@ # CHECK: BLOCK 0: # CHECK: OP 0: %0 = "custom.addi" # CHECK: OP 0: parent func.func - # CHECK: OP 1: return + # CHECK: OP 1: func.return # CHECK: OP 1: parent func.func walk_operations("", module.operation) @@ -803,7 +803,7 @@ @run def testModuleMerge(): with Context(): - m1 = Module.parse("func private @foo()") + m1 = Module.parse("func.func private @foo()") m2 = Module.parse(""" func.func private @bar() func.func private @qux() @@ -829,8 +829,8 @@ @run def testAppendMoveFromAnotherBlock(): with Context(): - m1 = Module.parse("func private @foo()") - m2 = Module.parse("func private @bar()") + m1 = Module.parse("func.func private @foo()") + m2 = Module.parse("func.func private @bar()") func = m1.body.operations[0] m2.body.append(func) @@ -848,7 +848,7 @@ @run def testDetachFromParent(): with Context(): - m1 = Module.parse("func private @foo()") + m1 = Module.parse("func.func private @foo()") func = m1.body.operations[0].detach_from_parent() try: