[mlir] Remove special case parsing/printing of func operations

This was leftover from when the standard dialect was destroyed, and
when FuncOp moved to the func dialect. Now that these transitions
have settled a bit we can drop these.

Most updates were handled using a simple regex: replace `^( *)func` with `$1func.func`

Differential Revision: https://reviews.llvm.org/D124146
This commit is contained in:
River Riddle 2022-04-20 21:39:22 -07:00
parent b331a7ebc1
commit a8308020ac
92 changed files with 743 additions and 745 deletions

View File

@ -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

View File

@ -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<tuple<i32,f64>>)
return
}

View File

@ -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<!fir.type<derived_2{len1:i32}>>) {
func.func @coordinate_box_derived_with_fir_len(%arg0: !fir.box<!fir.type<derived_2{len1:i32}>>) {
// CHECK: not yet implemented fir.len_param_index codegen
%e = fir.len_param_index len1, !fir.type<derived_2{len1:i32}>
%q = fir.coordinate_of %arg0, %e : (!fir.box<!fir.type<derived_2{len1:i32}>>, !fir.len) -> !fir.ref<i32>

View File

@ -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<!fir.type<derived_2{field_1:!fir.array<10 x i32>, field_2:i32}>>, %arg1 : index) {
func.func @coordinate_box_array_inside_derived(%arg0: !fir.box<!fir.type<derived_2{field_1:!fir.array<10 x i32>, field_2:i32}>>, %arg1 : index) {
%idx0 = arith.constant 0 : i32
%q = fir.coordinate_of %arg0, %idx0, %arg1 : (!fir.box<!fir.type<derived_2{field_1:!fir.array<10 x i32>, field_2:i32}>>, i32, index) -> !fir.ref<f32>
return

View File

@ -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<derived_1{!fir.type<derived_2{}>}` (i.e. nested `!fir.type`)
func @coordinate_box_array_inside_derived(%arg0: !fir.box<!fir.type<derived_1{field_1:!fir.type<derived_2{field_2:!fir.array<10 x i32>}>}>>, %arg1 : index) {
func.func @coordinate_box_array_inside_derived(%arg0: !fir.box<!fir.type<derived_1{field_1:!fir.type<derived_2{field_2:!fir.array<10 x i32>}>}>>, %arg1 : index) {
%idx0 = arith.constant 0 : i32
%q = fir.coordinate_of %arg0, %idx0, %idx0, %arg1 : (!fir.box<!fir.type<derived_1{field_1:!fir.type<derived_2{field_2:!fir.array<10 x i32>}>}>>, i32, i32, index) -> !fir.ref<f32>
return

View File

@ -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<!fir.type<derived_2{len1:i32}>>) {
func.func @coordinate_box_derived_with_fir_len(%arg0: !fir.box<!fir.type<derived_2{len1:i32}>>) {
// CHECK: not yet implemented fir.len_param_index codegen
%e = fir.len_param_index len1, !fir.type<derived_2{len1:i32}>
%q = fir.coordinate_of %arg0, %e : (!fir.box<!fir.type<derived_2{len1:i32}>>, !fir.len) -> !fir.ref<i32>

View File

@ -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<!fir.array<2 x !fir.char<10, 2>>>, %arg1: index) {
func.func @test_coordinate_of(%arr : !fir.ref<!fir.array<2 x !fir.char<10, 2>>>, %arg1: index) {
%1 = arith.constant 10 : i32
%2 = fir.coordinate_of %arr, %arg1, %1 : (!fir.ref<!fir.array<2 x !fir.char<10, 2>>>, index, i32) -> !fir.ref<!fir.char<1,10>>
return

View File

@ -2,7 +2,7 @@
// CHECK: unsupported combination of coordinate operands
func @test_coordinate_of(%arr : !fir.ref<!fir.array<2 x i32>>, %arg1: index) {
func.func @test_coordinate_of(%arr : !fir.ref<!fir.array<2 x i32>>, %arg1: index) {
%2 = fir.coordinate_of %arr, %arg1, %arg1 : (!fir.ref<!fir.array<2 x i32>>, index, index) -> !fir.ref<i32>
return
}

View File

@ -3,7 +3,7 @@
// Test `fir.dispatch` conversion to llvm.
// Not implemented yet.
func @dispatch(%arg0: !fir.box<!fir.type<derived3{f:f32}>>) {
func.func @dispatch(%arg0: !fir.box<!fir.type<derived3{f:f32}>>) {
// CHECK: not yet implemented fir.dispatch codegen
%0 = fir.dispatch "method"(%arg0) : (!fir.box<!fir.type<derived3{f:f32}>>) -> i32
return

View File

@ -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"() : () -> ()
}

View File

@ -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<derived3>
return

View File

@ -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<twolens(l1:i32, l2:i32){i:i32, f:f32, l:i64}>
return

View File

@ -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,

View File

@ -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<tuple<i32,f64>>)
return
}

View File

@ -8,15 +8,15 @@
// CHECK-LABEL: func private @arrayfunc(!fir.ref<!fir.array<?xf32>>, i32)
// CHECK-BOX-LABEL: func private @arrayfunc(!fir.box<!fir.array<?xf32>>, i32)
func private @arrayfunc(i32) -> !fir.array<?xf32>
func.func private @arrayfunc(i32) -> !fir.array<?xf32>
// CHECK-LABEL: func private @derivedfunc(!fir.ref<!fir.type<t{x:f32}>>, f32)
// CHECK-BOX-LABEL: func private @derivedfunc(!fir.box<!fir.type<t{x:f32}>>, f32)
func private @derivedfunc(f32) -> !fir.type<t{x:f32}>
func.func private @derivedfunc(f32) -> !fir.type<t{x:f32}>
// CHECK-LABEL: func private @boxfunc(!fir.ref<!fir.box<!fir.heap<f64>>>, i64)
// CHECK-BOX-LABEL: func private @boxfunc(!fir.ref<!fir.box<!fir.heap<f64>>>, i64)
func private @boxfunc(i64) -> !fir.box<!fir.heap<f64>>
func.func private @boxfunc(i64) -> !fir.box<!fir.heap<f64>>
// ------------------------ Test callee rewrite --------------------------------
@ -25,7 +25,7 @@ func private @boxfunc(i64) -> !fir.box<!fir.heap<f64>>
// CHECK-SAME: %[[buffer:.*]]: !fir.ref<!fir.array<?xf32>>, %[[n:.*]]: index) {
// CHECK-BOX-LABEL: func private @arrayfunc_callee(
// CHECK-BOX-SAME: %[[box:.*]]: !fir.box<!fir.array<?xf32>>, %[[n:.*]]: index) {
func private @arrayfunc_callee(%n : index) -> !fir.array<?xf32> {
func.func private @arrayfunc_callee(%n : index) -> !fir.array<?xf32> {
%buffer = fir.alloca !fir.array<?xf32>, %n
// Do something with result (res(4) = 42.)
%c4 = arith.constant 4 : i64
@ -50,7 +50,7 @@ func private @arrayfunc_callee(%n : index) -> !fir.array<?xf32> {
// CHECK-SAME: %[[buffer:.*]]: !fir.ref<!fir.type<t{x:f32}>>, %[[v:.*]]: f32) {
// CHECK-BOX-LABEL: func @derivedfunc_callee(
// CHECK-BOX-SAME: %[[box:.*]]: !fir.box<!fir.type<t{x:f32}>>, %[[v:.*]]: f32) {
func @derivedfunc_callee(%v: f32) -> !fir.type<t{x:f32}> {
func.func @derivedfunc_callee(%v: f32) -> !fir.type<t{x:f32}> {
%buffer = fir.alloca !fir.type<t{x:f32}>
%0 = fir.field_index x, !fir.type<t{x:f32}>
%1 = fir.coordinate_of %buffer, %0 : (!fir.ref<!fir.type<t{x:f32}>>, !fir.field) -> !fir.ref<f32>
@ -72,7 +72,7 @@ func @derivedfunc_callee(%v: f32) -> !fir.type<t{x:f32}> {
// CHECK-SAME: %[[buffer:.*]]: !fir.ref<!fir.box<!fir.heap<f64>>>) {
// CHECK-BOX-LABEL: func @boxfunc_callee(
// CHECK-BOX-SAME: %[[buffer:.*]]: !fir.ref<!fir.box<!fir.heap<f64>>>) {
func @boxfunc_callee() -> !fir.box<!fir.heap<f64>> {
func.func @boxfunc_callee() -> !fir.box<!fir.heap<f64>> {
%alloc = fir.allocmem f64
%res = fir.embox %alloc : (!fir.heap<f64>) -> !fir.box<!fir.heap<f64>>
return %res : !fir.box<!fir.heap<f64>>
@ -89,7 +89,7 @@ func @boxfunc_callee() -> !fir.box<!fir.heap<f64>> {
// 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<?xf32>, %c100
%shape = fir.shape %c100 : (index) -> !fir.shape<1>
@ -112,7 +112,7 @@ func @call_arrayfunc() {
// CHECK-LABEL: func @call_derivedfunc() {
// CHECK-BOX-LABEL: func @call_derivedfunc() {
func @call_derivedfunc() {
func.func @call_derivedfunc() {
%buffer = fir.alloca !fir.type<t{x:f32}>
%cst = arith.constant 4.200000e+01 : f32
%res = fir.call @derivedfunc_callee(%cst) : (f32) -> !fir.type<t{x:f32}>
@ -130,13 +130,13 @@ func @call_derivedfunc() {
// CHECK-BOX-NOT: fir.save_result
}
func private @derived_lparams_func() -> !fir.type<t2(l1:i32,l2:i32){x:f32}>
func.func private @derived_lparams_func() -> !fir.type<t2(l1:i32,l2:i32){x:f32}>
// CHECK-LABEL: func @call_derived_lparams_func(
// CHECK-SAME: %[[buffer:.*]]: !fir.ref<!fir.type<t2(l1:i32,l2:i32){x:f32}>>
// CHECK-BOX-LABEL: func @call_derived_lparams_func(
// CHECK-BOX-SAME: %[[buffer:.*]]: !fir.ref<!fir.type<t2(l1:i32,l2:i32){x:f32}>>
func @call_derived_lparams_func(%buffer: !fir.ref<!fir.type<t2(l1:i32,l2:i32){x:f32}>>) {
func.func @call_derived_lparams_func(%buffer: !fir.ref<!fir.type<t2(l1:i32,l2:i32){x:f32}>>) {
%l1 = arith.constant 3 : i32
%l2 = arith.constant 5 : i32
%res = fir.call @derived_lparams_func() : () -> !fir.type<t2(l1:i32,l2:i32){x:f32}>
@ -157,7 +157,7 @@ func @call_derived_lparams_func(%buffer: !fir.ref<!fir.type<t2(l1:i32,l2:i32){x:
// CHECK-LABEL: func @call_boxfunc() {
// CHECK-BOX-LABEL: func @call_boxfunc() {
func @call_boxfunc() {
func.func @call_boxfunc() {
%buffer = fir.alloca !fir.box<!fir.heap<f64>>
%res = fir.call @boxfunc_callee() : () -> !fir.box<!fir.heap<f64>>
fir.save_result %res to %buffer: !fir.box<!fir.heap<f64>>, !fir.ref<!fir.box<!fir.heap<f64>>>
@ -172,11 +172,11 @@ func @call_boxfunc() {
// CHECK-BOX-NOT: fir.save_result
}
func private @chararrayfunc(index, index) -> !fir.array<?x!fir.char<1,?>>
func.func private @chararrayfunc(index, index) -> !fir.array<?x!fir.char<1,?>>
// 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<?x!fir.char<1,?>>(%c100 : index), %c50
@ -202,11 +202,11 @@ func @call_chararrayfunc() {
// ------------------------ Test fir.address_of rewrite ------------------------
func private @takesfuncarray((i32) -> !fir.array<?xf32>)
func.func private @takesfuncarray((i32) -> !fir.array<?xf32>)
// 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<?xf32>
fir.call @takesfuncarray(%0) : ((i32) -> !fir.array<?xf32>) -> ()
return
@ -227,7 +227,7 @@ func @test_address_of() {
// 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<?xf32>, %c100
%shape = fir.shape %c100 : (index) -> !fir.shape<1>

View File

@ -4,7 +4,7 @@
fir.global @var_x : !fir.int<4> {}
// CHECK-LABEL: define i32* @getAddressOfX
func @getAddressOfX() -> !fir.ref<!fir.int<4>> {
func.func @getAddressOfX() -> !fir.ref<!fir.int<4>> {
%1 = fir.address_of(@var_x) : !fir.ref<!fir.int<4>>
// CHECK: ret i32* @var_x
return %1 : !fir.ref<!fir.int<4>>

View File

@ -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<!fir.array<?xf32>>, %arg1: !fir.ref<!fir.array<?xf32>>, %arg2: !fir.ref<!fir.array<?xf32>>) {
func.func @calc(%arg0: !fir.ref<!fir.array<?xf32>>, %arg1: !fir.ref<!fir.array<?xf32>>, %arg2: !fir.ref<!fir.array<?xf32>>) {
%c1 = arith.constant 1 : index
%c100 = arith.constant 100 : index
%0 = fir.shape %c100 : (index) -> !fir.shape<1>

View File

@ -5,7 +5,7 @@
!arr_d1 = type !fir.ref<!fir.array<?xf32>>
#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 @@ func @loop_with_load_and_store(%a1: !arr_d1, %a2: !arr_d1, %a3: !arr_d1) {
!arr_d1 = type !fir.ref<!fir.array<?xf32>>
#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

View File

@ -4,14 +4,14 @@
// CHECK-LABEL: define i32* @alloca_scalar_nonchar()
// CHECK: alloca i32, i64 1
func @alloca_scalar_nonchar() -> !fir.ref<i32> {
func.func @alloca_scalar_nonchar() -> !fir.ref<i32> {
%1 = fir.alloca i32
return %1 : !fir.ref<i32>
}
// CHECK-LABEL: define i32* @alloca_scalars_nonchar()
// CHECK: alloca i32, i64 100
func @alloca_scalars_nonchar() -> !fir.ref<i32> {
func.func @alloca_scalars_nonchar() -> !fir.ref<i32> {
%0 = arith.constant 100 : index
%1 = fir.alloca i32, %0
return %1 : !fir.ref<i32>
@ -19,14 +19,14 @@ func @alloca_scalars_nonchar() -> !fir.ref<i32> {
// CHECK-LABEL: define i32* @allocmem_scalar_nonchar(
// CHECK: call i8* @malloc(i64 4)
func @allocmem_scalar_nonchar() -> !fir.heap<i32> {
func.func @allocmem_scalar_nonchar() -> !fir.heap<i32> {
%1 = fir.allocmem i32
return %1 : !fir.heap<i32>
}
// CHECK-LABEL: define i32* @allocmem_scalars_nonchar(
// CHECK: call i8* @malloc(i64 400)
func @allocmem_scalars_nonchar() -> !fir.heap<i32> {
func.func @allocmem_scalars_nonchar() -> !fir.heap<i32> {
%0 = arith.constant 100 : index
%1 = fir.allocmem i32, %0
return %1 : !fir.heap<i32>
@ -34,28 +34,28 @@ func @allocmem_scalars_nonchar() -> !fir.heap<i32> {
// CHECK-LABEL: define [10 x i8]* @alloca_scalar_char(
// CHECK: alloca [10 x i8], i64 1
func @alloca_scalar_char() -> !fir.ref<!fir.char<1,10>> {
func.func @alloca_scalar_char() -> !fir.ref<!fir.char<1,10>> {
%1 = fir.alloca !fir.char<1,10>
return %1 : !fir.ref<!fir.char<1,10>>
}
// CHECK-LABEL: define [10 x i16]* @alloca_scalar_char_kind(
// CHECK: alloca [10 x i16], i64 1
func @alloca_scalar_char_kind() -> !fir.ref<!fir.char<2,10>> {
func.func @alloca_scalar_char_kind() -> !fir.ref<!fir.char<2,10>> {
%1 = fir.alloca !fir.char<2,10>
return %1 : !fir.ref<!fir.char<2,10>>
}
// 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<!fir.char<1,10>> {
func.func @allocmem_scalar_char() -> !fir.heap<!fir.char<1,10>> {
%1 = fir.allocmem !fir.char<1,10>
return %1 : !fir.heap<!fir.char<1,10>>
}
// 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<!fir.char<2,10>> {
func.func @allocmem_scalar_char_kind() -> !fir.heap<!fir.char<2,10>> {
%1 = fir.allocmem !fir.char<2,10>
return %1 : !fir.heap<!fir.char<2,10>>
}
@ -64,7 +64,7 @@ func @allocmem_scalar_char_kind() -> !fir.heap<!fir.char<2,10>> {
// CHECK-SAME: i32 %[[len:.*]])
// CHECK: %[[mul1:.*]] = sext i32 %[[len]] to i64
// CHECK: alloca i8, i64 %[[mul1]]
func @alloca_scalar_dynchar(%l : i32) -> !fir.ref<!fir.char<1,?>> {
func.func @alloca_scalar_dynchar(%l : i32) -> !fir.ref<!fir.char<1,?>> {
%1 = fir.alloca !fir.char<1,?>(%l : i32)
return %1 : !fir.ref<!fir.char<1,?>>
}
@ -73,7 +73,7 @@ func @alloca_scalar_dynchar(%l : i32) -> !fir.ref<!fir.char<1,?>> {
// 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<!fir.char<2,?>> {
func.func @alloca_scalar_dynchar_kind(%l : i32) -> !fir.ref<!fir.char<2,?>> {
%1 = fir.alloca !fir.char<2,?>(%l : i32)
return %1 : !fir.ref<!fir.char<2,?>>
}
@ -83,7 +83,7 @@ func @alloca_scalar_dynchar_kind(%l : i32) -> !fir.ref<!fir.char<2,?>> {
// 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<!fir.char<1,?>> {
func.func @allocmem_scalar_dynchar(%l : i32) -> !fir.heap<!fir.char<1,?>> {
%1 = fir.allocmem !fir.char<1,?>(%l : i32)
return %1 : !fir.heap<!fir.char<1,?>>
}
@ -93,28 +93,28 @@ func @allocmem_scalar_dynchar(%l : i32) -> !fir.heap<!fir.char<1,?>> {
// 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<!fir.char<2,?>>{
func.func @allocmem_scalar_dynchar_kind(%l : i32) -> !fir.heap<!fir.char<2,?>>{
%1 = fir.allocmem !fir.char<2,?>(%l : i32)
return %1 : !fir.heap<!fir.char<2,?>>
}
// CHECK-LABEL: define i32** @alloca_ptr_to_dynarray_nonchar(
// CHECK: %1 = alloca i32*, i64 1
func @alloca_ptr_to_dynarray_nonchar() -> !fir.ref<!fir.ptr<!fir.array<?xi32>>> {
func.func @alloca_ptr_to_dynarray_nonchar() -> !fir.ref<!fir.ptr<!fir.array<?xi32>>> {
%1 = fir.alloca !fir.ptr<!fir.array<?xi32>>
return %1 : !fir.ref<!fir.ptr<!fir.array<?xi32>>>
}
// 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<!fir.array<3x3xi32>> {
func.func @alloca_array_of_nonchar() -> !fir.ref<!fir.array<3x3xi32>> {
%1 = fir.alloca !fir.array<3x3xi32>
return %1 : !fir.ref<!fir.array<3x3xi32>>
}
// 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<!fir.array<3x3x!fir.char<1,10>>> {
func.func @alloca_array_of_char() -> !fir.ref<!fir.array<3x3x!fir.char<1,10>>> {
%1 = fir.alloca !fir.array<3x3x!fir.char<1,10>>
return %1 : !fir.ref<!fir.array<3x3x!fir.char<1,10>>>
}
@ -124,21 +124,21 @@ func @alloca_array_of_char() -> !fir.ref<!fir.array<3x3x!fir.char<1,10>>> {
// 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<!fir.array<3x3x!fir.char<1,?>>> {
func.func @alloca_array_of_dynchar(%l: i32) -> !fir.ref<!fir.array<3x3x!fir.char<1,?>>> {
%1 = fir.alloca !fir.array<3x3x!fir.char<1,?>>(%l : i32)
return %1 : !fir.ref<!fir.array<3x3x!fir.char<1,?>>>
}
// 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<!fir.array<3x3xi32>> {
func.func @allocmem_array_of_nonchar() -> !fir.heap<!fir.array<3x3xi32>> {
%1 = fir.allocmem !fir.array<3x3xi32>
return %1 : !fir.heap<!fir.array<3x3xi32>>
}
// 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<!fir.array<3x3x!fir.char<1,10>>> {
func.func @allocmem_array_of_char() -> !fir.heap<!fir.array<3x3x!fir.char<1,10>>> {
%1 = fir.allocmem !fir.array<3x3x!fir.char<1,10>>
return %1 : !fir.heap<!fir.array<3x3x!fir.char<1,10>>>
}
@ -148,7 +148,7 @@ func @allocmem_array_of_char() -> !fir.heap<!fir.array<3x3x!fir.char<1,10>>> {
// 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<!fir.array<3x3x!fir.char<1,?>>> {
func.func @allocmem_array_of_dynchar(%l: i32) -> !fir.heap<!fir.array<3x3x!fir.char<1,?>>> {
%1 = fir.allocmem !fir.array<3x3x!fir.char<1,?>>(%l : i32)
return %1 : !fir.heap<!fir.array<3x3x!fir.char<1,?>>>
}
@ -157,7 +157,7 @@ func @allocmem_array_of_dynchar(%l: i32) -> !fir.heap<!fir.array<3x3x!fir.char<1
// 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<!fir.array<3x?xi32>> {
func.func @alloca_dynarray_of_nonchar(%e: index) -> !fir.ref<!fir.array<3x?xi32>> {
%1 = fir.alloca !fir.array<3x?xi32>, %e
return %1 : !fir.ref<!fir.array<3x?xi32>>
}
@ -167,7 +167,7 @@ func @alloca_dynarray_of_nonchar(%e: index) -> !fir.ref<!fir.array<3x?xi32>> {
// 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<!fir.array<?x?xi32>> {
func.func @alloca_dynarray_of_nonchar2(%e: index) -> !fir.ref<!fir.array<?x?xi32>> {
%1 = fir.alloca !fir.array<?x?xi32>, %e, %e
return %1 : !fir.ref<!fir.array<?x?xi32>>
}
@ -176,7 +176,7 @@ func @alloca_dynarray_of_nonchar2(%e: index) -> !fir.ref<!fir.array<?x?xi32>> {
// 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<!fir.array<3x?xi32>> {
func.func @allocmem_dynarray_of_nonchar(%e: index) -> !fir.heap<!fir.array<3x?xi32>> {
%1 = fir.allocmem !fir.array<3x?xi32>, %e
return %1 : !fir.heap<!fir.array<3x?xi32>>
}
@ -186,7 +186,7 @@ func @allocmem_dynarray_of_nonchar(%e: index) -> !fir.heap<!fir.array<3x?xi32>>
// 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<!fir.array<?x?xi32>> {
func.func @allocmem_dynarray_of_nonchar2(%e: index) -> !fir.heap<!fir.array<?x?xi32>> {
%1 = fir.allocmem !fir.array<?x?xi32>, %e, %e
return %1 : !fir.heap<!fir.array<?x?xi32>>
}
@ -195,7 +195,7 @@ func @allocmem_dynarray_of_nonchar2(%e: index) -> !fir.heap<!fir.array<?x?xi32>>
// 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<!fir.array<3x?x!fir.char<2,10>>> {
func.func @alloca_dynarray_of_char(%e : index) -> !fir.ref<!fir.array<3x?x!fir.char<2,10>>> {
%1 = fir.alloca !fir.array<3x?x!fir.char<2,10>>, %e
return %1 : !fir.ref<!fir.array<3x?x!fir.char<2,10>>>
}
@ -205,7 +205,7 @@ func @alloca_dynarray_of_char(%e : index) -> !fir.ref<!fir.array<3x?x!fir.char<2
// 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<!fir.array<?x?x!fir.char<2,10>>> {
func.func @alloca_dynarray_of_char2(%e : index) -> !fir.ref<!fir.array<?x?x!fir.char<2,10>>> {
%1 = fir.alloca !fir.array<?x?x!fir.char<2,10>>, %e, %e
return %1 : !fir.ref<!fir.array<?x?x!fir.char<2,10>>>
}
@ -214,7 +214,7 @@ func @alloca_dynarray_of_char2(%e : index) -> !fir.ref<!fir.array<?x?x!fir.char<
// 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<!fir.array<3x?x!fir.char<2,10>>> {
func.func @allocmem_dynarray_of_char(%e : index) -> !fir.heap<!fir.array<3x?x!fir.char<2,10>>> {
%1 = fir.allocmem !fir.array<3x?x!fir.char<2,10>>, %e
return %1 : !fir.heap<!fir.array<3x?x!fir.char<2,10>>>
}
@ -224,7 +224,7 @@ func @allocmem_dynarray_of_char(%e : index) -> !fir.heap<!fir.array<3x?x!fir.cha
// 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<!fir.array<?x?x!fir.char<2,10>>> {
func.func @allocmem_dynarray_of_char2(%e : index) -> !fir.heap<!fir.array<?x?x!fir.char<2,10>>> {
%1 = fir.allocmem !fir.array<?x?x!fir.char<2,10>>, %e, %e
return %1 : !fir.heap<!fir.array<?x?x!fir.char<2,10>>>
}
@ -235,7 +235,7 @@ func @allocmem_dynarray_of_char2(%e : index) -> !fir.heap<!fir.array<?x?x!fir.ch
// 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<!fir.array<3x?x!fir.char<2,?>>> {
func.func @alloca_dynarray_of_dynchar(%l: i32, %e : index) -> !fir.ref<!fir.array<3x?x!fir.char<2,?>>> {
%1 = fir.alloca !fir.array<3x?x!fir.char<2,?>>(%l : i32), %e
return %1 : !fir.ref<!fir.array<3x?x!fir.char<2,?>>>
}
@ -246,7 +246,7 @@ func @alloca_dynarray_of_dynchar(%l: i32, %e : index) -> !fir.ref<!fir.array<3x?
// 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<!fir.array<?x?x!fir.char<2,?>>> {
func.func @alloca_dynarray_of_dynchar2(%l: i32, %e : index) -> !fir.ref<!fir.array<?x?x!fir.char<2,?>>> {
%1 = fir.alloca !fir.array<?x?x!fir.char<2,?>>(%l : i32), %e, %e
return %1 : !fir.ref<!fir.array<?x?x!fir.char<2,?>>>
}
@ -257,7 +257,7 @@ func @alloca_dynarray_of_dynchar2(%l: i32, %e : index) -> !fir.ref<!fir.array<?x
// 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<!fir.array<3x?x!fir.char<2,?>>> {
func.func @allocmem_dynarray_of_dynchar(%l: i32, %e : index) -> !fir.heap<!fir.array<3x?x!fir.char<2,?>>> {
%1 = fir.allocmem !fir.array<3x?x!fir.char<2,?>>(%l : i32), %e
return %1 : !fir.heap<!fir.array<3x?x!fir.char<2,?>>>
}
@ -269,7 +269,7 @@ func @allocmem_dynarray_of_dynchar(%l: i32, %e : index) -> !fir.heap<!fir.array<
// 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<!fir.array<?x?x!fir.char<2,?>>> {
func.func @allocmem_dynarray_of_dynchar2(%l: i32, %e : index) -> !fir.heap<!fir.array<?x?x!fir.char<2,?>>> {
%1 = fir.allocmem !fir.array<?x?x!fir.char<2,?>>(%l : i32), %e, %e
return %1 : !fir.heap<!fir.array<?x?x!fir.char<2,?>>>
}
@ -279,7 +279,7 @@ func @allocmem_dynarray_of_dynchar2(%l: i32, %e : index) -> !fir.heap<!fir.array
// 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<!fir.array<4x?x3x?x5xi32>> {
func.func @alloca_array_with_holes_nonchar(%0 : index, %1 : index) -> !fir.ref<!fir.array<4x?x3x?x5xi32>> {
%a = fir.alloca !fir.array<4x?x3x?x5xi32>, %0, %1
return %a : !fir.ref<!fir.array<4x?x3x?x5xi32>>
}
@ -288,7 +288,7 @@ func @alloca_array_with_holes_nonchar(%0 : index, %1 : index) -> !fir.ref<!fir.a
// 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<!fir.array<3x?x4x!fir.char<2,10>>> {
func.func @alloca_array_with_holes_char(%e: index) -> !fir.ref<!fir.array<3x?x4x!fir.char<2,10>>> {
%1 = fir.alloca !fir.array<3x?x4x!fir.char<2,10>>, %e
return %1 : !fir.ref<!fir.array<3x?x4x!fir.char<2,10>>>
}
@ -298,7 +298,7 @@ func @alloca_array_with_holes_char(%e: index) -> !fir.ref<!fir.array<3x?x4x!fir.
// 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<!fir.array<3x?x4x!fir.char<2,?>>> {
func.func @alloca_array_with_holes_dynchar(%arg0: index, %arg1: index) -> !fir.ref<!fir.array<3x?x4x!fir.char<2,?>>> {
%1 = fir.alloca !fir.array<3x?x4x!fir.char<2,?>>(%arg0 : index), %arg1
return %1 : !fir.ref<!fir.array<3x?x4x!fir.char<2,?>>>
}
@ -308,7 +308,7 @@ func @alloca_array_with_holes_dynchar(%arg0: index, %arg1: index) -> !fir.ref<!f
// 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<!fir.array<4x?x3x?x5xi32>> {
func.func @allocmem_array_with_holes_nonchar(%0 : index, %1 : index) -> !fir.heap<!fir.array<4x?x3x?x5xi32>> {
%a = fir.allocmem !fir.array<4x?x3x?x5xi32>, %0, %1
return %a : !fir.heap<!fir.array<4x?x3x?x5xi32>>
}
@ -317,7 +317,7 @@ func @allocmem_array_with_holes_nonchar(%0 : index, %1 : index) -> !fir.heap<!fi
// 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<!fir.array<3x?x4x!fir.char<2,10>>> {
func.func @allocmem_array_with_holes_char(%e: index) -> !fir.heap<!fir.array<3x?x4x!fir.char<2,10>>> {
%1 = fir.allocmem !fir.array<3x?x4x!fir.char<2,10>>, %e
return %1 : !fir.heap<!fir.array<3x?x4x!fir.char<2,10>>>
}
@ -327,7 +327,7 @@ func @allocmem_array_with_holes_char(%e: index) -> !fir.heap<!fir.array<3x?x4x!f
// 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<!fir.array<3x?x4x!fir.char<2,?>>> {
func.func @allocmem_array_with_holes_dynchar(%arg0: index, %arg1: index) -> !fir.heap<!fir.array<3x?x4x!fir.char<2,?>>> {
%1 = fir.allocmem !fir.array<3x?x4x!fir.char<2,?>>(%arg0 : index), %arg1
return %1 : !fir.heap<!fir.array<3x?x4x!fir.char<2,?>>>
}

View File

@ -1,7 +1,7 @@
// RUN: fir-opt -annotate-constant %s | FileCheck %s
// CHECK-LABEL: func @annotate_test() -> !fir.ref<!fir.array<?xi32>> {
func @annotate_test() -> !fir.ref<!fir.array<?xi32>> {
func.func @annotate_test() -> !fir.ref<!fir.array<?xi32>> {
%1 = arith.constant 5 : index
// CHECK: %[[a:.*]] = fir.alloca !fir.array<?xi32>, %{{.*}} {canonicalize_constant_operands = [5 : index]}
%2 = fir.alloca !fir.array<?xi32>, %1

View File

@ -11,7 +11,7 @@
// CHECK: fir.do_loop
// CHECK: fir.do_loop
// CHECK: fir.freemem %[[ALLOC]] : !fir.heap<!fir.array<100xf32>>
func @maybe_overlap(%arg0: !fir.ptr<!fir.array<100xf32>>, %arg1: !fir.ref<!fir.array<100xf32>>) {
func.func @maybe_overlap(%arg0: !fir.ptr<!fir.array<100xf32>>, %arg1: !fir.ref<!fir.array<100xf32>>) {
%c100 = arith.constant 100 : index
%c99 = arith.constant 99 : index
%c1 = arith.constant 1 : index
@ -38,7 +38,7 @@ func @maybe_overlap(%arg0: !fir.ptr<!fir.array<100xf32>>, %arg1: !fir.ref<!fir.a
// CHECK: fir.array_coor
// CHECK: fir.array_coor
// CHECK: fir.store
func @no_overlap(%arg0: !fir.ptr<!fir.array<100xf32>>, %arg1: !fir.ref<!fir.array<100xf32>>) {
func.func @no_overlap(%arg0: !fir.ptr<!fir.array<100xf32>>, %arg1: !fir.ref<!fir.array<100xf32>>) {
%c100 = arith.constant 100 : index
%c99 = arith.constant 99 : index
%c1 = arith.constant 1 : index
@ -65,7 +65,7 @@ func @no_overlap(%arg0: !fir.ptr<!fir.array<100xf32>>, %arg1: !fir.ref<!fir.arra
// CHECK: fir.do_loop
// CHECK: fir.do_loop
// CHECK: fir.freemem %[[ALLOC]] : !fir.heap<!fir.array<100xf32>>
func @maybe_overlap_2(%arg0: !fir.ptr<!fir.array<100xf32>>, %arg1: !fir.ref<!fir.array<100xf32>>) {
func.func @maybe_overlap_2(%arg0: !fir.ptr<!fir.array<100xf32>>, %arg1: !fir.ref<!fir.array<100xf32>>) {
%c100 = arith.constant 100 : index
%c99 = arith.constant 99 : index
%c1 = arith.constant 1 : index
@ -92,7 +92,7 @@ func @maybe_overlap_2(%arg0: !fir.ptr<!fir.array<100xf32>>, %arg1: !fir.ref<!fir
// CHECK: fir.do_loop
// CHECK: fir.do_loop
// CHECK: fir.freemem %[[ALLOC]] : !fir.heap<!fir.array<100xf32>>
func @maybe_overlap_3(%arg0: !fir.ptr<!fir.array<100xf32>>, %arg1: !fir.ptr<!fir.array<100xf32>>) {
func.func @maybe_overlap_3(%arg0: !fir.ptr<!fir.array<100xf32>>, %arg1: !fir.ptr<!fir.array<100xf32>>) {
%c100 = arith.constant 100 : index
%c99 = arith.constant 99 : index
%c1 = arith.constant 1 : index
@ -118,7 +118,7 @@ func @maybe_overlap_3(%arg0: !fir.ptr<!fir.array<100xf32>>, %arg1: !fir.ptr<!fir
// CHECK: %[[ALLOC:.*]] = fir.allocmem !fir.array<4x!fir.type<some_type{i:i32}>>
// CHECK-COUNT-3: fir.do_loop
// CHECK: fir.freemem %[[ALLOC]] : !fir.heap<!fir.array<4x!fir.type<some_type{i:i32}>>>
func @derived_whose_component_may_be_aliased(%arg0: !fir.box<!fir.array<4x!fir.type<some_type{i:i32}>>> {fir.target}, %arg1: !fir.ref<!fir.box<!fir.ptr<!fir.array<?xi32>>>>) {
func.func @derived_whose_component_may_be_aliased(%arg0: !fir.box<!fir.array<4x!fir.type<some_type{i:i32}>>> {fir.target}, %arg1: !fir.ref<!fir.box<!fir.ptr<!fir.array<?xi32>>>>) {
%c4 = arith.constant 4 : index
%0 = fir.field_index i, !fir.type<some_type{i:i32}>
%c1 = arith.constant 1 : index
@ -147,7 +147,7 @@ func @derived_whose_component_may_be_aliased(%arg0: !fir.box<!fir.array<4x!fir.t
// CHECK: %[[ALLOC:.*]] = fir.allocmem !fir.array<?xf32>
// CHECK-COUNT-3: fir.do_loop
// CHECK: fir.freemem %[[ALLOC]] : !fir.heap<!fir.array<?xf32>>
func @complex_real_aliasing(%arg0: !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>, %arg1: !fir.ref<!fir.array<4x!fir.complex<4>>> {fir.target}) {
func.func @complex_real_aliasing(%arg0: !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>, %arg1: !fir.ref<!fir.array<4x!fir.complex<4>>> {fir.target}) {
%c4 = arith.constant 4 : index
%0 = fir.load %arg0 : !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>
%c0 = arith.constant 0 : index

View File

@ -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<!fir.array<100xf32>>, %arg1: !fir.ref<!fir.array<100xf32>>) {
func.func @no_overlap(%arg0: !fir.ref<!fir.array<100xf32>>, %arg1: !fir.ref<!fir.array<100xf32>>) {
%c100 = arith.constant 100 : index
%c99 = arith.constant 99 : index
%c1 = arith.constant 1 : index
@ -49,7 +49,7 @@ func @no_overlap(%arg0: !fir.ref<!fir.array<100xf32>>, %arg1: !fir.ref<!fir.arra
// Test user_defined_assignment(arg0(:), arg0(100:1:-1))
func @overlap(%arg0: !fir.ref<!fir.array<100xf32>>) {
func.func @overlap(%arg0: !fir.ref<!fir.array<100xf32>>) {
%c100 = arith.constant 100 : index
%c99 = arith.constant 99 : index
%c1 = arith.constant 1 : index
@ -127,4 +127,4 @@ func @overlap(%arg0: !fir.ref<!fir.array<100xf32>>) {
// CHECK: return
// CHECK: }
func private @user_defined_assignment(!fir.ref<f32>, !fir.ref<f32>)
func.func private @user_defined_assignment(!fir.ref<f32>, !fir.ref<f32>)

View File

@ -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<!fir.array<?xf32>>, %arg1: !fir.ref<i32>, %arg2: !fir.ref<i32>) {
func.func @_QPslice1(%arg0: !fir.box<!fir.array<?xf32>>, %arg1: !fir.ref<i32>, %arg2: !fir.ref<i32>) {
%c1_i64 = arith.constant 1 : i64
%0 = fir.convert %c1_i64 : (i64) -> index
%1 = fir.load %arg1 : !fir.ref<i32>
@ -45,7 +45,7 @@ func @_QPslice1(%arg0: !fir.box<!fir.array<?xf32>>, %arg1: !fir.ref<i32>, %arg2:
// CHECK: ^bb{{[0-9]+}}(%{{[0-9]+}}: index,
// CHECK: fir.freemem
// CHECK: return
func @_QPslice2(%arg0: !fir.box<!fir.array<?xf32>>, %arg1: !fir.ref<i32>, %arg2: !fir.ref<i32>) {
func.func @_QPslice2(%arg0: !fir.box<!fir.array<?xf32>>, %arg1: !fir.ref<i32>, %arg2: !fir.ref<i32>) {
%c1_i64 = arith.constant 1 : i64
%0 = fir.convert %c1_i64 : (i64) -> index
%c1_i64_0 = arith.constant 1 : i64

View File

@ -7,8 +7,8 @@
!t_with_alloc_comp = type !fir.type<t{i:!fir.box<!fir.heap<!fir.array<?xi32>>>}>
func private @custom_assign(!fir.ref<!t_with_alloc_comp>, !fir.ref<!t_with_alloc_comp>)
func @test_overlap_with_alloc_components(%arg0: !fir.ref<!fir.array<10x!t_with_alloc_comp>>) {
func.func private @custom_assign(!fir.ref<!t_with_alloc_comp>, !fir.ref<!t_with_alloc_comp>)
func.func @test_overlap_with_alloc_components(%arg0: !fir.ref<!fir.array<10x!t_with_alloc_comp>>) {
%0 = fir.alloca !fir.box<!t_with_alloc_comp>
%c10 = arith.constant 10 : index
%c9 = arith.constant 9 : index

View File

@ -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<!fir.array<?x?xf32>>, %m: index, %n: index) {
func.func @array_fetch_conversion(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %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 @@ func @array_fetch_conversion(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m: index, %
// -----
// Test simple fir.array_load/fir.array_update conversion without copy-in/copy-out
func @array_update_conversion(%arr1 : !fir.box<!fir.array<?x?xf32>>, %m: index, %n: index) {
func.func @array_update_conversion(%arr1 : !fir.box<!fir.array<?x?xf32>>, %m: index, %n: index) {
%c10 = arith.constant 10 : index
%c20 = arith.constant 20 : index
%c1 = arith.constant 1 : index
@ -49,7 +49,7 @@ func @array_update_conversion(%arr1 : !fir.box<!fir.array<?x?xf32>>, %m: index,
// -----
// Test simple fir.array_load/fir.array_update conversion without copy-in/copy-out
func @array_update_conversion(%arr1 : !fir.box<!fir.array<?x?xf32>>, %m: index, %n: index, %cond: i1) {
func.func @array_update_conversion(%arr1 : !fir.box<!fir.array<?x?xf32>>, %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 @@ func @array_update_conversion(%arr1 : !fir.box<!fir.array<?x?xf32>>, %m: index,
// end
// ```
func @conversion_with_temporary(%arr0 : !fir.ref<!fir.array<10xi32>>) {
func.func @conversion_with_temporary(%arr0 : !fir.ref<!fir.array<10xi32>>) {
%c10 = arith.constant 10 : index
%1 = fir.shape %c10 : (index) -> !fir.shape<1>
%2 = fir.array_load %arr0(%1) : (!fir.ref<!fir.array<10xi32>>, !fir.shape<1>) -> !fir.array<10xi32>
@ -137,7 +137,7 @@ func @conversion_with_temporary(%arr0 : !fir.ref<!fir.array<10xi32>>) {
// 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<!fir.array<10x5xi32>>) {
func.func @conversion_with_temporary_multidim(%0: !fir.ref<!fir.array<10x5xi32>>) {
%c10 = arith.constant 10 : index
%c5 = arith.constant 5 : index
%1 = fir.shape %c10, %c5 : (index, index) -> !fir.shape<2>
@ -216,7 +216,7 @@ func @conversion_with_temporary_multidim(%0: !fir.ref<!fir.array<10x5xi32>>) {
// -----
// Test fir.array_modify conversion with no overlap.
func @array_modify_no_overlap(%arg0: !fir.ref<!fir.array<100xf32>>, %arg1: !fir.ref<!fir.array<100xf32>>) {
func.func @array_modify_no_overlap(%arg0: !fir.ref<!fir.array<100xf32>>, %arg1: !fir.ref<!fir.array<100xf32>>) {
%c100 = arith.constant 100 : index
%c99 = arith.constant 99 : index
%c1 = arith.constant 1 : index
@ -236,7 +236,7 @@ func @array_modify_no_overlap(%arg0: !fir.ref<!fir.array<100xf32>>, %arg1: !fir.
return
}
func private @user_defined_assignment(!fir.ref<f32>, !fir.ref<f32>)
func.func private @user_defined_assignment(!fir.ref<f32>, !fir.ref<f32>)
// CHECK-LABEL: func @array_modify_no_overlap(
// CHECK-SAME: %[[ARR0:.*]]: !fir.ref<!fir.array<100xf32>>,
@ -255,7 +255,7 @@ func private @user_defined_assignment(!fir.ref<f32>, !fir.ref<f32>)
// Test fir.array_modify conversion with an overlap.
// Test user_defined_assignment(arg0(:), arg0(100:1:-1))
func @array_modify_overlap(%arg0: !fir.ref<!fir.array<100xf32>>) {
func.func @array_modify_overlap(%arg0: !fir.ref<!fir.array<100xf32>>) {
%c100 = arith.constant 100 : index
%c99 = arith.constant 99 : index
%c1 = arith.constant 1 : index
@ -277,7 +277,7 @@ func @array_modify_overlap(%arg0: !fir.ref<!fir.array<100xf32>>) {
return
}
func private @user_defined_assignment(!fir.ref<f32>, !fir.ref<f32>)
func.func private @user_defined_assignment(!fir.ref<f32>, !fir.ref<f32>)
// CHECK-LABEL: func @array_modify_overlap(
// CHECK-SAME: %[[ARR0:.*]]: !fir.ref<!fir.array<100xf32>>) {
@ -316,7 +316,7 @@ func private @user_defined_assignment(!fir.ref<f32>, !fir.ref<f32>)
// -----
// 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<!fir.array<10x!fir.type<_QTd{i:!fir.array<10xi32>}>>>
%c1_i32 = arith.constant 1 : i32
@ -372,7 +372,7 @@ func @array_of_types() {
// -----
// Test fir.array_load/boxed array
func @conversion_with_temporary_boxed_array(%arr0 : !fir.box<!fir.array<10xi32>>) {
func.func @conversion_with_temporary_boxed_array(%arr0 : !fir.box<!fir.array<10xi32>>) {
%c10 = arith.constant 10 : index
%1:3 = fir.box_dims %arr0, %c10 : (!fir.box<!fir.array<10xi32>>, index) -> (index, index, index)
%shift = fir.shift %1#0 : (index) -> !fir.shift<1>
@ -430,7 +430,7 @@ func @conversion_with_temporary_boxed_array(%arr0 : !fir.box<!fir.array<10xi32>>
// -----
// Test simple fir.array_update with Fortran.offsets attribute.
func @array_update_conversion(%arr1 : !fir.box<!fir.array<?x?xf32>>, %m: index, %n: index) {
func.func @array_update_conversion(%arr1 : !fir.box<!fir.array<?x?xf32>>, %m: index, %n: index) {
%c10 = arith.constant 10 : index
%c20 = arith.constant 20 : index
%c1 = arith.constant 1 : index
@ -450,7 +450,7 @@ func @array_update_conversion(%arr1 : !fir.box<!fir.array<?x?xf32>>, %m: index,
// -----
// Test fir.array_fetch on derived type members in an array of derived types.
func @array_fetch_derived_type(%0 : !fir.ref<!fir.array<10x!fir.type<_QTu{mt:!fir.type<_QTt{mem:i32}>}>>>) {
func.func @array_fetch_derived_type(%0 : !fir.ref<!fir.array<10x!fir.type<_QTu{mt:!fir.type<_QTt{mem:i32}>}>>>) {
%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 @@ func @array_fetch_derived_type(%0 : !fir.ref<!fir.array<10x!fir.type<_QTu{mt:!fi
// -----
// 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<!fir.array<?x?xf32>>, %m: index, %n: index) {
func.func @array_update_conversion(%arr1 : !fir.box<!fir.array<?x?xf32>>, %m: index, %n: index) {
%c10 = arith.constant 10 : index
%c20 = arith.constant 20 : index
%c1 = arith.constant 1 : index
@ -507,7 +507,7 @@ func @array_update_conversion(%arr1 : !fir.box<!fir.array<?x?xf32>>, %m: index,
// Test array operation with conditional update.
func @array_operation_with_cond_update(%arg0: !fir.ref<!fir.array<100xf32>>, %cond1: i1) {
func.func @array_operation_with_cond_update(%arg0: !fir.ref<!fir.array<100xf32>>, %cond1: i1) {
%c100 = arith.constant 100 : index
%c1 = arith.constant 1 : index
%c-1 = arith.constant -1 : index

View File

@ -1,7 +1,7 @@
// RUN: tco %s | FileCheck %s
// CHECK-LABEL: define void @x([10 x float]* %0)
func @x(%arr : !fir.ref<!fir.array<10xf32>>) {
func.func @x(%arr : !fir.ref<!fir.array<10xf32>>) {
%1 = arith.constant 0 : index
%2 = arith.constant 9 : index
%stepvar = arith.constant 1 : index
@ -21,4 +21,4 @@ func @x(%arr : !fir.ref<!fir.array<10xf32>>) {
return
}
func private @y(!fir.box<!fir.array<10xf32>>) -> ()
func.func private @y(!fir.box<!fir.array<10xf32>>) -> ()

View File

@ -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
}

View File

@ -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<!fir.array<?xi32>>) {
func.func @check_no_folding(%arg0 : !fir.ref<!fir.array<?xi32>>) {
%0 = fir.alloca i32 {adapt.valuebyref}
%c1_i32 = arith.constant 1 : i32
%1 = fir.load %0 : !fir.ref<i32>
@ -19,14 +19,14 @@ func @check_no_folding(%arg0 : !fir.ref<!fir.array<?xi32>>) {
return
}
func @check(%arg0: !fir.ref<!fir.array<?xi32>>) {
func.func @check(%arg0: !fir.ref<!fir.array<?xi32>>) {
return
}
// -----
// CHECK-LABEL: func @check_folding
func @check_folding(%arg0 : !fir.ref<!fir.array<?xi32>>) {
func.func @check_folding(%arg0 : !fir.ref<!fir.array<?xi32>>) {
%0 = fir.alloca i32 {adapt.valuebyref}
%c1_i32 = arith.constant 1 : i32
%1 = fir.load %0 : !fir.ref<i32>
@ -41,6 +41,6 @@ func @check_folding(%arg0 : !fir.ref<!fir.array<?xi32>>) {
return
}
func @check(%arg0: !fir.ref<!fir.array<?xi32>>) {
func.func @check(%arg0: !fir.ref<!fir.array<?xi32>>) {
return
}

View File

@ -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<!fir.char<1,9>>
%2 = arith.constant 9 : i64
%3 = fir.convert %1 : (!fir.ref<!fir.char<1,9>>) -> !fir.ref<!fir.char<1,?>>

View File

@ -2,7 +2,7 @@
// CHECK-LABEL: func @codegen(
// CHECK-SAME: %[[arg:.*]]: !fir
func @codegen(%addr : !fir.ref<!fir.array<?xi32>>) {
func.func @codegen(%addr : !fir.ref<!fir.array<?xi32>>) {
// 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 @@ fir.global @box_global : !fir.box<!fir.array<?xi32>> {
// CHECK-LABEL: func @codegen(
// CHECK-SAME: %[[arg:.*]]: !fir
func @codegen(%addr : !fir.ref<!fir.array<?xi32>>) {
func.func @codegen(%addr : !fir.ref<!fir.array<?xi32>>) {
// 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 @@ func @codegen(%addr : !fir.ref<!fir.array<?xi32>>) {
// CHECK-LABEL: func @codegen(
// CHECK-SAME: %[[arg:.*]]: !fir
func @codegen(%addr : !fir.box<!fir.array<?xf32>>) {
func.func @codegen(%addr : !fir.box<!fir.array<?xf32>>) {
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
%c10 = arith.constant 10 : index

View File

@ -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<!fir.char<1>>
%3 = fir.undefined !fir.ref<!fir.array<?x!fir.char<2,?>>>

View File

@ -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 @@ func @ftest(%x : i1) -> i1 {
}
// 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 @@ func @gtest(%x : !fir.logical<2>) -> !fir.logical<2> {
}
// 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 @@ func @htest(%x : !fir.int<4>) -> !fir.int<4> {
}
// 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

View File

@ -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 @@ fir.dt_entry "method", @method_impl
// Test `fir.shape` conversion failure because the op has uses.
func @shape_not_dead(%arg0: !fir.ref<!fir.array<?x?xf32>>, %i: index, %j: index) {
func.func @shape_not_dead(%arg0: !fir.ref<!fir.array<?x?xf32>>, %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 @@ func @shape_not_dead(%arg0: !fir.ref<!fir.array<?x?xf32>>, %i: index, %j: index)
// Test `fir.slice` conversion failure because the op has uses.
func @slice_not_dead(%arg0: !fir.ref<!fir.array<?x?xf32>>, %i: index, %j: index) {
func.func @slice_not_dead(%arg0: !fir.ref<!fir.array<?x?xf32>>, %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 @@ func @slice_not_dead(%arg0: !fir.ref<!fir.array<?x?xf32>>, %i: index, %j: index)
// Test `fir.shift` conversion failure because the op has uses.
func @shift_not_dead(%arg0: !fir.box<!fir.array<?xf32>>, %i: index) {
func.func @shift_not_dead(%arg0: !fir.box<!fir.array<?xf32>>, %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 @@ func @shift_not_dead(%arg0: !fir.box<!fir.array<?xf32>>, %i: index) {
// Test `fir.shape_shift` conversion failure because the op has uses.
func @shape_shift_not_dead(%arg0: !fir.ref<!fir.array<?x?xf32>>, %i: index, %j: index) {
func.func @shape_shift_not_dead(%arg0: !fir.ref<!fir.array<?x?xf32>>, %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 @@ func @shape_shift_not_dead(%arg0: !fir.ref<!fir.array<?x?xf32>>, %i: index, %j:
// Test `fir.select_type` conversion to llvm.
// Should have been converted.
func @bar_select_type(%arg : !fir.box<!fir.ref<f32>>) -> i32 {
func.func @bar_select_type(%arg : !fir.box<!fir.ref<f32>>) -> 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 @@ func @bar_select_type(%arg : !fir.box<!fir.ref<f32>>) -> i32 {
// -----
// `fir.coordinate_of` - dynamically sized arrays are not supported
func @coordinate_of_dynamic_array(%arg0: !fir.ref<!fir.array<1x!fir.char<4,?>>>, %arg1: index) {
func.func @coordinate_of_dynamic_array(%arg0: !fir.ref<!fir.array<1x!fir.char<4,?>>>, %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<!fir.array<1x!fir.char<4,?>>>, index) -> !fir.ref<f32>

View File

@ -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<i32> {fir.bindc_name = "n"}, %arg1: !fir.ref<!fir.array<?xi32>> {fir.bindc_name = "arr"}) {
func.func @_QPsb1(%arg0: !fir.ref<i32> {fir.bindc_name = "n"}, %arg1: !fir.ref<!fir.array<?xi32>> {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 @_QPsb1(%arg0: !fir.ref<i32> {fir.bindc_name = "n"}, %arg1: !fir.ref<!fir.a
// -----
func @_QPsb2(%arg0: !fir.ref<i32> {fir.bindc_name = "x"}, %arg1: !fir.ref<i32> {fir.bindc_name = "n"}) {
func.func @_QPsb2(%arg0: !fir.ref<i32> {fir.bindc_name = "x"}, %arg1: !fir.ref<i32> {fir.bindc_name = "n"}) {
omp.parallel {
omp.master {
%0 = fir.load %arg1 : !fir.ref<i32>

View File

@ -9,7 +9,7 @@
// Test fir.emboxchar
func @test_embox(%char_array : !fir.ref<!fir.char<1,?>>) -> () {
func.func @test_embox(%char_array : !fir.ref<!fir.char<1,?>>) -> () {
%c10 = arith.constant 10 : i64
%box_char = fir.emboxchar %char_array, %c10 : (!fir.ref<!fir.char<1,?>>, i64) -> !fir.boxchar<1>
return
@ -36,7 +36,7 @@ func @test_embox(%char_array : !fir.ref<!fir.char<1,?>>) -> () {
// 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<!fir.char<1>>, i64)
return
}
@ -54,7 +54,7 @@ func @unboxchar_i8(%arg0 : !fir.boxchar<1>) -> () {
// 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<!fir.char<4>>, i64)
return
}
@ -76,7 +76,7 @@ func @unboxchar_i32(%arg0 : !fir.boxchar<4>) -> () {
// 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 @@ func @boxchar_len_i8_i32(%arg0 : !fir.boxchar<1>) -> () {
// 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 @@ func @boxchar_len_i8_i64(%arg0 : !fir.boxchar<1>) -> () {
// 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 @@ func @boxchar_len_i32_i32(%arg0 : !fir.boxchar<4>) -> () {
// 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
}

View File

@ -55,7 +55,7 @@ fir.global linkonce @w_i86 (86:i32) : i32
// Test conversion of fir.address_of with fir.global
func @f1() {
func.func @f1() {
%0 = fir.address_of(@symbol) : !fir.ref<i64>
return
}
@ -115,7 +115,7 @@ fir.global internal @_QEmultiarray : !fir.array<32xi32> {
// Test fir.zero_bits operation with LLVM ptr type
func @zero_test_ptr() {
func.func @zero_test_ptr() {
%z = fir.zero_bits !llvm.ptr<f32>
return
}
@ -127,7 +127,7 @@ func @zero_test_ptr() {
// 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 @@ func @zero_test_integer() {
// 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 @@ func @zero_test_float() {
// 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<i32>
return
@ -186,7 +186,7 @@ func @test_alloc_and_freemem_one() {
// 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<!fir.array<100xf32>>
return
@ -203,7 +203,7 @@ func @test_alloc_and_freemem_several() {
// 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<?x?xf32>, %ncols, %nrows
fir.freemem %1 : !fir.heap<!fir.array<?x?xf32>>
return
@ -221,7 +221,7 @@ func @test_with_shape(%ncols: index, %nrows: index) {
// 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<?x!fir.char<1,?>>(%len : index), %nelems
fir.freemem %1 : !fir.heap<!fir.array<?x!fir.char<1,?>>>
return
@ -243,7 +243,7 @@ func @test_string_with_shape(%len: index, %nelems: index) {
// Verify that fir.unreachable is transformed to llvm.unreachable
func @test_unreachable() {
func.func @test_unreachable() {
fir.unreachable
}
@ -257,7 +257,7 @@ func @test_unreachable() {
// 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 @@ func @select(%arg : index, %arg2 : i32) -> i32 {
// 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 @@ func @select_rank(%arg : i32, %arg2 : i32) -> i32 {
// 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<derived{f:f32}>
%1 = fir.extract_value %0, ["f", !fir.type<derived{f:f32}>] : (!fir.type<derived{f:f32}>) -> f32
return %1 : f32
@ -363,7 +363,7 @@ func @extract_derived_type() -> f32 {
// Test fir.extract_value operation conversion with a multi-dimensional array
// of tuple.
func @extract_array(%a : !fir.array<10x10xtuple<i32, f32>>) -> f32 {
func.func @extract_array(%a : !fir.array<10x10xtuple<i32, f32>>) -> f32 {
%0 = fir.extract_value %a, [5 : index, 4 : index, 1 : index] : (!fir.array<10x10xtuple<i32, f32>>) -> f32
return %0 : f32
}
@ -378,7 +378,7 @@ func @extract_array(%a : !fir.array<10x10xtuple<i32, f32>>) -> f32 {
// Test fir.insert_value operation conversion with a multi-dimensional array
// of tuple.
func @extract_array(%a : !fir.array<10x10xtuple<i32, f32>>) {
func.func @extract_array(%a : !fir.array<10x10xtuple<i32, f32>>) {
%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, f32>>, i32) -> !fir.array<10x10xtuple<i32, f32>>
@ -396,7 +396,7 @@ func @extract_array(%a : !fir.array<10x10xtuple<i32, f32>>) {
// Test fir.insert_value operation conversion with derived type.
func @insert_tuple(%a : tuple<i32, f32>) {
func.func @insert_tuple(%a : tuple<i32, f32>) {
%f = arith.constant 2.0 : f32
%1 = fir.insert_value %a, %f, [1 : index] : (tuple<i32, f32>, f32) -> tuple<i32, f32>
return
@ -412,11 +412,11 @@ func @insert_tuple(%a : tuple<i32, f32>) {
// 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 @@ func @test_call_basic() {
// 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 @@ func @test_call_with_arg(%arg0 : i32) {
// 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 @@ func @test_call_return_val() -> i32 {
// 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 @@ func @fir_complex_add(%a: !fir.complex<16>, %b: !fir.complex<16>) -> !fir.comple
// 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 @@ func @fir_complex_sub(%a: !fir.complex<16>, %b: !fir.complex<16>) -> !fir.comple
// 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 @@ func @fir_complex_mul(%a: !fir.complex<16>, %b: !fir.complex<16>) -> !fir.comple
// 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 @@ func @fir_complex_div(%a: !fir.complex<16>, %b: !fir.complex<16>) -> !fir.comple
// 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 @@ func @fir_complex_neg(%a: !fir.complex<16>) -> !fir.complex<16> {
// 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 @@ func @compare_complex_eq(%a : !fir.complex<8>, %b : !fir.complex<8>) -> i1 {
// 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 @@ func @compare_complex_ne(%a : !fir.complex<8>, %b : !fir.complex<8>) -> i1 {
// 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 @@ func @compare_complex_other(%a : !fir.complex<8>, %b : !fir.complex<8>) -> i1 {
// 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 @@ func @convert_from_float(%arg0 : f32) {
// 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 @@ func @convert_from_int(%arg0 : i32) {
// Test `fir.convert` operation conversion from !fir.ref<> type.
func @convert_from_ref(%arg0 : !fir.ref<i32>) {
func.func @convert_from_ref(%arg0 : !fir.ref<i32>) {
%0 = fir.convert %arg0 : (!fir.ref<i32>) -> !fir.ref<i8>
%1 = fir.convert %arg0 : (!fir.ref<i32>) -> i32
return
@ -730,7 +730,7 @@ func @convert_from_ref(%arg0 : !fir.ref<i32>) {
// 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 @@ func @convert_complex4(%arg0 : !fir.complex<4>) -> !fir.complex<8> {
// 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 @@ func @convert_complex16(%arg0 : !fir.complex<16>) -> !fir.complex<2> {
// 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 @@ func @test_constc4() -> !fir.complex<4> {
// 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 @@ func @test_constc8() -> !fir.complex<8> {
// Test `fir.store` --> `llvm.store` conversion
func @test_store_index(%val_to_store : index, %addr : !fir.ref<index>) {
func.func @test_store_index(%val_to_store : index, %addr : !fir.ref<index>) {
fir.store %val_to_store to %addr : !fir.ref<index>
return
}
@ -811,7 +811,7 @@ func @test_store_index(%val_to_store : index, %addr : !fir.ref<index>) {
// CHECK-NEXT: llvm.return
// CHECK-NEXT: }
func @test_store_box(%array : !fir.ref<!fir.box<!fir.array<?x?xf32>>>, %box : !fir.box<!fir.array<?x?xf32>>) {
func.func @test_store_box(%array : !fir.ref<!fir.box<!fir.array<?x?xf32>>>, %box : !fir.box<!fir.array<?x?xf32>>) {
fir.store %box to %array : !fir.ref<!fir.box<!fir.array<?x?xf32>>>
return
}
@ -828,7 +828,7 @@ func @test_store_box(%array : !fir.ref<!fir.box<!fir.array<?x?xf32>>>, %box : !f
// Test `fir.load` --> `llvm.load` conversion
func @test_load_index(%addr : !fir.ref<index>) {
func.func @test_load_index(%addr : !fir.ref<index>) {
%0 = fir.load %addr : !fir.ref<index>
return
}
@ -839,7 +839,7 @@ func @test_load_index(%addr : !fir.ref<index>) {
// CHECK-NEXT: llvm.return
// CHECK-NEXT: }
func @test_load_box(%addr : !fir.ref<!fir.box<!fir.array<10xf32>>>) {
func.func @test_load_box(%addr : !fir.ref<!fir.box<!fir.array<10xf32>>>) {
%0 = fir.load %addr : !fir.ref<!fir.box<!fir.array<10xf32>>>
return
}
@ -854,7 +854,7 @@ func @test_load_box(%addr : !fir.ref<!fir.box<!fir.array<10xf32>>>) {
// Test `fir.box_rank` conversion.
func @extract_rank(%arg0: !fir.box<!fir.array<*:f64>>) -> i32 {
func.func @extract_rank(%arg0: !fir.box<!fir.array<*:f64>>) -> i32 {
%0 = fir.box_rank %arg0 : (!fir.box<!fir.array<*:f64>>) -> i32
return %0 : i32
}
@ -870,7 +870,7 @@ func @extract_rank(%arg0: !fir.box<!fir.array<*:f64>>) -> i32 {
// Test `fir.box_addr` conversion.
func @extract_addr(%arg0: !fir.box<!fir.array<*:f64>>) -> !fir.ref<f64> {
func.func @extract_addr(%arg0: !fir.box<!fir.array<*:f64>>) -> !fir.ref<f64> {
%0 = fir.box_addr %arg0 : (!fir.box<!fir.array<*:f64>>) -> !fir.ref<f64>
return %0 : !fir.ref<f64>
}
@ -886,7 +886,7 @@ func @extract_addr(%arg0: !fir.box<!fir.array<*:f64>>) -> !fir.ref<f64> {
// Test `fir.box_dims` conversion.
func @extract_dims(%arg0: !fir.box<!fir.array<*:f64>>) -> index {
func.func @extract_dims(%arg0: !fir.box<!fir.array<*:f64>>) -> index {
%c1 = arith.constant 0 : i32
%cast = fir.convert %arg0 : (!fir.box<!fir.array<*:f64>>) -> !fir.box<!fir.array<?xf64>>
%0:3 = fir.box_dims %cast, %c1 : (!fir.box<!fir.array<?xf64>>, i32) -> (index, index, index)
@ -913,7 +913,7 @@ func @extract_dims(%arg0: !fir.box<!fir.array<*:f64>>) -> index {
// Test `fir.box_elesize` conversion.
func @extract_elesize(%arg0: !fir.box<f32>) -> i32 {
func.func @extract_elesize(%arg0: !fir.box<f32>) -> i32 {
%0 = fir.box_elesize %arg0 : (!fir.box<f32>) -> i32
return %0 : i32
}
@ -930,7 +930,7 @@ func @extract_elesize(%arg0: !fir.box<f32>) -> i32 {
// Test `fir.box_isarray` conversion.
// `rank` is extracted from `fir.box` and compare to 0.
func @box_isarray(%arg0: !fir.box<!fir.array<*:f64>>) -> i1 {
func.func @box_isarray(%arg0: !fir.box<!fir.array<*:f64>>) -> i1 {
%0 = fir.box_isarray %arg0 : (!fir.box<!fir.array<*:f64>>) -> i1
return %0 : i1
}
@ -950,7 +950,7 @@ func @box_isarray(%arg0: !fir.box<!fir.array<*:f64>>) -> i1 {
// `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<!fir.array<*:f64>>) -> i1 {
func.func @box_isalloc(%arg0: !fir.box<!fir.array<*:f64>>) -> i1 {
%0 = fir.box_isalloc %arg0 : (!fir.box<!fir.array<*:f64>>) -> i1
return %0 : i1
}
@ -972,7 +972,7 @@ func @box_isalloc(%arg0: !fir.box<!fir.array<*:f64>>) -> i1 {
// `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<!fir.array<*:f64>>) -> i1 {
func.func @box_isptr(%arg0: !fir.box<!fir.array<*:f64>>) -> i1 {
%0 = fir.box_isptr %arg0 : (!fir.box<!fir.array<*:f64>>) -> i1
return %0 : i1
}
@ -992,7 +992,7 @@ func @box_isptr(%arg0: !fir.box<!fir.array<*:f64>>) -> i1 {
// Test fir.alloca of one element
func @alloca_one() -> !fir.ref<i32> {
func.func @alloca_one() -> !fir.ref<i32> {
%1 = fir.alloca i32
return %1 : !fir.ref<i32>
}
@ -1006,7 +1006,7 @@ func @alloca_one() -> !fir.ref<i32> {
// Test fir.alloca of several elements
func @alloca_several() -> !fir.ref<i32> {
func.func @alloca_several() -> !fir.ref<i32> {
%0 = arith.constant 100 : index
%1 = fir.alloca i32, %0
return %1 : !fir.ref<i32>
@ -1023,7 +1023,7 @@ func @alloca_several() -> !fir.ref<i32> {
// Test fir.alloca of pointer to array
func @alloca_ptr_to_array() -> !fir.ref<!fir.ptr<!fir.array<?xi32>>> {
func.func @alloca_ptr_to_array() -> !fir.ref<!fir.ptr<!fir.array<?xi32>>> {
%1 = fir.alloca !fir.ptr<!fir.array<?xi32>>
return %1 : !fir.ref<!fir.ptr<!fir.array<?xi32>>>
}
@ -1037,7 +1037,7 @@ func @alloca_ptr_to_array() -> !fir.ref<!fir.ptr<!fir.array<?xi32>>> {
// Test fir.alloca of array of unknown-length chars
func @alloca_char_array(%l: i32, %e : index) -> !fir.ref<!fir.array<?x?x!fir.char<1,?>>> {
func.func @alloca_char_array(%l: i32, %e : index) -> !fir.ref<!fir.array<?x?x!fir.char<1,?>>> {
%a = fir.alloca !fir.array<?x?x!fir.char<1,?>>(%l : i32), %e, %e
return %a : !fir.ref<!fir.array<?x?x!fir.char<1,?>>>
}
@ -1055,7 +1055,7 @@ func @alloca_char_array(%l: i32, %e : index) -> !fir.ref<!fir.array<?x?x!fir.cha
// Test fir.alloca of array of known-length chars
func @alloca_fixed_char_array(%e : index) -> !fir.ref<!fir.array<?x?x!fir.char<1,8>>> {
func.func @alloca_fixed_char_array(%e : index) -> !fir.ref<!fir.array<?x?x!fir.char<1,8>>> {
%a = fir.alloca !fir.array<?x?x!fir.char<1,8>>, %e, %e
return %a : !fir.ref<!fir.array<?x?x!fir.char<1,8>>>
}
@ -1078,9 +1078,9 @@ func @alloca_fixed_char_array(%e : index) -> !fir.ref<!fir.array<?x?x!fir.char<1
// 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<!fir.type<_QTt(p1:i32,p2:i16){f1:i32,f2:f32}>> {
func.func @alloca_record(%arg0 : i32, %arg1 : i16) -> !fir.ref<!fir.type<_QTt(p1:i32,p2:i16){f1:i32,f2:f32}>> {
%0 = fir.alloca !fir.type<_QTt(p1:i32,p2:i16){f1:i32,f2:f32}>(%arg0, %arg1 : i32, i16) {name = "_QEvar"}
return %0 : !fir.ref<!fir.type<_QTt(p1:i32,p2:i16){f1:i32,f2:f32}>>
}
@ -1097,7 +1097,7 @@ func @alloca_record(%arg0 : i32, %arg1 : i16) -> !fir.ref<!fir.type<_QTt(p1:i32,
// Test fir.alloca of a multidimensional array, with operands
func @alloca_multidim_array(%0 : index) -> !fir.ref<!fir.array<8x16x32xf32>> {
func.func @alloca_multidim_array(%0 : index) -> !fir.ref<!fir.array<8x16x32xf32>> {
%1 = arith.constant 24 : index
%2 = fir.alloca !fir.array<8x16x32xf32>, %0, %1
return %2 : !fir.ref<!fir.array<8x16x32xf32>>
@ -1116,7 +1116,7 @@ func @alloca_multidim_array(%0 : index) -> !fir.ref<!fir.array<8x16x32xf32>> {
// Test fir.alloca of a multidimensional array with constant interior
func @alloca_const_interior_array(%0 : index) -> !fir.ref<!fir.array<8x9x?x?xf32>> {
func.func @alloca_const_interior_array(%0 : index) -> !fir.ref<!fir.array<8x9x?x?xf32>> {
%1 = arith.constant 64 : index
%2 = fir.alloca !fir.array<8x9x?x?xf32>, %0, %1
return %2 : !fir.ref<!fir.array<8x9x?x?xf32>>
@ -1136,7 +1136,7 @@ func @alloca_const_interior_array(%0 : index) -> !fir.ref<!fir.array<8x9x?x?xf32
// 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<!fir.array<4x?x3x?x5xi32>> {
func.func @alloca_array_with_holes(%0 : index, %1 : index) -> !fir.ref<!fir.array<4x?x3x?x5xi32>> {
%a = fir.alloca !fir.array<4x?x3x?x5xi32>, %0, %1
return %a : !fir.ref<!fir.array<4x?x3x?x5xi32>>
}
@ -1155,7 +1155,7 @@ func @alloca_array_with_holes(%0 : index, %1 : index) -> !fir.ref<!fir.array<4x?
// Test `fir.select_case` operation conversion with INTEGER.
func @select_case_integer(%arg0: !fir.ref<i32>) -> i32 {
func.func @select_case_integer(%arg0: !fir.ref<i32>) -> i32 {
%2 = fir.load %arg0 : !fir.ref<i32>
%c1_i32 = arith.constant 1 : i32
%c2_i32 = arith.constant 2 : i32
@ -1265,7 +1265,7 @@ func @select_case_integer(%arg0: !fir.ref<i32>) -> i32 {
// Test `fir.select_case` operation conversion with LOGICAL.
func @select_case_logical(%arg0: !fir.ref<!fir.logical<4>>) {
func.func @select_case_logical(%arg0: !fir.ref<!fir.logical<4>>) {
%1 = fir.load %arg0 : !fir.ref<!fir.logical<4>>
%2 = fir.convert %1 : (!fir.logical<4>) -> i1
%false = arith.constant false
@ -1308,7 +1308,7 @@ func @select_case_logical(%arg0: !fir.ref<!fir.logical<4>>) {
// Test `fir.is_present`
func @test_is_present_i64(%arg0: !fir.ref<i64>) -> () {
func.func @test_is_present_i64(%arg0: !fir.ref<i64>) -> () {
%0 = fir.is_present %arg0 : (!fir.ref<i64>) -> i1
return
}
@ -1321,7 +1321,7 @@ func @test_is_present_i64(%arg0: !fir.ref<i64>) -> () {
// CHECK-NEXT: llvm.return
// CHECK-NEXT: }
func @test_is_present_box(%arg0: !fir.box<!fir.ref<i64>>) -> () {
func.func @test_is_present_box(%arg0: !fir.box<!fir.ref<i64>>) -> () {
%0 = fir.is_present %arg0 : (!fir.box<!fir.ref<i64>>) -> i1
return
}
@ -1339,7 +1339,7 @@ func @test_is_present_box(%arg0: !fir.box<!fir.ref<i64>>) -> () {
// Test `fir.absent`
func @test_absent_i64() -> () {
func.func @test_absent_i64() -> () {
%0 = fir.absent !fir.ref<i64>
return
}
@ -1349,7 +1349,7 @@ func @test_absent_i64() -> () {
// CHECK-NEXT: llvm.return
// CHECK-NEXT: }
func @test_absent_box() -> () {
func.func @test_absent_box() -> () {
%0 = fir.absent !fir.box<!fir.array<?xf32>>
return
}
@ -1363,7 +1363,7 @@ func @test_absent_box() -> () {
// This is a bit more comprehensive test for `fir.is_present` and `fir.absent`
// when used together
func @is_present(%arg0: !fir.ref<i64>) -> i1 {
func.func @is_present(%arg0: !fir.ref<i64>) -> i1 {
%0 = fir.is_present %arg0 : (!fir.ref<i64>) -> i1
return %0 : i1
}
@ -1376,7 +1376,7 @@ func @is_present(%arg0: !fir.ref<i64>) -> i1 {
// CHECK-NEXT: llvm.return %[[ret_val]] : i1
// CHECK-NEXT: }
func @absent() -> i1 {
func.func @absent() -> i1 {
%0 = fir.absent !fir.ref<i64>
%1 = fir.call @is_present(%0) : (!fir.ref<i64>) -> i1
return %1 : i1
@ -1392,7 +1392,7 @@ func @absent() -> i1 {
// 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 @@ func @string_lit0() {
// 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 @@ func @string_lit1() {
// 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 @@ func @dead_shift() {
// 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 @@ func @dead_shape() {
// 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 @@ func @dead_shapeshift() {
// 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 @@ func @dead_slice() {
// Test `fir.box_tdesc` conversion.
func @box_tdesc(%arg0: !fir.box<f64>) {
func.func @box_tdesc(%arg0: !fir.box<f64>) {
%0 = fir.box_tdesc %arg0 : (!fir.box<f64>) -> !fir.tdesc<f64>
return
}
@ -1481,7 +1481,7 @@ func @box_tdesc(%arg0: !fir.box<f64>) {
// position of the fields in the descriptor as defined in `CFI_cdesc_t` in
// flang/ISO_Fortran_binding.h.
func @embox0(%arg0: !fir.ref<!fir.array<100xi32>>) {
func.func @embox0(%arg0: !fir.ref<!fir.array<100xi32>>) {
%0 = fir.embox %arg0() : (!fir.ref<!fir.array<100xi32>>) -> !fir.box<!fir.array<100xi32>>
return
}
@ -1530,7 +1530,7 @@ fir.global @box_global : !fir.ref<!fir.array<?xi32>> {
// 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<i32>) {
func.func @embox_pointer(%arg0: !fir.ref<i32>) {
%0 = fir.embox %arg0 : (!fir.ref<i32>) -> !fir.box<!fir.ptr<i32>>
return
}
@ -1546,7 +1546,7 @@ func @embox_pointer(%arg0: !fir.ref<i32>) {
// 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<!fir.array<?x!fir.char<1,10>>>) {
func.func @embox_allocatable(%arg0: !fir.heap<!fir.array<?x!fir.char<1,10>>>) {
%0 = fir.embox %arg0 : (!fir.heap<!fir.array<?x!fir.char<1,10>>>) -> !fir.box<!fir.heap<!fir.array<?x!fir.char<1,10>>>>
return
}
@ -1558,7 +1558,7 @@ func @embox_allocatable(%arg0: !fir.heap<!fir.array<?x!fir.char<1,10>>>) {
// Check `fir.embox` conversion of a type code.
func @embox_typecode0(%arg0: !fir.ref<i64>) {
func.func @embox_typecode0(%arg0: !fir.ref<i64>) {
%0 = fir.embox %arg0 : (!fir.ref<i64>) -> !fir.box<!fir.ptr<i64>>
return
}
@ -1568,7 +1568,7 @@ func @embox_typecode0(%arg0: !fir.ref<i64>) {
// 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<i64>, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}})>
func @embox_typecode1(%arg0: !fir.ref<f32>) {
func.func @embox_typecode1(%arg0: !fir.ref<f32>) {
%0 = fir.embox %arg0 : (!fir.ref<f32>) -> !fir.box<!fir.ptr<f32>>
return
}
@ -1578,7 +1578,7 @@ func @embox_typecode1(%arg0: !fir.ref<f32>) {
// 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<f32>, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}})>
func @embox_typecode2(%arg0: !fir.ref<f128>) {
func.func @embox_typecode2(%arg0: !fir.ref<f128>) {
%0 = fir.embox %arg0 : (!fir.ref<f128>) -> !fir.box<!fir.ptr<f128>>
return
}
@ -1588,7 +1588,7 @@ func @embox_typecode2(%arg0: !fir.ref<f128>) {
// 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<f128>, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}})>
func @embox_typecode3(%arg0: !fir.ref<!fir.complex<4>>) {
func.func @embox_typecode3(%arg0: !fir.ref<!fir.complex<4>>) {
%0 = fir.embox %arg0 : (!fir.ref<!fir.complex<4>>) -> !fir.box<!fir.ptr<!fir.complex<4>>>
return
}
@ -1598,7 +1598,7 @@ func @embox_typecode3(%arg0: !fir.ref<!fir.complex<4>>) {
// 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<struct<(f32, f32)>>, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}})>
func @embox_typecode4(%arg0: !fir.ref<!fir.logical<1>>) {
func.func @embox_typecode4(%arg0: !fir.ref<!fir.logical<1>>) {
%0 = fir.embox %arg0 : (!fir.ref<!fir.logical<1>>) -> !fir.box<!fir.ptr<!fir.logical<1>>>
return
}
@ -1619,7 +1619,7 @@ func @embox_typecode4(%arg0: !fir.ref<!fir.logical<1>>) {
fir.global linkonce @_QMtest_dinitE.dt.tseq constant : i8
func @embox1(%arg0: !fir.ref<!fir.type<_QMtest_dinitTtseq{i:i32}>>) {
func.func @embox1(%arg0: !fir.ref<!fir.type<_QMtest_dinitTtseq{i:i32}>>) {
%0 = fir.embox %arg0() : (!fir.ref<!fir.type<_QMtest_dinitTtseq{i:i32}>>) -> !fir.box<!fir.type<_QMtest_dinitTtseq{i:i32}>>
return
}
@ -1640,7 +1640,7 @@ func @embox1(%arg0: !fir.ref<!fir.type<_QMtest_dinitTtseq{i:i32}>>) {
// 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<t1{i:i32}>
return
}
@ -1649,7 +1649,7 @@ func @field_index_static_size_1_elem() -> () {
// 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<t2{i:i32, j:f32, k:i8}>
return
}
@ -1661,10 +1661,10 @@ func @field_index_static_size_3_elems() -> () {
// 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<custom_type{field_1:i32, field_2:!fir.array<?xf32>}>
%2 = fir.field_index field_2, !fir.type<custom_type{field_1:i32, field_2:!fir.array<?xf32>}>
return
@ -1679,7 +1679,7 @@ func @field_index_dynamic_size() -> () {
// Check `fir.no_reassoc` conversion to LLVM IR dialect
func @no_reassoc(%arg0: !fir.ref<i32>) {
func.func @no_reassoc(%arg0: !fir.ref<i32>) {
%0 = fir.alloca i32
%1 = fir.load %arg0 : !fir.ref<i32>
%2 = fir.no_reassoc %1 : i32
@ -1701,7 +1701,7 @@ func @no_reassoc(%arg0: !fir.ref<i32>) {
// Check complete `fircg.ext_embox`.
func @xembox0(%arg0: !fir.ref<!fir.array<?xi32>>) {
func.func @xembox0(%arg0: !fir.ref<!fir.array<?xi32>>) {
%c0 = arith.constant 0 : i64
%0 = fircg.ext_embox %arg0(%c0) origin %c0[%c0, %c0, %c0] : (!fir.ref<!fir.array<?xi32>>, i64, i64, i64, i64, i64) -> !fir.box<!fir.array<?xi32>>
return
@ -1754,7 +1754,7 @@ func @xembox0(%arg0: !fir.ref<!fir.array<?xi32>>) {
// Check adjustment of element scaling factor.
func @xembox1(%arg0: !fir.ref<!fir.array<?x!fir.char<1, 10>>>) {
func.func @xembox1(%arg0: !fir.ref<!fir.array<?x!fir.char<1, 10>>>) {
%c0 = arith.constant 0 : i64
%0 = fircg.ext_embox %arg0(%c0) origin %c0[%c0, %c0, %c0] : (!fir.ref<!fir.array<?x!fir.char<1, 10>>>, i64, i64, i64, i64, i64) -> !fir.box<!fir.array<?x!fir.char<1, 10>>>
return
@ -1779,7 +1779,7 @@ func @xembox1(%arg0: !fir.ref<!fir.array<?x!fir.char<1, 10>>>) {
// ```
// 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 @@ func @_QPsb(%N: index, %sh1: index, %sh2: index) {
fir.call @_QPxb(%box) : (!fir.box<!fir.array<?x?xf64>>) -> ()
return
}
func private @_QPxb(!fir.box<!fir.array<?x?xf64>>)
func.func private @_QPxb(!fir.box<!fir.array<?x?xf64>>)
// CHECK-LABEL: llvm.func @_QPsb(
// CHECK-SAME: %[[N:.*]]: i64, %[[SH1:.*]]: i64, %[[SH2:.*]]: i64) {
@ -1865,7 +1865,7 @@ func private @_QPxb(!fir.box<!fir.array<?x?xf64>>)
// 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 @@ func @_QPtest_dt_slice() {
fir.call @_QPtest_dt_callee(%5) : (!fir.box<!fir.array<?xi32>>) -> ()
return
}
func private @_QPtest_dt_callee(%arg0: !fir.box<!fir.array<?xi32>>)
func.func private @_QPtest_dt_callee(%arg0: !fir.box<!fir.array<?xi32>>)
// CHECK-LABEL: llvm.func @_QPtest_dt_slice
// CHECK: %[[ALLOCA_SIZE:.*]] = llvm.mlir.constant(1 : i32) : i32
@ -1937,7 +1937,7 @@ func private @_QPtest_dt_callee(%arg0: !fir.box<!fir.array<?xi32>>)
// Conversion with only shape and indice.
func @ext_array_coor0(%arg0: !fir.ref<!fir.array<?xi32>>) {
func.func @ext_array_coor0(%arg0: !fir.ref<!fir.array<?xi32>>) {
%c0 = arith.constant 0 : i64
%1 = fircg.ext_array_coor %arg0(%c0) <%c0> : (!fir.ref<!fir.array<?xi32>>, i64, i64) -> !fir.ref<i32>
return
@ -1957,7 +1957,7 @@ func @ext_array_coor0(%arg0: !fir.ref<!fir.array<?xi32>>) {
// Conversion with shift and slice.
func @ext_array_coor1(%arg0: !fir.ref<!fir.array<?xi32>>) {
func.func @ext_array_coor1(%arg0: !fir.ref<!fir.array<?xi32>>) {
%c0 = arith.constant 0 : i64
%1 = fircg.ext_array_coor %arg0(%c0) origin %c0[%c0, %c0, %c0]<%c0> : (!fir.ref<!fir.array<?xi32>>, i64, i64, i64, i64, i64, i64) -> !fir.ref<i32>
return
@ -1979,7 +1979,7 @@ func @ext_array_coor1(%arg0: !fir.ref<!fir.array<?xi32>>) {
// Conversion for a dynamic length char.
func @ext_array_coor2(%arg0: !fir.ref<!fir.array<?x!fir.char<1,?>>>) {
func.func @ext_array_coor2(%arg0: !fir.ref<!fir.array<?x!fir.char<1,?>>>) {
%c0 = arith.constant 0 : i64
%1 = fircg.ext_array_coor %arg0(%c0) <%c0> : (!fir.ref<!fir.array<?x!fir.char<1,?>>>, i64, i64) -> !fir.ref<i32>
return
@ -1999,7 +1999,7 @@ func @ext_array_coor2(%arg0: !fir.ref<!fir.array<?x!fir.char<1,?>>>) {
// Conversion for a `fir.box`.
func @ext_array_coor3(%arg0: !fir.box<!fir.array<?xi32>>) {
func.func @ext_array_coor3(%arg0: !fir.box<!fir.array<?xi32>>) {
%c0 = arith.constant 0 : i64
%1 = fircg.ext_array_coor %arg0(%c0) <%c0> : (!fir.box<!fir.array<?xi32>>, i64, i64) -> !fir.ref<i32>
return
@ -2028,7 +2028,7 @@ func @ext_array_coor3(%arg0: !fir.box<!fir.array<?xi32>>) {
// Conversion with non zero shift and slice.
func @ext_array_coor4(%arg0: !fir.ref<!fir.array<100xi32>>) {
func.func @ext_array_coor4(%arg0: !fir.ref<!fir.array<100xi32>>) {
%c0 = arith.constant 0 : i64
%c10 = arith.constant 10 : i64
%c20 = arith.constant 20 : i64
@ -2064,8 +2064,8 @@ func @ext_array_coor4(%arg0: !fir.ref<!fir.array<100xi32>>) {
// call bar(x(5, 6:80:3))
// end subroutine
func private @bar1(!fir.box<!fir.array<?xf32>>)
func @test_rebox_1(%arg0: !fir.box<!fir.array<?x?xf32>>) {
func.func private @bar1(!fir.box<!fir.array<?xf32>>)
func.func @test_rebox_1(%arg0: !fir.box<!fir.array<?x?xf32>>) {
%c2 = arith.constant 2 : index
%c3 = arith.constant 3 : index
%c4 = arith.constant 4 : index
@ -2143,8 +2143,8 @@ func @test_rebox_1(%arg0: !fir.box<!fir.array<?x?xf32>>) {
// 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<!fir.array<?x!fir.char<1,?>>>)
func @foo(%arg0: !fir.box<!fir.array<?x!fir.type<t{i:i32,c:!fir.char<1,10>}>>>) {
func.func private @bar(!fir.box<!fir.array<?x!fir.char<1,?>>>)
func.func @foo(%arg0: !fir.box<!fir.array<?x!fir.type<t{i:i32,c:!fir.char<1,10>}>>>) {
%c3_i64 = arith.constant 3 : i64
%c60_i64 = arith.constant 60 : i64
%c9_i64 = arith.constant 9 : i64
@ -2218,7 +2218,7 @@ func @foo(%arg0: !fir.box<!fir.array<?x!fir.type<t{i:i32,c:!fir.char<1,10>}>>>)
// 1. COMPLEX TYPE (`fir.complex` is a special case)
// Complex type wrapped in `fir.ref`
func @coordinate_ref_complex(%arg0: !fir.ref<!fir.complex<16>>) {
func.func @coordinate_ref_complex(%arg0: !fir.ref<!fir.complex<16>>) {
%arg1 = llvm.mlir.constant(0 : i32) : i32
%p = fir.coordinate_of %arg0, %arg1 : (!fir.ref<!fir.complex<16>>, i32) -> !fir.ref<f32>
return
@ -2232,7 +2232,7 @@ func @coordinate_ref_complex(%arg0: !fir.ref<!fir.complex<16>>) {
// -----
// Complex type wrapped in `fir.box`
func @coordinate_box_complex(%arg0: !fir.box<!fir.complex<16>>) {
func.func @coordinate_box_complex(%arg0: !fir.box<!fir.complex<16>>) {
%arg1 = llvm.mlir.constant(0 : i32) : i32
%p = fir.coordinate_of %arg0, %arg1 : (!fir.box<!fir.complex<16>>, i32) -> !fir.ref<f32>
return
@ -2249,7 +2249,7 @@ func @coordinate_box_complex(%arg0: !fir.box<!fir.complex<16>>) {
// 2. BOX TYPE (objects wrapped in `fir.box`)
// Derived type - basic case (1 index)
func @coordinate_box_derived_1(%arg0: !fir.box<!fir.type<derived_1{field_1:i32, field_2:i32}>>) {
func.func @coordinate_box_derived_1(%arg0: !fir.box<!fir.type<derived_1{field_1:i32, field_2:i32}>>) {
%idx = fir.field_index field_2, !fir.type<derived_1{field_1:i32, field_2:i32}>
%q = fir.coordinate_of %arg0, %idx : (!fir.box<!fir.type<derived_1{field_1:i32, field_2:i32}>>, !fir.field) -> !fir.ref<i32>
return
@ -2268,7 +2268,7 @@ func @coordinate_box_derived_1(%arg0: !fir.box<!fir.type<derived_1{field_1:i32,
// CHECK-NEXT: llvm.return
// Derived type - basic case (2 indices)
func @coordinate_box_derived_2(%arg0: !fir.box<!fir.type<derived_2{field_1:!fir.type<another_derived{inner1:i32, inner2:f32}>, field_2:i32}>>) {
func.func @coordinate_box_derived_2(%arg0: !fir.box<!fir.type<derived_2{field_1:!fir.type<another_derived{inner1:i32, inner2:f32}>, field_2:i32}>>) {
%idx0 = fir.field_index field_1, !fir.type<derived_2{field_1:!fir.type<another_derived{inner1:i32, inner2:f32}>, field_2:i32}>
%idx1 = fir.field_index inner2, !fir.type<another_derived{inner1:i32, inner2:f32}>
%q = fir.coordinate_of %arg0, %idx0, %idx1 : (!fir.box<!fir.type<derived_2{field_1:!fir.type<another_derived{inner1:i32, inner2:f32}>, field_2:i32}>>, !fir.field, !fir.field) -> !fir.ref<i32>
@ -2300,7 +2300,7 @@ func @coordinate_box_derived_2(%arg0: !fir.box<!fir.type<derived_2{field_1:!fir.
// 3. BOX TYPE - `fir.array` wrapped in `fir.box`
// `fir.array` inside a `fir.box` (1d)
func @coordinate_box_array_1d(%arg0: !fir.box<!fir.array<10 x f32>>, %arg1: index) {
func.func @coordinate_box_array_1d(%arg0: !fir.box<!fir.array<10 x f32>>, %arg1: index) {
%p = fir.coordinate_of %arg0, %arg1 : (!fir.box<!fir.array<10 x f32>>, index) -> !fir.ref<f32>
return
}
@ -2331,7 +2331,7 @@ func @coordinate_box_array_1d(%arg0: !fir.box<!fir.array<10 x f32>>, %arg1: inde
// CHECK-NEXT: llvm.return
// `fir.array` inside a `fir.box` (1d) - dynamic size
func @coordinate_of_box_dynamic_array_1d(%arg0: !fir.box<!fir.array<? x f32>>, %arg1: index) {
func.func @coordinate_of_box_dynamic_array_1d(%arg0: !fir.box<!fir.array<? x f32>>, %arg1: index) {
%p = fir.coordinate_of %arg0, %arg1 : (!fir.box<!fir.array<? x f32>>, index) -> !fir.ref<f32>
return
}
@ -2365,7 +2365,7 @@ func @coordinate_of_box_dynamic_array_1d(%arg0: !fir.box<!fir.array<? x f32>>, %
// -----
// `fir.array` inside a `fir.box` (2d)
func @coordinate_box_array_2d(%arg0: !fir.box<!fir.array<10 x 10 x f32>>, %arg1: index, %arg2: index) {
func.func @coordinate_box_array_2d(%arg0: !fir.box<!fir.array<10 x 10 x f32>>, %arg1: index, %arg2: index) {
%p = fir.coordinate_of %arg0, %arg1, %arg2 : (!fir.box<!fir.array<10 x 10 x f32>>, index, index) -> !fir.ref<f32>
return
}
@ -2413,7 +2413,7 @@ func @coordinate_box_array_2d(%arg0: !fir.box<!fir.array<10 x 10 x f32>>, %arg1:
// 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<!fir.array<10 x !fir.type<derived_3{field_1:f32, field_2:f32}>>>, %arg1 : index) {
func.func @coordinate_box_derived_inside_array(%arg0: !fir.box<!fir.array<10 x !fir.type<derived_3{field_1:f32, field_2:f32}>>>, %arg1 : index) {
%idx0 = fir.field_index field_2, !fir.type<derived_3{field_1:f32, field_2:f32}>
%q = fir.coordinate_of %arg0, %arg1, %idx0 : (!fir.box<!fir.array<10 x !fir.type<derived_3{field_1:f32, field_2:f32}>>>, index, !fir.field) -> !fir.ref<f32>
return
@ -2447,7 +2447,7 @@ func @coordinate_box_derived_inside_array(%arg0: !fir.box<!fir.array<10 x !fir.t
// Test `fir.coordinate_of` conversion (items inside `!fir.ref`)
// 5.1. `fir.array`
func @coordinate_array_unknown_size_1d(%arg0: !fir.ref<!fir.array<? x i32>>, %arg1 : index) {
func.func @coordinate_array_unknown_size_1d(%arg0: !fir.ref<!fir.array<? x i32>>, %arg1 : index) {
%q = fir.coordinate_of %arg0, %arg1 : (!fir.ref<!fir.array<? x i32>>, index) -> !fir.ref<i32>
return
}
@ -2460,7 +2460,7 @@ func @coordinate_array_unknown_size_1d(%arg0: !fir.ref<!fir.array<? x i32>>, %ar
// -----
func @coordinate_array_known_size_1d(%arg0: !fir.ref<!fir.array<10 x i32>>, %arg1 : index) {
func.func @coordinate_array_known_size_1d(%arg0: !fir.ref<!fir.array<10 x i32>>, %arg1 : index) {
%q = fir.coordinate_of %arg0, %arg1 : (!fir.ref<!fir.array<10 x i32>>, index) -> !fir.ref<i32>
return
}
@ -2474,7 +2474,7 @@ func @coordinate_array_known_size_1d(%arg0: !fir.ref<!fir.array<10 x i32>>, %arg
// -----
func @coordinate_array_known_size_2d_get_i32(%arg0: !fir.ref<!fir.array<10 x 10 x i32>>, %arg1 : index, %arg2 : index) {
func.func @coordinate_array_known_size_2d_get_i32(%arg0: !fir.ref<!fir.array<10 x 10 x i32>>, %arg1 : index, %arg2 : index) {
%q = fir.coordinate_of %arg0, %arg1, %arg2 : (!fir.ref<!fir.array<10 x 10 x i32>>, index, index) -> !fir.ref<i32>
return
}
@ -2489,7 +2489,7 @@ func @coordinate_array_known_size_2d_get_i32(%arg0: !fir.ref<!fir.array<10 x 10
// -----
func @coordinate_array_known_size_2d_get_array(%arg0: !fir.ref<!fir.array<10 x 10 x i32>>, %arg1 : index) {
func.func @coordinate_array_known_size_2d_get_array(%arg0: !fir.ref<!fir.array<10 x 10 x i32>>, %arg1 : index) {
%q = fir.coordinate_of %arg0, %arg1 : (!fir.ref<!fir.array<10 x 10 x i32>>, index) -> !fir.ref<!fir.array<10 x i32>>
return
}
@ -2504,7 +2504,7 @@ func @coordinate_array_known_size_2d_get_array(%arg0: !fir.ref<!fir.array<10 x 1
// -----
// 5.2. `fir.derived`
func @coordinate_ref_derived(%arg0: !fir.ref<!fir.type<dervied_4{field_1:i32, field_2:i32}>>) {
func.func @coordinate_ref_derived(%arg0: !fir.ref<!fir.type<dervied_4{field_1:i32, field_2:i32}>>) {
%idx = fir.field_index field_2, !fir.type<dervied_4{field_1:i32, field_2:i32}>
%q = fir.coordinate_of %arg0, %idx : (!fir.ref<!fir.type<dervied_4{field_1:i32, field_2:i32}>>, !fir.field) -> !fir.ref<i32>
return
@ -2518,7 +2518,7 @@ func @coordinate_ref_derived(%arg0: !fir.ref<!fir.type<dervied_4{field_1:i32, fi
// -----
func @coordinate_ref_derived_nested(%arg0: !fir.ref<!fir.type<derived_5{field_1:!fir.type<nested_derived{inner1:i32, inner2:f32}>, field_2:i32}>>) {
func.func @coordinate_ref_derived_nested(%arg0: !fir.ref<!fir.type<derived_5{field_1:!fir.type<nested_derived{inner1:i32, inner2:f32}>, field_2:i32}>>) {
%idx0 = fir.field_index field_1, !fir.type<derived_5{field_1:!fir.type<nested_derived{inner1:i32, inner2:f32}>, field_2:i32}>
%idx1 = fir.field_index inner2, !fir.type<nested_derived{inner1:i32, inner2:f32}>
%q = fir.coordinate_of %arg0, %idx0, %idx1 : (!fir.ref<!fir.type<derived_5{field_1:!fir.type<nested_derived{inner1:i32, inner2:f32}>, field_2:i32}>>, !fir.field, !fir.field) -> !fir.ref<i32>
@ -2534,7 +2534,7 @@ func @coordinate_ref_derived_nested(%arg0: !fir.ref<!fir.type<derived_5{field_1:
// -----
// 5.3 `fir.char`
func @test_coordinate_of_char(%arr : !fir.ref<!fir.char<10, 2>>) {
func.func @test_coordinate_of_char(%arr : !fir.ref<!fir.char<10, 2>>) {
%1 = arith.constant 10 : i32
%2 = fir.coordinate_of %arr, %1 : (!fir.ref<!fir.char<10, 2>>, i32) -> !fir.ref<i80>
return
@ -2549,7 +2549,7 @@ func @test_coordinate_of_char(%arr : !fir.ref<!fir.char<10, 2>>) {
// -----
// 5.4 `mlir.tuple`
func @test_coordinate_of_tuple(%tup : !fir.ref<tuple<!fir.ref<i32>>>) {
func.func @test_coordinate_of_tuple(%tup : !fir.ref<tuple<!fir.ref<i32>>>) {
%1 = arith.constant 0 : i32
%2 = fir.coordinate_of %tup, %1 : (!fir.ref<tuple<!fir.ref<i32>>>, i32) -> !fir.ref<i32>
return
@ -2568,7 +2568,7 @@ func @test_coordinate_of_tuple(%tup : !fir.ref<tuple<!fir.ref<i32>>>) {
// 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<!fir.array<? x i32>>, %arg1 : index) {
func.func @coordinate_array_unknown_size_1d(%arg0: !fir.ptr<!fir.array<? x i32>>, %arg1 : index) {
%q = fir.coordinate_of %arg0, %arg1 : (!fir.ptr<!fir.array<? x i32>>, index) -> !fir.ref<i32>
return
}

View File

@ -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>) -> i64 {
func.func @fun(%arg0: !fir.ref<i64>) -> i64 {
%0 = fir.load %arg0 : !fir.ref<i64>
%1 = fir.load %arg0 : !fir.ref<i64>
%2 = arith.addi %0, %1 : i64
@ -16,7 +16,7 @@ func @fun(%arg0: !fir.ref<i64>) -> i64 {
// CHECK-LABEL: func @fun(
// CHECK-SAME: %[[A:.*]]: !fir.ref<i64>
func @fun(%a : !fir.ref<i64>) -> i64 {
func.func @fun(%a : !fir.ref<i64>) -> i64 {
// CHECK: %[[LOAD:.*]] = fir.load %[[A]] : !fir.ref<i64>
%1 = fir.load %a : !fir.ref<i64>
%2 = fir.load %a : !fir.ref<i64>
@ -43,7 +43,7 @@ func @fun(%a : !fir.ref<i64>) -> i64 {
// -----
func @fun(%a : !fir.ref<i64>) -> i64 {
func.func @fun(%a : !fir.ref<i64>) -> i64 {
cf.br ^bb1
^bb1:
%1 = fir.load %a : !fir.ref<i64>

View File

@ -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<!fir.array<?xi32>>) {
func.func @_QPtest_callee(%arg0: !fir.box<!fir.array<?xi32>>) {
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 @@ func @_QPtest_slice() {
}
// 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<!fir.array<?xi32>>) {
func.func @_QPtest_dt_callee(%arg0: !fir.box<!fir.array<?xi32>>) {
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 @@ func @_QPtest_dt_slice() {
return
}
func private @do_something(!fir.box<!fir.array<?xf32>>) -> ()
func.func private @do_something(!fir.box<!fir.array<?xf32>>) -> ()
// 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<!fir.array<40x?xf32>>, %low: index, %up: index, %at : index) {
func.func @fir_dev_issue_1416(%arg0: !fir.ref<!fir.array<40x?xf32>>, %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

View File

@ -1,11 +1,11 @@
// RUN: fir-opt --external-name-interop %s | FileCheck %s
func @_QPfoo() {
func.func @_QPfoo() {
%e6 = fir.alloca tuple<i32,f64>
%ao = fir.address_of(@_QPfoo_impl) : (!fir.box<!fir.type<derived3{f:f32}>>) -> ()
%0 = fir.emboxproc %ao, %e6 : ((!fir.box<!fir.type<derived3{f:f32}>>) -> (), !fir.ref<tuple<i32,f64>>) -> !fir.boxproc<(!fir.box<!fir.type<derived3{f:f32}>>) -> ()>
return
}
func private @_QPfoo_impl(!fir.ref<i32>)
func.func private @_QPfoo_impl(!fir.ref<i32>)
// CHECK: fir.address_of(@foo_impl_)

View File

@ -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<!fir.array<4xi8>>
%1 = fir.convert %0 : (!fir.ref<!fir.array<4xi8>>) -> !fir.ref<!fir.array<?xi8>>
@ -16,8 +16,8 @@ func @_QPfoo() {
}
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<i32>)
func private @_QPbar2(!fir.ref<f32>)
func.func private @_QPbar(!fir.ref<i32>)
func.func private @_QPbar2(!fir.ref<f32>)
// CHECK: func @foo_
// CHECK: %{{.*}} = fir.address_of(@a_) : !fir.ref<!fir.array<4xi8>>

View File

@ -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<!fir.type<derived3{f:f32}>>
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<!fir.type<derived3{f:f32}>>
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<!fir.type<derived3{f:f32}>>
// 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<!fir.type<x>>)
func private @print_index3(index, index, index)
func private @user_i64(i64)
func private @user_tdesc(!fir.tdesc<!fir.type<x>>)
func.func private @print_index3(index, index, index)
func.func private @user_i64(i64)
func.func private @user_tdesc(!fir.tdesc<!fir.type<x>>)
// expect the void return to be omitted
// CHECK-LABEL: func private @store_tuple(tuple<!fir.type<qq1{f1:i32}>>)
// CHECK: func private @get_method_box() -> !fir.box<!fir.type<derived3{f:f32}>>
// CHECK: func private @method_impl(!fir.box<!fir.type<derived3{f:f32}>>)
func private @store_tuple(tuple<!fir.type<qq1{f1:i32}>>) -> ()
func private @get_method_box() -> !fir.box<!fir.type<derived3{f:f32}>>
func private @method_impl(!fir.box<!fir.type<derived3{f:f32}>>)
func.func private @store_tuple(tuple<!fir.type<qq1{f1:i32}>>) -> ()
func.func private @get_method_box() -> !fir.box<!fir.type<derived3{f:f32}>>
func.func private @method_impl(!fir.box<!fir.type<derived3{f:f32}>>)
// 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<!fir.array<10xi32>>
// CHECK: [[VAL_2:%.*]] = fir.alloca i32
@ -143,7 +143,7 @@ func @instructions() {
}
// 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<qq2{f1:i32,f2:f64}>
// CHECK: [[VAL_40:%.*]] = fir.alloca !fir.char<1>
@ -198,7 +198,7 @@ func @boxing_match() {
}
// 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 @@ func @loop() {
}
// 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 @@ func @bar_select(%arg : i32, %arg2 : i32) -> i32 {
// 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 @@ func @bar_select_rank(%arg : i32, %arg2 : i32) -> i32 {
// CHECK-LABEL: func @bar_select_type(
// CHECK-SAME: [[VAL_101:%.*]]: !fir.box<!fir.type<name(param1:i32){fld:!fir.char<1>}>>) -> i32 {
func @bar_select_type(%arg : !fir.box<!fir.type<name(param1:i32){fld:!fir.char<1>}>>) -> i32 {
func.func @bar_select_type(%arg : !fir.box<!fir.type<name(param1:i32){fld:!fir.char<1>}>>) -> i32 {
// CHECK: [[VAL_102:%.*]] = arith.constant 1 : i32
// CHECK: [[VAL_103:%.*]] = arith.constant 2 : i32
@ -369,7 +369,7 @@ func @bar_select_type(%arg : !fir.box<!fir.type<name(param1:i32){fld:!fir.char<1
// 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 @@ fir.dispatch_table @dispatch_tbl {
// 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 @@ func @compare_complex(%a : !fir.complex<16>, %b : !fir.complex<16>) {
// 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 @@ func @arith_real(%a : f128, %b : f128) -> f128 {
// 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 @@ func @arith_complex(%a : !fir.complex<16>, %b : !fir.complex<16>) -> !fir.comple
}
// 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 @@ func @character_literal() -> !fir.char<1,13> {
}
// 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 @@ func @early_exit(%ok : i1, %k : i32) -> i1 {
}
// CHECK-LABEL: @array_access
func @array_access(%arr : !fir.ref<!fir.array<?x?xf32>>) {
func.func @array_access(%arr : !fir.ref<!fir.array<?x?xf32>>) {
// CHECK-DAG: %[[c1:.*]] = arith.constant 100
// CHECK-DAG: %[[c2:.*]] = arith.constant 50
%c100 = arith.constant 100 : index
@ -607,13 +607,13 @@ func @array_access(%arr : !fir.ref<!fir.array<?x?xf32>>) {
}
// CHECK-LABEL: @test_is_present
func @test_is_present(%arg0: !fir.box<!fir.array<?xf32>>) -> i1 {
func.func @test_is_present(%arg0: !fir.box<!fir.array<?xf32>>) -> i1 {
// CHECK: fir.is_present %{{.*}} : (!fir.box<!fir.array<?xf32>>) -> i1
%0 = fir.is_present %arg0 : (!fir.box<!fir.array<?xf32>>) -> i1
return %0 : i1
}
// CHECK-LABEL: @test_absent
func @test_absent() -> i1 {
func.func @test_absent() -> i1 {
// CHECK: fir.absent !fir.box<!fir.array<?xf32>>
%0 = fir.absent !fir.box<!fir.array<?xf32>>
%1 = fir.call @_QPfoo(%0) : (!fir.box<!fir.array<?xf32>>) -> i1
@ -622,7 +622,7 @@ func @test_absent() -> i1 {
// CHECK-LABEL: @test_misc_ops(
// CHECK-SAME: [[ARR1:%.*]]: !fir.ref<!fir.array<?x?xf32>>, [[INDXM:%.*]]: index, [[INDXN:%.*]]: index, [[INDXO:%.*]]: index, [[INDXP:%.*]]: index)
func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index) {
func.func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %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 @@ func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : inde
}
// 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 @@ func @test_const_complex() {
// 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.array<?xf32>>) -> !fir.ref<f32> {
func.func @test_shift(%arg0: !fir.box<!fir.array<?xf32>>) -> !fir.ref<f32> {
%c4 = arith.constant 4 : index
%c100 = arith.constant 100 : index
// CHECK: fir.shift %{{.*}} : (index) -> !fir.shift<1>
@ -700,9 +700,9 @@ func @test_shift(%arg0: !fir.box<!fir.array<?xf32>>) -> !fir.ref<f32> {
return %1 : !fir.ref<f32>
}
func private @bar_rebox_test(!fir.box<!fir.array<?x?xf32>>)
func.func private @bar_rebox_test(!fir.box<!fir.array<?x?xf32>>)
// CHECK-LABEL: @test_rebox(
func @test_rebox(%arg0: !fir.box<!fir.array<?xf32>>) {
func.func @test_rebox(%arg0: !fir.box<!fir.array<?xf32>>) {
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
%c2 = arith.constant 2 : index
@ -721,9 +721,9 @@ func @test_rebox(%arg0: !fir.box<!fir.array<?xf32>>) {
return
}
func private @bar_rebox_test_char(!fir.box<!fir.array<?x!fir.char<1,?>>>)
func.func private @bar_rebox_test_char(!fir.box<!fir.array<?x!fir.char<1,?>>>)
// CHECK-LABEL: @test_rebox_char(
func @test_rebox_char(%arg0: !fir.box<!fir.array<?x!fir.char<1,20>>>) {
func.func @test_rebox_char(%arg0: !fir.box<!fir.array<?x!fir.char<1,20>>>) {
%c7_i64 = arith.constant 7 : i64
%c1_i64 = arith.constant 1 : i64
%c0 = arith.constant 0 : index
@ -737,9 +737,9 @@ func @test_rebox_char(%arg0: !fir.box<!fir.array<?x!fir.char<1,20>>>) {
}
func private @array_func() -> !fir.array<?x!fir.char<1,?>>
func.func private @array_func() -> !fir.array<?x!fir.char<1,?>>
// CHECK-LABEL: @test_save_result(
func @test_save_result(%buffer: !fir.ref<!fir.array<?x!fir.char<1,?>>>) {
func.func @test_save_result(%buffer: !fir.ref<!fir.array<?x!fir.char<1,?>>>) {
%c100 = arith.constant 100 : index
%c50 = arith.constant 50 : index
%shape = fir.shape %c100 : (index) -> !fir.shape<1>
@ -749,7 +749,7 @@ func @test_save_result(%buffer: !fir.ref<!fir.array<?x!fir.char<1,?>>>) {
return
}
func @char_convert() {
func.func @char_convert() {
%1 = fir.undefined i32
%2 = fir.undefined !fir.ref<!fir.char<1>>
%3 = fir.undefined !fir.ref<!fir.array<?x!fir.char<2,?>>>
@ -758,7 +758,7 @@ func @char_convert() {
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 @@ func @slice_substr() {
// Test load, store, coordinate_of with llvmptr type
// CHECK-LABEL: llvm_ptr_load_store_coordinate
// CHECK-SAME: (%[[ARG0:.*]]: !fir.ref<tuple<!fir.ref<!fir.box<!fir.ptr<f32>>>, !fir.ref<!fir.box<!fir.heap<f32>>>>>, %[[ARG1:.*]]: !fir.ref<!fir.box<!fir.ptr<f32>>>)
func @llvm_ptr_load_store_coordinate(%arg0: !fir.ref<tuple<!fir.ref<!fir.box<!fir.ptr<f32>>>, !fir.ref<!fir.box<!fir.heap<f32>>>>>, %arg1: !fir.ref<!fir.box<!fir.ptr<f32>>>) -> !fir.ref<!fir.box<!fir.ptr<f32>>> {
func.func @llvm_ptr_load_store_coordinate(%arg0: !fir.ref<tuple<!fir.ref<!fir.box<!fir.ptr<f32>>>, !fir.ref<!fir.box<!fir.heap<f32>>>>>, %arg1: !fir.ref<!fir.box<!fir.ptr<f32>>>) -> !fir.ref<!fir.box<!fir.ptr<f32>>> {
// CHECK-NEXT: %[[C0:.*]] = arith.constant 0 : i32
%c0_i32 = arith.constant 0 : i32
// CHECK-NEXT: %[[LLVMPTR:.*]] = fir.coordinate_of %[[ARG0]], %[[C0]] : (!fir.ref<tuple<!fir.ref<!fir.box<!fir.ptr<f32>>>, !fir.ref<!fir.box<!fir.heap<f32>>>>>, i32) -> !fir.llvm_ptr<!fir.ref<!fir.box<!fir.ptr<f32>>>>
@ -783,7 +783,7 @@ func @llvm_ptr_load_store_coordinate(%arg0: !fir.ref<tuple<!fir.ref<!fir.box<!fi
return %1 : !fir.ref<!fir.box<!fir.ptr<f32>>>
}
func @array_access_ops(%a : !fir.ref<!fir.array<?x?xf32>>) {
func.func @array_access_ops(%a : !fir.ref<!fir.array<?x?xf32>>) {
%c1 = arith.constant 1 : index
%n = arith.constant 0 : index
%m = arith.constant 50 : index
@ -794,7 +794,7 @@ func @array_access_ops(%a : !fir.ref<!fir.array<?x?xf32>>) {
return
}
func @array_amend_ops(%a : !fir.ref<!fir.array<?x?xf32>>) {
func.func @array_amend_ops(%a : !fir.ref<!fir.array<?x?xf32>>) {
%c1 = arith.constant 1 : index
%n = arith.constant 0 : index
%m = arith.constant 50 : index

View File

@ -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<derived1>
@ -26,13 +26,13 @@ func private @it7() -> !fir.char<4,?>
// CHECK-LABEL: func private @dvd5() -> !fir.type<derived5(p1:i8,p2:i8,p3:i8,p4:i8,p5:i8){f1:f32,f2:f32,f3:f32,f4:f32,f5:f32,f6:f32,f7:f32,f8:f32}>
// CHECK-LABEL: func private @dvd6() -> !fir.type<derived6{f:!fir.ptr<!fir.type<derived6>>}>
// CHECK-LABEL: func private @dvd7() -> !fir.type<derived_with_field_name_same_as_integer_type{i32:f32}>
func private @dvd1() -> !fir.type<derived1>
func private @dvd2() -> !fir.type<derived2(p:i32)>
func private @dvd3() -> !fir.type<derived3{f:f32}>
func private @dvd4() -> !fir.type<derived4(p:i8){f:f32}>
func private @dvd5() -> !fir.type<derived5(p1:i8,p2:i8,p3:i8,p4:i8,p5:i8){f1:f32,f2:f32,f3:f32,f4:f32,f5:f32,f6:f32,f7:f32,f8:f32}>
func private @dvd6() -> !fir.type<derived6{f:!fir.ptr<!fir.type<derived6>>}>
func private @dvd7() -> !fir.type<derived_with_field_name_same_as_integer_type{i32:f32}>
func.func private @dvd1() -> !fir.type<derived1>
func.func private @dvd2() -> !fir.type<derived2(p:i32)>
func.func private @dvd3() -> !fir.type<derived3{f:f32}>
func.func private @dvd4() -> !fir.type<derived4(p:i8){f:f32}>
func.func private @dvd5() -> !fir.type<derived5(p1:i8,p2:i8,p3:i8,p4:i8,p5:i8){f1:f32,f2:f32,f3:f32,f4:f32,f5:f32,f6:f32,f7:f32,f8:f32}>
func.func private @dvd6() -> !fir.type<derived6{f:!fir.ptr<!fir.type<derived6>>}>
func.func private @dvd7() -> !fir.type<derived_with_field_name_same_as_integer_type{i32:f32}>
// FIR array types
// CHECK-LABEL: func private @arr1() -> !fir.array<10xf32>
@ -42,13 +42,13 @@ func private @dvd7() -> !fir.type<derived_with_field_name_same_as_integer_type{i
// CHECK-LABEL: func private @arr5() -> !fir.array<?x?xf32>
// 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<?xf32>
func private @arr4() -> !fir.array<10x?xf32>
func private @arr5() -> !fir.array<?x?xf32>
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<?xf32>
func.func private @arr4() -> !fir.array<10x?xf32>
func.func private @arr5() -> !fir.array<?x?xf32>
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<i32>
@ -57,12 +57,12 @@ func private @arr7() -> !fir.array<1x2x?x4x5x6x7x8x9xf32>
// CHECK-LABEL: func private @mem4() -> !fir.ref<() -> ()>
// CHECK-LABEL: func private @mem5() -> !fir.llvm_ptr<!fir.ref<f32>>
// CHECK-LABEL: func private @mem6() -> !fir.llvm_ptr<i8>
func private @mem1() -> !fir.ref<i32>
func private @mem2() -> !fir.ptr<i32>
func private @mem3() -> !fir.heap<i32>
func private @mem4() -> !fir.ref<() -> ()>
func private @mem5() -> !fir.llvm_ptr<!fir.ref<f32>>
func private @mem6() -> !fir.llvm_ptr<i8>
func.func private @mem1() -> !fir.ref<i32>
func.func private @mem2() -> !fir.ptr<i32>
func.func private @mem3() -> !fir.heap<i32>
func.func private @mem4() -> !fir.ref<() -> ()>
func.func private @mem5() -> !fir.llvm_ptr<!fir.ref<f32>>
func.func private @mem6() -> !fir.llvm_ptr<i8>
// FIR box types (descriptors)
// CHECK-LABEL: func private @box1() -> !fir.box<!fir.array<?xf32>>
@ -70,11 +70,11 @@ func private @mem6() -> !fir.llvm_ptr<i8>
// CHECK-LABEL: func private @box3() -> !fir.boxproc<(i32, i32) -> i64>
// CHECK-LABEL: func private @box4() -> !fir.box<none>
// CHECK-LABEL: func private @box5() -> !fir.box<!fir.type<derived3{f:f32}>>
func private @box1() -> !fir.box<!fir.array<?xf32>>
func private @box2() -> !fir.boxchar<2>
func private @box3() -> !fir.boxproc<(i32, i32) -> i64>
func private @box4() -> !fir.box<none>
func private @box5() -> !fir.box<!fir.type<derived3{f:f32}>>
func.func private @box1() -> !fir.box<!fir.array<?xf32>>
func.func private @box2() -> !fir.boxchar<2>
func.func private @box3() -> !fir.boxproc<(i32, i32) -> i64>
func.func private @box4() -> !fir.box<none>
func.func private @box5() -> !fir.box<!fir.type<derived3{f:f32}>>
// FIR misc. types
// CHECK-LABEL: func private @oth1() -> !fir.shape<1>
@ -82,12 +82,12 @@ func private @box5() -> !fir.box<!fir.type<derived3{f:f32}>>
// CHECK-LABEL: func private @oth3() -> !fir.tdesc<!fir.type<derived7{f1:f32,f2:f32}>>
// 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<!fir.type<derived7{f1:f32,f2:f32}>>
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<!fir.type<derived7{f1:f32,f2:f32}>>
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>

View File

@ -6,9 +6,9 @@
!some_freestyle_type = type !fir.type<some_not_mangled_type{j:i32}>
func private @bar(!fir.box<!some_freestyle_type>)
func.func private @bar(!fir.box<!some_freestyle_type>)
func @test_embox(%addr: !fir.ref<!some_freestyle_type>) {
func.func @test_embox(%addr: !fir.ref<!some_freestyle_type>) {
%0 = fir.embox %addr : (!fir.ref<!some_freestyle_type>) -> !fir.box<!some_freestyle_type>
fir.call @bar(%0) : (!fir.box<!some_freestyle_type>) -> ()
return

View File

@ -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 @@ func @add(%a : i32, %b : i32) -> i32 {
}
// 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]],

View File

@ -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<!fir.array<?xf32>, >
func.func private @box1() -> !fir.box<!fir.array<?xf32>, >
// -----
// 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<A>
func.func private @it1() -> !fir.int<A>
// -----
// expected-error@+1 {{expected integer value}}
func private @it1() -> !fir.logical<b>
func.func private @it1() -> !fir.logical<b>
// -----
// 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<derived4()>
func.func private @dvd4() -> !fir.type<derived4()>
// -----
// expected-error@+2 {{expected ':'}}
// expected-error@+1 {{expected LEN parameter list}}
func private @dvd4() -> !fir.type<derived4(p)>
func.func private @dvd4() -> !fir.type<derived4(p)>
// -----
// expected-error@+2 {{expected non-function type}}
// expected-error@+1 {{expected LEN parameter list}}
func private @dvd4() -> !fir.type<derived4(p:)>
func.func private @dvd4() -> !fir.type<derived4(p:)>
// -----
// expected-error@+2 {{expected valid keyword}}
// expected-error@+1 {{expected field type list}}
func private @dvd4() -> !fir.type<derived4(p:i8){}>
func.func private @dvd4() -> !fir.type<derived4(p:i8){}>
// -----
// expected-error@+2 {{expected ':'}}
// expected-error@+1 {{expected field type list}}
func private @dvd4() -> !fir.type<derived4(p:i8){f1}>
func.func private @dvd4() -> !fir.type<derived4(p:i8){f1}>
// -----
// expected-error@+2 {{expected non-function type}}
// expected-error@+1 {{expected field type list}}
func private @dvd4() -> !fir.type<derived4(p:i8){f1:f2}>
func.func private @dvd4() -> !fir.type<derived4(p:i8){f1:f2}>
// -----
// expected-error@+2 {{expected valid keyword}}
// expected-error@+1 {{expected field type list}}
func private @dvd4() -> !fir.type<derived4(p:i8){f1:i32,}>
func.func private @dvd4() -> !fir.type<derived4(p:i8){f1:i32,}>
// -----
// expected-error@+2 {{expected valid keyword}}
// expected-error@+1 {{expected field type list}}
func private @dvd4() -> !fir.type<derived4(p:i8){,}>
func.func private @dvd4() -> !fir.type<derived4(p:i8){,}>
// -----
// 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<xx>
func.func private @oth3() -> !fir.tdesc<xx>
// -----
// 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:>

View File

@ -17,7 +17,7 @@
// -----
func @bad_rebox_1(%arg0: !fir.ref<!fir.array<?x?xf32>>) {
func.func @bad_rebox_1(%arg0: !fir.ref<!fir.array<?x?xf32>>) {
%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<!fir.array<?x?xf32>>'}}
@ -27,7 +27,7 @@ func @bad_rebox_1(%arg0: !fir.ref<!fir.array<?x?xf32>>) {
// -----
func @bad_rebox_2(%arg0: !fir.box<!fir.array<?x?xf32>>) {
func.func @bad_rebox_2(%arg0: !fir.box<!fir.array<?x?xf32>>) {
%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<!fir.array<?xf32>>'}}
@ -37,7 +37,7 @@ func @bad_rebox_2(%arg0: !fir.box<!fir.array<?x?xf32>>) {
// -----
func @bad_rebox_3(%arg0: !fir.box<!fir.array<*:f32>>) {
func.func @bad_rebox_3(%arg0: !fir.box<!fir.array<*:f32>>) {
%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_3(%arg0: !fir.box<!fir.array<*:f32>>) {
// -----
func @bad_rebox_4(%arg0: !fir.box<!fir.array<?xf32>>) {
func.func @bad_rebox_4(%arg0: !fir.box<!fir.array<?xf32>>) {
// expected-error@+1{{op result type must not have unknown rank or type}}
%0 = fir.rebox %arg0 : (!fir.box<!fir.array<?xf32>>) -> !fir.box<!fir.array<*:f32>>
return
@ -55,7 +55,7 @@ func @bad_rebox_4(%arg0: !fir.box<!fir.array<?xf32>>) {
// -----
func @bad_rebox_5(%arg0: !fir.box<!fir.array<?x?xf32>>) {
func.func @bad_rebox_5(%arg0: !fir.box<!fir.array<?x?xf32>>) {
%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_5(%arg0: !fir.box<!fir.array<?x?xf32>>) {
// -----
func @bad_rebox_6(%arg0: !fir.box<!fir.array<?xf32>>) {
func.func @bad_rebox_6(%arg0: !fir.box<!fir.array<?xf32>>) {
%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_6(%arg0: !fir.box<!fir.array<?xf32>>) {
// -----
func @bad_rebox_7(%arg0: !fir.box<!fir.array<?xf32>>) {
func.func @bad_rebox_7(%arg0: !fir.box<!fir.array<?xf32>>) {
%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_7(%arg0: !fir.box<!fir.array<?xf32>>) {
// -----
func @bad_rebox_8(%arg0: !fir.box<!fir.array<?x?xf32>>) {
func.func @bad_rebox_8(%arg0: !fir.box<!fir.array<?x?xf32>>) {
%c1 = arith.constant 1 : index
%c10 = arith.constant 10 : index
%undef = fir.undefined index
@ -102,7 +102,7 @@ func @bad_rebox_8(%arg0: !fir.box<!fir.array<?x?xf32>>) {
// -----
func @bad_rebox_9(%arg0: !fir.box<!fir.array<?xf32>>) {
func.func @bad_rebox_9(%arg0: !fir.box<!fir.array<?xf32>>) {
%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_9(%arg0: !fir.box<!fir.array<?xf32>>) {
// -----
func @bad_rebox_10(%arg0: !fir.box<!fir.array<?xf32>>) {
func.func @bad_rebox_10(%arg0: !fir.box<!fir.array<?xf32>>) {
%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_10(%arg0: !fir.box<!fir.array<?xf32>>) {
// -----
func @bad_rebox_11(%arg0: !fir.box<!fir.array<?x?xf32>>) {
func.func @bad_rebox_11(%arg0: !fir.box<!fir.array<?x?xf32>>) {
%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 @bad_rebox_11(%arg0: !fir.box<!fir.array<?x?xf32>>) {
// -----
func @test_rebox_char(%arg0: !fir.box<!fir.array<?x!fir.char<1,20>>>) {
func.func @test_rebox_char(%arg0: !fir.box<!fir.array<?x!fir.char<1,20>>>) {
%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 @test_rebox_char(%arg0: !fir.box<!fir.array<?x!fir.char<1,20>>>) {
// -----
func @array_access(%arr : !fir.ref<!fir.array<?x?xf32>>) {
func.func @array_access(%arr : !fir.ref<!fir.array<?x?xf32>>) {
%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<!fir.array<?x?xf32>>) {
// -----
func @array_access(%arr : !fir.ref<f32>) {
func.func @array_access(%arr : !fir.ref<f32>) {
%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<f32>) {
// -----
func @array_access(%arr : !fir.ref<!fir.array<?x?xf32>>) {
func.func @array_access(%arr : !fir.ref<!fir.array<?x?xf32>>) {
%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<!fir.array<?x?xf32>>) {
// -----
func @array_access(%arr : !fir.ref<!fir.array<?x?xf32>>) {
func.func @array_access(%arr : !fir.ref<!fir.array<?x?xf32>>) {
%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<!fir.array<?x?xf32>>) {
// -----
func @array_access(%arr : !fir.ref<!fir.array<?x?xf32>>) {
func.func @array_access(%arr : !fir.ref<!fir.array<?x?xf32>>) {
%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<!fir.array<?x?xf32>>) {
// -----
func @array_access(%arr : !fir.ref<!fir.array<?x?xf32>>) {
func.func @array_access(%arr : !fir.ref<!fir.array<?x?xf32>>) {
%c1 = arith.constant 1 : index
%c100 = arith.constant 100 : index
%c50 = arith.constant 50 : index
@ -216,7 +216,7 @@ func @array_access(%arr : !fir.ref<!fir.array<?x?xf32>>) {
// -----
func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index) {
func.func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %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<!fir.array<?x?xf32>>, %m : index, %n : inde
// -----
func @test_misc_ops(%arr1 : !fir.ref<f32>, %m : index, %n : index, %o : index, %p : index) {
func.func @test_misc_ops(%arr1 : !fir.ref<f32>, %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<f32>, !fir.shapeshift<2>) -> !fir.array<?x?xf32>
@ -235,7 +235,7 @@ func @test_misc_ops(%arr1 : !fir.ref<f32>, %m : index, %n : index, %o : index, %
// -----
func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index) {
func.func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %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.array<?x?xf32>>, !fir.shapeshift<1>) -> !fir.array<?x?xf32>
@ -244,7 +244,7 @@ func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : inde
// -----
func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index) {
func.func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %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<!fir.array<?x?xf32>>, %m : index, %n : inde
// -----
func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index) {
func.func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %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_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : inde
// -----
func @test_coordinate_of(%arr : !fir.ref<!fir.array<?x?xf32>>) {
func.func @test_coordinate_of(%arr : !fir.ref<!fir.array<?x?xf32>>) {
%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<!fir.array<?x?xf32>>, i32) -> !fir.ref<f32>
@ -276,7 +276,7 @@ func @test_coordinate_of(%arr : !fir.ref<!fir.array<?x?xf32>>) {
// -----
func @test_coordinate_of(%arr : !fir.ref<!fir.array<*:f32>>) {
func.func @test_coordinate_of(%arr : !fir.ref<!fir.array<*:f32>>) {
%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<!fir.array<*:f32>>, i32) -> !fir.ref<f32>
@ -285,7 +285,7 @@ func @test_coordinate_of(%arr : !fir.ref<!fir.array<*:f32>>) {
// -----
func @test_coordinate_of(%arr : !fir.ref<!fir.char<10>>) {
func.func @test_coordinate_of(%arr : !fir.ref<!fir.char<10>>) {
%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<!fir.char<10>>, i32) -> !fir.ref<f32>
@ -294,7 +294,7 @@ func @test_coordinate_of(%arr : !fir.ref<!fir.char<10>>) {
// -----
func @test_coordinate_of(%arr : !fir.ref<!fir.char<10, 1>>) {
func.func @test_coordinate_of(%arr : !fir.ref<!fir.char<10, 1>>) {
%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<!fir.char<10, 1>>, i32) -> !fir.ref<f32>
@ -309,7 +309,7 @@ func @test_coordinate_of(%arr : !fir.ref<!fir.char<10, 1>>) {
// -----
func @fun(%0 : !fir.ref<i32>) {
func.func @fun(%0 : !fir.ref<i32>) {
%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<i32>) {
// -----
func @fun(%0 : !fir.ref<i32>) {
func.func @fun(%0 : !fir.ref<i32>) {
%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<i32>) {
// -----
func @fun(%0 : !fir.ref<i32>) {
func.func @fun(%0 : !fir.ref<i32>) {
%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<i32>) {
// -----
func @fun(%0 : !fir.ref<i32>) {
func.func @fun(%0 : !fir.ref<i32>) {
%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 @@ fir.do_loop %i = %c1 to %c10 step %c1 -> index {
// -----
func @ugly_char_convert() {
func.func @ugly_char_convert() {
%1 = fir.undefined i32
%2 = fir.undefined !fir.ref<!fir.char<1>>
%3 = fir.undefined !fir.ref<!fir.array<?x!fir.char<1>>>
@ -410,7 +410,7 @@ func @ugly_char_convert() {
// -----
func @ugly_char_convert() {
func.func @ugly_char_convert() {
%1 = fir.undefined i32
%2 = fir.undefined !fir.ref<!fir.char<1>>
%3 = fir.undefined !fir.ref<!fir.array<?xf32>>
@ -421,7 +421,7 @@ func @ugly_char_convert() {
// -----
func @ugly_char_convert() {
func.func @ugly_char_convert() {
%1 = fir.undefined i32
%2 = fir.undefined !fir.ref<!fir.char<1>>
%3 = fir.undefined !fir.ref<!fir.array<?x!fir.char<2,?>>>
@ -432,7 +432,7 @@ func @ugly_char_convert() {
// -----
func @ugly_char_convert() {
func.func @ugly_char_convert() {
%1 = fir.undefined i32
%2 = fir.undefined !fir.ref<!fir.char<1>>
%3 = fir.undefined !fir.ref<!fir.array<?x!fir.char<2,?>>>
@ -503,7 +503,7 @@ fir.global internal @_QEmultiarray : !fir.array<*:i32> {
// -----
func @bad_save_result(%buffer : !fir.ref<!fir.array<?xf64>>, %n :index) {
func.func @bad_save_result(%buffer : !fir.ref<!fir.array<?xf64>>, %n :index) {
%res = fir.call @array_func() : () -> !fir.array<?xf32>
%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<!fir.array<?xf64>>, %n :index) {
// -----
func @bad_save_result(%buffer : !fir.ref<!fir.box<!fir.array<*:f32>>>) {
func.func @bad_save_result(%buffer : !fir.ref<!fir.box<!fir.array<*:f32>>>) {
%res = fir.call @array_func() : () -> !fir.box<!fir.array<*:f32>>
// 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.array<*:f32>>, !fir.ref<!fir.box<!fir.array<*:f32>>>
@ -522,7 +522,7 @@ func @bad_save_result(%buffer : !fir.ref<!fir.box<!fir.array<*:f32>>>) {
// -----
func @bad_save_result(%buffer : !fir.ref<f64>) {
func.func @bad_save_result(%buffer : !fir.ref<f64>) {
%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<f64>
@ -531,7 +531,7 @@ func @bad_save_result(%buffer : !fir.ref<f64>) {
// -----
func @bad_save_result(%buffer : !fir.ref<!fir.box<!fir.array<?xf32>>>, %n : index) {
func.func @bad_save_result(%buffer : !fir.ref<!fir.box<!fir.array<?xf32>>>, %n : index) {
%res = fir.call @array_func() : () -> !fir.box<!fir.array<?xf32>>
%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<!fir.box<!fir.array<?xf32>>>, %n : inde
// -----
func @bad_save_result(%buffer : !fir.ref<!fir.array<?xf32>>, %n :index) {
func.func @bad_save_result(%buffer : !fir.ref<!fir.array<?xf32>>, %n :index) {
%res = fir.call @array_func() : () -> !fir.array<?xf32>
%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<!fir.array<?xf32>>, %n :index) {
// -----
func @bad_save_result(%buffer : !fir.ref<!fir.type<t{x:f32}>>, %n :index) {
func.func @bad_save_result(%buffer : !fir.ref<!fir.type<t{x:f32}>>, %n :index) {
%res = fir.call @array_func() : () -> !fir.type<t{x:f32}>
%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<!fir.type<t{x:f32}>>, %n :index) {
// -----
func @bad_save_result(%buffer : !fir.ref<!fir.type<t{x:f32}>>, %n :index) {
func.func @bad_save_result(%buffer : !fir.ref<!fir.type<t{x:f32}>>, %n :index) {
%res = fir.call @array_func() : () -> !fir.type<t{x:f32}>
// 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<t{x:f32}>, !fir.ref<!fir.type<t{x:f32}>>, index
@ -570,7 +570,7 @@ func @bad_save_result(%buffer : !fir.ref<!fir.type<t{x:f32}>>, %n :index) {
// -----
func @bad_save_result(%buffer : !fir.ref<!fir.array<?xf32>>, %n :index) {
func.func @bad_save_result(%buffer : !fir.ref<!fir.array<?xf32>>, %n :index) {
%res = fir.call @array_func() : () -> !fir.array<?xf32>
%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 @bad_save_result(%buffer : !fir.ref<!fir.array<?xf32>>, %n :index) {
// -----
func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index) {
func.func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %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.array<?x?xf32>>, !fir.shapeshift<2>) -> !fir.array<?x?xf32>
// expected-error@+1 {{'fir.array_fetch' op number of indices != dimension of array}}
@ -590,7 +590,7 @@ func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : inde
// -----
func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index) {
func.func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %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.array<?x?xf32>>, !fir.shapeshift<2>) -> !fir.array<?x?xf32>
// expected-error@+1 {{'fir.array_fetch' op return type does not match array}}
@ -600,7 +600,7 @@ func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : inde
// -----
func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index) {
func.func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %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.array<?x?xf32>>, !fir.shapeshift<2>) -> !fir.array<?x?xf32>
%f = fir.array_fetch %av1, %m, %n : (!fir.array<?x?xf32>, index, index) -> f32
@ -611,7 +611,7 @@ func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : inde
// -----
func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index) {
func.func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %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.array<?x?xf32>>, !fir.shapeshift<2>) -> !fir.array<?x?xf32>
%c0 = arith.constant 0 : i32
@ -622,7 +622,7 @@ func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : inde
// -----
func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index, %f: !fir.ref<i32>) {
func.func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index, %f: !fir.ref<i32>) {
%s = fir.shape_shift %m, %n, %o, %p : (index, index, index, index) -> !fir.shapeshift<2>
%av1 = fir.array_load %arr1(%s) : (!fir.ref<!fir.array<?x?xf32>>, !fir.shapeshift<2>) -> !fir.array<?x?xf32>
// 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<!fir.array<?x?xf32>>, %m : index, %n : inde
// -----
func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index) {
func.func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %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.array<?x?xf32>>, !fir.shapeshift<2>) -> !fir.array<?x?xf32>
%f = fir.array_fetch %av1, %m, %n : (!fir.array<?x?xf32>, index, index) -> f32
@ -644,7 +644,7 @@ func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : inde
// -----
func @bad_array_modify(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index, %f : f32) {
func.func @bad_array_modify(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %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 @bad_array_modify(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : i
// -----
func @slice_must_be_integral() {
func.func @slice_must_be_integral() {
%0 = arith.constant 42 : i32
%1 = fir.field_index field, !fir.type<t(param:i32){field:i32}> (%0 : i32)
// expected-error@+1 {{'fir.slice' op operand #0 must be any integer, but got '!fir.field'}}
@ -668,7 +668,7 @@ func @slice_must_be_integral() {
// -----
func @array_coor_no_slice_substr(%a : !fir.ref<!fir.array<?x?xf32>>) {
func.func @array_coor_no_slice_substr(%a : !fir.ref<!fir.array<?x?xf32>>) {
%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<!fir.array<?x?xf32>>) {
// -----
func @array_coor_no_slice_substr(%a : !fir.ref<!fir.array<?x?xf32>>) {
func.func @array_coor_no_slice_substr(%a : !fir.ref<!fir.array<?x?xf32>>) {
%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_coor_no_slice_substr(%a : !fir.ref<!fir.array<?x?xf32>>) {
// -----
func @array_merge_store_no_slice_substr(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index, %f : f32) {
func.func @array_merge_store_no_slice_substr(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %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_merge_store_no_slice_substr(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %
// -----
func @array_access(%a : !fir.ref<!fir.array<?x?xf32>>) {
func.func @array_access(%a : !fir.ref<!fir.array<?x?xf32>>) {
%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<!fir.array<?x?xf32>>) {
// -----
func @array_access(%a : !fir.ref<!fir.array<?x?xf32>>) {
func.func @array_access(%a : !fir.ref<!fir.array<?x?xf32>>) {
%c1 = arith.constant 1 : index
%n = arith.constant 0 : index
%m = arith.constant 50 : index
@ -733,7 +733,7 @@ func @array_access(%a : !fir.ref<!fir.array<?x?xf32>>) {
// -----
func @foo(%arg0: !fir.ref<!fir.array<30x!fir.type<t{c:!fir.array<20xi32>}>>>) {
func.func @foo(%arg0: !fir.ref<!fir.array<30x!fir.type<t{c:!fir.array<20xi32>}>>>) {
%c1 = arith.constant 1 : index
%c0 = arith.constant 0 : index
%c9 = arith.constant 9 : index
@ -755,4 +755,4 @@ func @foo(%arg0: !fir.ref<!fir.array<30x!fir.type<t{c:!fir.array<20xi32>}>>>) {
fir.array_merge_store %1, %2 to %arg0 : !fir.array<30x!fir.type<t{c:!fir.array<20xi32>}>>, !fir.array<30x!fir.type<t{c:!fir.array<20xi32>}>>, !fir.ref<!fir.array<30x!fir.type<t{c:!fir.array<20xi32>}>>>
return
}
func private @ifoo(!fir.ref<f32>) -> i32
func.func private @ifoo(!fir.ref<f32>) -> i32

View File

@ -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<index>) {
func.func @x(%lb : index, %ub : index, %step : index, %b : i1, %addr : !fir.ref<index>) {
fir.do_loop %iv = %lb to %ub step %step unordered {
// expect following conditional blocks to get fused
fir.if %b {
@ -13,7 +13,7 @@ func @x(%lb : index, %ub : index, %step : index, %b : i1, %addr : !fir.ref<index
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<index>) {
// CHECK: %[[VAL_5:.*]] = arith.subi %[[VAL_1]], %[[VAL_0]] : index
@ -45,7 +45,7 @@ func private @f2() -> i1
// -----
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 @@ func @x2(%lo : index, %up : index, %ok : i1) {
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 @@ func private @f3(i16)
// -----
// 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 @@ func @x3(%lo : index, %up : index) -> i1 {
// -----
// 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 @@ func @y3(%lo : index, %up : index) -> i1 {
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 @@ func private @f4(i32) -> i1
// -----
// 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 @@ func @x4(%lo : index, %up : index) -> index {
// -----
// 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 @@ func @y4(%lo : index, %up : index) -> index {
// 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 @@ func @x5(%lo : index, %up : index) -> index {
// 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

View File

@ -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<index>) {
func.func @x(%addr : !fir.ref<index>) {
%bound = arith.constant 452 : index
%step = arith.constant 1 : index
fir.do_loop %iv = %bound to %bound step %step {
@ -10,7 +10,7 @@ func @x(%addr : !fir.ref<index>) {
return
}
func private @y(%addr : !fir.ref<index>)
func.func private @y(%addr : !fir.ref<index>)
// CHECK-LABEL: func @x(

View File

@ -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<!fir.array<1000123xi32>>) -> ()
return
@ -22,7 +22,7 @@ func @_QPs1() {
// CHECK: fir.freemem %[[mem]]
// CHECK-NEXT: return
func @_QPs2(%arg0: !fir.ref<i32>) {
func.func @_QPs2(%arg0: !fir.ref<i32>) {
%0 = fir.load %arg0 : !fir.ref<i32>
%1 = fir.convert %0 : (i32) -> index
%2 = fir.alloca !fir.array<?xi32>, %1 {bindc_name = "array", uniq_name = "_QFs2Earray"}
@ -30,5 +30,5 @@ func @_QPs2(%arg0: !fir.ref<i32>) {
fir.call @_QPs3(%3) : (!fir.ref<!fir.array<1000123xi32>>) -> ()
return
}
func private @_QPs3(!fir.ref<!fir.array<1000123xi32>>)
func.func private @_QPs3(!fir.ref<!fir.array<1000123xi32>>)

View File

@ -2,7 +2,7 @@
// Test that all load-store chains are removed
func @load_store_chain_removal(%arg0: !fir.ref<!fir.array<60xi32>>, %arg1: !fir.ref<!fir.array<60xi32>>, %arg2: !fir.ref<!fir.array<60xi32>>) {
func.func @load_store_chain_removal(%arg0: !fir.ref<!fir.array<60xi32>>, %arg1: !fir.ref<!fir.array<60xi32>>, %arg2: !fir.ref<!fir.array<60xi32>>) {
%c1_i64 = arith.constant 1 : i64
%c60 = arith.constant 60 : index
%c0 = arith.constant 0 : index

View File

@ -3,7 +3,7 @@
// Test fir.is_present and fir.absent codegen
// CHECK-LABEL: @foo1
func @foo1(%arg0: !fir.box<!fir.array<?xf32>>) -> i1 {
func.func @foo1(%arg0: !fir.box<!fir.array<?xf32>>) -> 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<!fir.array<?xf32>>) -> i1
@ -11,7 +11,7 @@ func @foo1(%arg0: !fir.box<!fir.array<?xf32>>) -> i1 {
}
// CHECK-LABEL: @bar1
func @bar1() -> i1 {
func.func @bar1() -> i1 {
%0 = fir.absent !fir.box<!fir.array<?xf32>>
// CHECK: call i1 @foo1({ float*, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }* null)
%1 = fir.call @foo1(%0) : (!fir.box<!fir.array<?xf32>>) -> i1
@ -19,7 +19,7 @@ func @bar1() -> i1 {
}
// CHECK-LABEL: @foo2
func @foo2(%arg0: !fir.ref<i64>) -> i1 {
func.func @foo2(%arg0: !fir.ref<i64>) -> i1 {
// CHECK: %[[ptr:.*]] = ptrtoint i64* %{{.*}} to i64
// CHECK: icmp ne i64 %[[ptr]], 0
%0 = fir.is_present %arg0 : (!fir.ref<i64>) -> i1
@ -27,7 +27,7 @@ func @foo2(%arg0: !fir.ref<i64>) -> i1 {
}
// CHECK-LABEL: @bar2
func @bar2() -> i1 {
func.func @bar2() -> i1 {
%0 = fir.absent !fir.ref<i64>
// CHECK: call i1 @foo2(i64* null)
%1 = fir.call @foo2(%0) : (!fir.ref<i64>) -> i1
@ -35,7 +35,7 @@ func @bar2() -> i1 {
}
// 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 @@ func @foo3(%arg0: !fir.boxchar<1>) -> i1 {
}
// 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

View File

@ -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 @@ func @test_trunc(%0 : i256) -> i8 {
// 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 @@ func @test_sext(%0 : i8) -> i256 {
// 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 @@ func @test_fptrunc(%0 : f128) -> f16 {
// 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 @@ func @test_fpext(%0 : bf16) -> f80 {
// 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 @@ func @test_ascending(%0 : i8) -> index {
// 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 @@ func @test_descending(%0 : index) -> i8 {
// 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 @@ func @test_useless(%0 : f32) -> f32 {
// 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 @@ func @test_useless_sext(%0 : i32) -> f32 {
// 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 @@ func @test_hump(%0 : i32) -> i16 {
// 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 @@ func @test_slump(%0 : i32) -> i16 {
// 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

View File

@ -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<!fir.array<?x!fir.char<1,20>>>) {
func.func @char_section(%arg0: !fir.box<!fir.array<?x!fir.char<1,20>>>) {
%c7_i64 = arith.constant 7 : i64
%c1_i64 = arith.constant 1 : i64
%c0 = arith.constant 0 : index
@ -38,8 +38,8 @@ func @char_section(%arg0: !fir.box<!fir.array<?x!fir.char<1,20>>>) {
// CHECK-LABEL: llvm.func @foo(
// CHECK-SAME: %[[VAL_0:.*]]: !llvm.ptr<struct<(ptr<[[struct_t:.*]]>, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr<i8>, array<1 x i64>)>>) {
func private @bar(!fir.box<!fir.array<?x!fir.char<1,?>>>)
func @foo(%arg0: !fir.box<!fir.array<?x!fir.type<t{i:i32,c:!fir.char<1,10>}>>>) {
func.func private @bar(!fir.box<!fir.array<?x!fir.char<1,?>>>)
func.func @foo(%arg0: !fir.box<!fir.array<?x!fir.type<t{i:i32,c:!fir.char<1,10>}>>>) {
%c7_i64 = arith.constant 7 : i64
%c1_i64 = arith.constant 1 : i64
%c9_i64 = arith.constant 9 : i64

View File

@ -6,10 +6,10 @@
// call bar(x(5, 6:80:3))
// end subroutine
func private @bar1(!fir.box<!fir.array<?xf32>>)
func.func private @bar1(!fir.box<!fir.array<?xf32>>)
// 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<!fir.array<?x?xf32>>) {
func.func @test_rebox_1(%arg0: !fir.box<!fir.array<?x?xf32>>) {
// 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 @@ func @test_rebox_1(%arg0: !fir.box<!fir.array<?x?xf32>>) {
// call bar(x(4:30:1, 4:30:1))
// end subroutine
func private @bar_rebox_test2(!fir.box<!fir.array<?x?x!fir.char<1,?>>>)
func.func private @bar_rebox_test2(!fir.box<!fir.array<?x?x!fir.char<1,?>>>)
// 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<!fir.array<?x?x!fir.char<1,?>>>) {
func.func @test_rebox_2(%arg0: !fir.box<!fir.array<?x?x!fir.char<1,?>>>) {
%c1 = arith.constant 1 : index
%c4 = arith.constant 4 : index
%c30 = arith.constant 30 : index
@ -76,10 +76,10 @@ func @test_rebox_2(%arg0: !fir.box<!fir.array<?x?x!fir.char<1,?>>>) {
// call bar(p)
// end subroutine
func private @bar_rebox_test3(!fir.box<!fir.array<?x?x?xf32>>)
func.func private @bar_rebox_test3(!fir.box<!fir.array<?x?x?xf32>>)
// 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<!fir.array<?xf32>>) {
func.func @test_rebox_3(%arg0: !fir.box<!fir.array<?xf32>>) {
// 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 @@ func @test_rebox_3(%arg0: !fir.box<!fir.array<?xf32>>) {
// 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<!fir.array<?x!fir.char<1,?>>>) {
func.func @test_rebox_4(%arg0: !fir.box<!fir.array<?x!fir.char<1,?>>>) {
// 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 @@ func @test_rebox_4(%arg0: !fir.box<!fir.array<?x!fir.char<1,?>>>) {
fir.call @bar_test_rebox_4(%1) : (!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,10>>>>) -> ()
return
}
func private @bar_test_rebox_4(!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,10>>>>)
func.func private @bar_test_rebox_4(!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,10>>>>)

View File

@ -14,6 +14,6 @@
// CHECK-SAME: %{{.*}}: !llvm.struct<"[[T1:.*]]", (ptr<struct<"[[T1]]">>)>
// CHECK-SAME: %{{.*}}: !llvm.struct<"[[T2:.*]]", (f32, ptr<struct<"[[T2]]">>, i32, ptr<struct<"[[T2]]">>)>
// CHECK-SAME: %{{.*}}: !llvm.struct<"[[T3:.*]]", (ptr<struct<"[[T4:.*]]", (ptr<struct<"[[T3]]">>)>>)>, %{{.*}}: !llvm.struct<"[[T4]]", (ptr<struct<"[[T3]]", (ptr<struct<"[[T4]]">>)>>)>)
func @recursiveTypes(%a : !t1, %b : !t2, %c : !t3, %d : !t4) {
func.func @recursiveTypes(%a : !t1, %b : !t2, %c : !t3, %d : !t4) {
return
}

View File

@ -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 @@ func @f(%a : i32) -> i32 {
}
// 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 @@ func @g(%a : i32) -> i32 {
}
// 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

View File

@ -9,7 +9,7 @@
// INT32-SAME: ([[ARG0:%[0-9A-Za-z]+]]: !fir.ref<!fir.char<1,?>>, [[ARG1:%[0-9A-Za-z]+]]: !fir.ref<!fir.char<1,?>>, [[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<!fir.char<1,?>>, [[ARG1:%[0-9A-Za-z]+]]: !fir.ref<!fir.char<1,?>>, [[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<!fir.char<1,?>>, i32) -> !fir.boxchar<1>
// INT32-DAG: [[B1:%[0-9]+]] = fir.emboxchar [[ARG0]], [[ARG2]] : (!fir.ref<!fir.char<1,?>>, i32) -> !fir.boxchar<1>
// INT32-DAG: fir.unboxchar [[B0]] : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1>>, i64)
@ -30,7 +30,7 @@ func @boxcharparams(%arg0 : !fir.boxchar<1>, %arg1 : !fir.boxchar<1>) -> i64 {
// INT32-SAME: ([[ARG0:%[0-9A-Za-z]+]]: !fir.ref<!fir.char<1,?>> {llvm.sret}, [[ARG1:%[0-9A-Za-z]+]]: i32, [[ARG2:%[0-9A-Za-z]+]]: !fir.ref<!fir.char<1,?>>, [[ARG3:%[0-9A-Za-z]+]]: i32)
// INT64-LABEL: @boxcharsret
// INT64-SAME: ([[ARG0:%[0-9A-Za-z]+]]: !fir.ref<!fir.char<1,?>> {llvm.sret}, [[ARG1:%[0-9A-Za-z]+]]: i64, [[ARG2:%[0-9A-Za-z]+]]: !fir.ref<!fir.char<1,?>>, [[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<!fir.char<1,?>>, i32) -> !fir.boxchar<1>
// INT32-DAG: [[B1:%[0-9]+]] = fir.emboxchar [[ARG2]], [[ARG3]] : (!fir.ref<!fir.char<1,?>>, i32) -> !fir.boxchar<1>
// INT32-DAG: fir.unboxchar [[B0]] : (!fir.boxchar<1>) -> (!fir.ref<!fir.array<?x!fir.char<1>>>, i64)
@ -60,18 +60,18 @@ func @boxcharsret(%arg0 : !fir.boxchar<1> {llvm.sret}, %arg1 : !fir.boxchar<1>)
// INT32-SAME: ({{%[0-9A-Za-z]+}}: !fir.ref<!fir.char<1,?>> {llvm.sret}, {{%[0-9A-Za-z]+}}: i32, {{%[0-9A-Za-z]+}}: !fir.ref<!fir.char<1,?>>, {{%[0-9A-Za-z]+}}: !fir.ref<!fir.char<1,?>>, {{%[0-9A-Za-z]+}}: i32, {{%[0-9A-Za-z]+}}: i32)
// INT64-LABEL: @boxcharmultiple
// INT64-SAME: ({{%[0-9A-Za-z]+}}: !fir.ref<!fir.char<1,?>> {llvm.sret}, {{%[0-9A-Za-z]+}}: i64, {{%[0-9A-Za-z]+}}: !fir.ref<!fir.char<1,?>>, {{%[0-9A-Za-z]+}}: !fir.ref<!fir.char<1,?>>, {{%[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<!fir.char<1,?>>, i32)
// INT64-LABEL: @boxcharcallee(!fir.ref<!fir.char<1,?>>, 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<!fir.char<1,9>>
%2 = arith.constant 9 : i64
%3 = fir.convert %1 : (!fir.ref<!fir.char<1,9>>) -> !fir.ref<!fir.char<1,?>>
@ -97,7 +97,7 @@ fir.global @name constant : !fir.char<1,9> {
// 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<!fir.char<1,?>>, i32) -> ()
// INT64: {{.*}} = fir.address_of(@boxcharcallee) : (!fir.ref<!fir.char<1,?>>, i64) -> ()
%f = fir.address_of(@boxcharcallee) : (!fir.boxchar<1>) -> ()

View File

@ -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<!fir.char<1,7>>, index) -> !fir.boxchar<1>
func.func private @takes_char(!fir.boxchar<1>)
func.func private @char_proc(!fir.ref<!fir.char<1,7>>, index) -> !fir.boxchar<1>
func @_QPcst_len() {
func.func @_QPcst_len() {
%0 = fir.address_of(@char_proc) : (!fir.ref<!fir.char<1,7>>, index) -> !fir.boxchar<1>
%c7_i64 = arith.constant 7 : i64
%1 = fir.convert %0 : ((!fir.ref<!fir.char<1,7>>, index) -> !fir.boxchar<1>) -> (() -> ())
@ -26,7 +26,7 @@ func @_QPcst_len() {
// 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<!fir.char<1,7>>, index) -> !fir.boxchar<1>
%c7_i64 = arith.constant 7 : i64
%1 = fir.convert %0 : ((!fir.ref<!fir.char<1,7>>, index) -> !fir.boxchar<1>) -> (() -> ())
@ -48,7 +48,7 @@ func @test_dummy_proc_that_takes_dummy_char_proc(%arg0: () -> ()) {
// CHECK-SAME: %[[C_ADDR:.*]]: !fir.ref<!fir.char<1,?>>,
// 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>

View File

@ -9,7 +9,7 @@
// X64-LABEL: func @returncomplex4() -> !fir.vector<2:!fir.real<4>>
// AARCH64-LABEL: func @returncomplex4() -> tuple<!fir.real<4>, !fir.real<4>>
// PPC-LABEL: func @returncomplex4() -> tuple<!fir.real<4>, !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 @@ func @returncomplex4() -> !fir.complex<4> {
// X64-LABEL: func @returncomplex8() -> tuple<!fir.real<8>, !fir.real<8>>
// AARCH64-LABEL: func @returncomplex8() -> tuple<!fir.real<8>, !fir.real<8>>
// PPC-LABEL: func @returncomplex8() -> tuple<!fir.real<8>, !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 @@ func @returncomplex8() -> !fir.complex<8> {
// 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 @@ func @callcomplex4() {
// 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>, !fir.real<8>>
// I32: fir.call @returncomplex8([[RES]]) : (!fir.ref<tuple<!fir.real<8>, !fir.real<8>>>) -> ()
// X64: [[RES:%[0-9A-Za-z]+]] = fir.call @returncomplex8() : () -> tuple<!fir.real<8>, !fir.real<8>>
@ -216,7 +216,7 @@ func @callcomplex8() {
// 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<tuple<!fir.real<4>, !fir.real<4>>> {llvm.align = 4 : i32, llvm.byval}, [[Z2:%[0-9A-Za-z]+]]: !fir.ref<tuple<!fir.real<4>, !fir.real<4>>> {llvm.align = 4 : i32, llvm.byval}, [[Z3:%[0-9A-Za-z]+]]: !fir.ref<tuple<!fir.real<4>, !fir.real<4>>> {llvm.align = 4 : i32, llvm.byval})
@ -226,7 +226,7 @@ func private @calleemultipleparamscomplex4(!fir.complex<4>, !fir.complex<4>, !fi
// 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<tuple<!fir.real<4>, !fir.real<4>>>) -> !fir.ref<!fir.complex<4>>
// I32-DAG: [[Z1_VAL:%[0-9A-Za-z]+]] = fir.load [[Z1_ADDR]] : !fir.ref<!fir.complex<4>>
// I32-DAG: [[Z2_ADDR:%[0-9A-Za-z]+]] = fir.convert [[Z2]] : (!fir.ref<tuple<!fir.real<4>, !fir.real<4>>>) -> !fir.ref<!fir.complex<4>>
@ -340,7 +340,7 @@ func @multipleparamscomplex4(%z1 : !fir.complex<4>, %z2 : !fir.complex<4>, %z3 :
// 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<f32, f32>
func private @mlircomplexf32(%z1: complex<f32>, %z2: complex<f32>) -> complex<f32> {
func.func private @mlircomplexf32(%z1: complex<f32>, %z2: complex<f32>) -> complex<f32> {
// I32-DAG: [[Z1_ADDR:%[0-9A-Za-z]+]] = fir.convert [[Z1]] : (!fir.ref<tuple<f32, f32>>) -> !fir.ref<complex<f32>>
// I32-DAG: [[Z1_VAL:%[0-9A-Za-z]+]] = fir.load [[Z1_ADDR]] : !fir.ref<complex<f32>>
@ -459,7 +459,7 @@ func private @mlircomplexf32(%z1: complex<f32>, %z2: complex<f32>) -> complex<f3
// 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>, !fir.real<4>>

View File

@ -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
}
}

View File

@ -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<?xf32>)
func.func private @foo1(%arg0: !fir.array<?xf32>)
// CHECK-LABEL: foo1
// CHECK-SAME: !llvm.ptr<f32>
func private @foo2(%arg0: !fir.array<?x?xf128>)
func.func private @foo2(%arg0: !fir.array<?x?xf128>)
// CHECK-LABEL: foo2
// CHECK-SAME: !llvm.ptr<f128>
func private @foo3(%arg0: !fir.array<*:i32>)
func.func private @foo3(%arg0: !fir.array<*:i32>)
// CHECK-LABEL: foo3
// CHECK-SAME: !llvm.ptr<i32>
func private @foo4(%arg0: !fir.array<3x?xi32>)
func.func private @foo4(%arg0: !fir.array<3x?xi32>)
// CHECK-LABEL: foo4
// CHECK-SAME: !llvm.ptr<array<3 x i32>>
func private @foo5(%arg0: !fir.array<?x6xi32>)
func.func private @foo5(%arg0: !fir.array<?x6xi32>)
// CHECK-LABEL: foo5
// CHECK-SAME: !llvm.ptr<i32>
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<array<2 x i32>
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<i8>
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<array<6 x array<3 x i8>
@ -38,28 +38,28 @@ func private @foo8(%arg0: !fir.array<6x?x!fir.char<1,3>>)
// Test reference types `!fir.ref`
func private @foo0(%arg0: !fir.ref<i32>)
func.func private @foo0(%arg0: !fir.ref<i32>)
// CHECK-LABEL: foo0
// CHECK-SAME: !llvm.ptr<i32>
func private @foo1(%arg0: !fir.ref<!fir.array<10xf32>>)
func.func private @foo1(%arg0: !fir.ref<!fir.array<10xf32>>)
// CHECK-LABEL: foo1
// CHECK-SAME: !llvm.ptr<array<10 x f32>>
func private @foo2(%arg0: !fir.ref<!fir.box<!fir.heap<!fir.type<_QMs1Ta1{x:i32,y:f32}>>>>)
func.func private @foo2(%arg0: !fir.ref<!fir.box<!fir.heap<!fir.type<_QMs1Ta1{x:i32,y:f32}>>>>)
// CHECK-LABEL: foo2
// CHECK-SAME: !llvm.ptr<struct<(ptr<struct<"_QMs1Ta1", (i32, f32)>>, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, ptr<i{{.*}}>, array<1 x i{{.*}}>)>>
func private @foo3(%arg0: !fir.ref<!fir.array<10x?x11xf32>>)
func.func private @foo3(%arg0: !fir.ref<!fir.array<10x?x11xf32>>)
// CHECK-LABEL: foo3
// CHECK-SAME: !llvm.ptr<f32>
func private @foo4(%arg0: !fir.ref<!fir.array<10x11x?x?xf32>>)
func.func private @foo4(%arg0: !fir.ref<!fir.array<10x11x?x?xf32>>)
// CHECK-LABEL: foo4
// CHECK-SAME: !llvm.ptr<array<11 x array<10 x f32>>>
func private @foo5(%arg0: !fir.ref<!fir.array<10x!fir.char<1,?>>>)
func.func private @foo5(%arg0: !fir.ref<!fir.array<10x!fir.char<1,?>>>)
// CHECK-LABEL: foo5
// CHECK-SAME: !llvm.ptr<i8>
func private @foo6(%arg0: !fir.ref<!fir.array<10x!fir.char<2,8>>>)
func.func private @foo6(%arg0: !fir.ref<!fir.array<10x!fir.char<2,8>>>)
// CHECK-LABEL: foo6
// CHECK-SAME: !llvm.ptr<array<10 x array<8 x i16>
func private @foo7(%arg0: !fir.ref<!fir.box<!fir.array<?xf32>>>)
func.func private @foo7(%arg0: !fir.ref<!fir.box<!fir.array<?xf32>>>)
// CHECK-LABEL: foo7
// CHECK-SAME: !llvm.ptr<struct<(ptr<f32>, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<1 x array<3 x i{{.*}}>>)>>
@ -67,11 +67,11 @@ func private @foo7(%arg0: !fir.ref<!fir.box<!fir.array<?xf32>>>)
// Test pointer types `!fir.ptr`
func private @foo0(%arg0: !fir.ptr<i32>)
func.func private @foo0(%arg0: !fir.ptr<i32>)
// CHECK-LABEL: foo0
// CHECK-SAME: !llvm.ptr<i32>
func private @foo1(%arg0: !fir.ptr<!fir.array<10xf32>>)
func.func private @foo1(%arg0: !fir.ptr<!fir.array<10xf32>>)
// CHECK-LABEL: foo1
// CHECK-SAME: !llvm.ptr<array<10 x f32>>
@ -79,23 +79,23 @@ func private @foo1(%arg0: !fir.ptr<!fir.array<10xf32>>)
// Test box types `!fir.box`
func private @foo0(%arg0: !fir.box<!fir.array<?xf32>>)
func.func private @foo0(%arg0: !fir.box<!fir.array<?xf32>>)
// CHECK-LABEL: foo0
// CHECK-SAME: !llvm.ptr<struct<(ptr<f32>, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<1 x array<3 x i{{.*}}>>)>>
func private @foo1(%arg0: !fir.box<!fir.array<10xf32>>)
func.func private @foo1(%arg0: !fir.box<!fir.array<10xf32>>)
// CHECK-LABEL: foo1
// CHECK-SAME: !llvm.ptr<struct<(ptr<array<10 x f32>>, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<1 x array<3 x i{{.*}}>>)>>
func private @foo2(%arg0: !fir.box<!fir.ref<i64>>)
func.func private @foo2(%arg0: !fir.box<!fir.ref<i64>>)
// CHECK-LABEL: foo2
// CHECK-SAME: !llvm.ptr<struct<(ptr<i64>, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}})>>
func private @foo3(%arg0: !fir.box<!fir.type<derived{f:f32}>>)
func.func private @foo3(%arg0: !fir.box<!fir.type<derived{f:f32}>>)
// CHECK-LABEL: foo3
// CHECK-SAME: !llvm.ptr<struct<(ptr<struct<"derived", (f32)>>, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, ptr<i{{.*}}>, array<1 x i{{.*}}>)>>
func private @foo4(%arg0: !fir.box<!fir.heap<!fir.type<_QMs1Ta1{x:i32,y:f32}>>>)
func.func private @foo4(%arg0: !fir.box<!fir.heap<!fir.type<_QMs1Ta1{x:i32,y:f32}>>>)
// CHECK-LABEL: foo4
// CHECK-SAME: !llvm.ptr<struct<(ptr<struct<"_QMs1Ta1", (i32, f32)>>, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, ptr<i{{.*}}>, array<1 x i{{.*}}>)>>
@ -103,17 +103,17 @@ func private @foo4(%arg0: !fir.box<!fir.heap<!fir.type<_QMs1Ta1{x:i32,y:f32}>>>)
// Test char types `!fir.char<k, n>`
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 @@ func private @foo2(%arg0: !fir.char<4, 8>, %arg1: !fir.char<4, ?>)
// -----
// Test `!fir.heap<>` conversion.
func private @foo0(%arg0: !fir.heap<i32>)
func.func private @foo0(%arg0: !fir.heap<i32>)
// CHECK-LABEL: foo0
// CHECK-SAME: !llvm.ptr<i32>
func private @foo1(%arg0: !fir.heap<!fir.array<4xf32>>)
func.func private @foo1(%arg0: !fir.heap<!fir.array<4xf32>>)
// CHECK-LABEL: foo1
// CHECK-SAME: !llvm.ptr<array<4 x f32>>
func private @foo2(%arg0: !fir.heap<!fir.array<?xf32>>)
func.func private @foo2(%arg0: !fir.heap<!fir.array<?xf32>>)
// CHECK-LABEL: foo2
// CHECK-SAME: !llvm.ptr<f32>
func private @foo3(%arg0: !fir.heap<!fir.char<1,10>>)
func.func private @foo3(%arg0: !fir.heap<!fir.char<1,10>>)
// CHECK-LABEL: foo3
// CHECK-SAME: !llvm.ptr<array<10 x i8>>
func private @foo4(%arg0: !fir.heap<!fir.char<1,?>>)
func.func private @foo4(%arg0: !fir.heap<!fir.char<1,?>>)
// CHECK-LABEL: foo4
// CHECK-SAME: !llvm.ptr<i8>
func private @foo5(%arg0: !fir.heap<!fir.array<2xf32>>)
func.func private @foo5(%arg0: !fir.heap<!fir.array<2xf32>>)
// CHECK-LABEL: foo5
// CHECK-SAME: !llvm.ptr<array<2 x f32>>
func private @foo6(%arg0: !fir.heap<!fir.array<?x?xf32>>)
func.func private @foo6(%arg0: !fir.heap<!fir.array<?x?xf32>>)
// CHECK-LABEL: foo6
// CHECK-SAME: !llvm.ptr<f32>
func private @foo7(%arg0: !fir.heap<!fir.type<ZT>>)
func.func private @foo7(%arg0: !fir.heap<!fir.type<ZT>>)
// CHECK-LABEL: foo7
// CHECK-SAME: !llvm.ptr<struct<"ZT", ()>>
func private @foo8(%arg0: !fir.heap<!fir.type<_QMalloc_assignTt{i:i32}>>)
func.func private @foo8(%arg0: !fir.heap<!fir.type<_QMalloc_assignTt{i:i32}>>)
// CHECK-LABEL: foo8
// CHECK-SAME: !llvm.ptr<struct<"_QMalloc_assignTt", (i32)>>
@ -161,23 +161,23 @@ func private @foo8(%arg0: !fir.heap<!fir.type<_QMalloc_assignTt{i:i32}>>)
// Test `!fir.integer<KIND>` 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 @@ func private @foo4(%arg0: !fir.int<16>)
// Test `!fir.logical<KIND>` 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 @@ func private @foo4(%arg0: !fir.logical<16>)
// Test `!fir.llvm_ptr` conversion.
func private @foo0(%arg0: !fir.llvm_ptr<i8>)
func.func private @foo0(%arg0: !fir.llvm_ptr<i8>)
// CHECK-LABEL: foo0
// CHECK-SAME: !llvm.ptr<i8>
func private @foo1(%arg0: !fir.llvm_ptr<!fir.ref<f32>>)
func.func private @foo1(%arg0: !fir.llvm_ptr<!fir.ref<f32>>)
// CHECK-LABEL: foo1
// CHECK-SAME: !llvm.ptr<ptr<f32>>
func private @foo2(%arg0: !fir.llvm_ptr<!fir.ref<!fir.box<!fir.ptr<i32>>>>)
func.func private @foo2(%arg0: !fir.llvm_ptr<!fir.ref<!fir.box<!fir.ptr<i32>>>>)
// CHECK-LABEL: foo2
// CHECK-SAME: !llvm.ptr<ptr<struct<(ptr<i32>, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}})>>>
func private @foo3(%arg0: !fir.llvm_ptr<!fir.ptr<f32>>)
func.func private @foo3(%arg0: !fir.llvm_ptr<!fir.ptr<f32>>)
// CHECK-LABEL: foo3
// CHECK-SAME: !llvm.ptr<ptr<f32>>
@ -229,27 +229,27 @@ func private @foo3(%arg0: !fir.llvm_ptr<!fir.ptr<f32>>)
// Test MLIR `complex<KIND>` conversion.
func private @foo0(%arg0: complex<f16>)
func.func private @foo0(%arg0: complex<f16>)
// CHECK-LABEL: foo0
// CHECK-SAME: !llvm.struct<(f16, f16)>)
func private @foo1(%arg0: complex<bf16>)
func.func private @foo1(%arg0: complex<bf16>)
// CHECK-LABEL: foo1
// CHECK-SAME: !llvm.struct<(bf16, bf16)>)
func private @foo2(%arg0: complex<f32>)
func.func private @foo2(%arg0: complex<f32>)
// CHECK-LABEL: foo2
// CHECK-SAME: !llvm.struct<(f32, f32)>)
func private @foo3(%arg0: complex<f64>)
func.func private @foo3(%arg0: complex<f64>)
// CHECK-LABEL: foo3
// CHECK-SAME: !llvm.struct<(f64, f64)>)
func private @foo4(%arg0: complex<f80>)
func.func private @foo4(%arg0: complex<f80>)
// CHECK-LABEL: foo4
// CHECK-SAME: !llvm.struct<(f80, f80)>)
func private @foo5(%arg0: complex<f128>)
func.func private @foo5(%arg0: complex<f128>)
// CHECK-LABEL: foo5
// CHECK-SAME: !llvm.struct<(f128, f128)>)
@ -257,27 +257,27 @@ func private @foo5(%arg0: complex<f128>)
// Test `!fir.complex<KIND>` 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 @@ func private @foo5(%arg0: !fir.complex<16>)
// 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 @@ func private @foo16(%arg0: !fir.vector<2:!fir.real<16>>)
// Test `!fir.boxchar<n>` conversion
func private @foo0(%arg0: !fir.boxchar<1>)
func.func private @foo0(%arg0: !fir.boxchar<1>)
// CHECK-LABEL: foo0
// CHECK-SAME: !llvm.struct<(ptr<i8>, i64)>
func private @foo1(%arg0: !fir.boxchar<2>)
func.func private @foo1(%arg0: !fir.boxchar<2>)
// CHECK-LABEL: foo1
// CHECK-SAME: !llvm.struct<(ptr<i16>, i64)>
@ -369,7 +369,7 @@ func private @foo1(%arg0: !fir.boxchar<2>)
// 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 @@ func private @foo0(%arg0: !fir.field)
// 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 @@ func private @foo0(%arg0: !fir.len)
// Test `!fir.tdesc` conversion.
func private @foo0(%arg0: !fir.tdesc<!fir.type<x>>)
func.func private @foo0(%arg0: !fir.tdesc<!fir.type<x>>)
// CHECK-LABEL: foo0
// CHECK-SAME: !llvm.ptr<i8>
func private @foo1(%arg : !fir.tdesc<!fir.array<100xf32>>)
func.func private @foo1(%arg : !fir.tdesc<!fir.array<100xf32>>)
// CHECK-LABEL: foo1
// CHECK-SAME: !llvm.ptr<i8>
func private @foo2(%arg : !fir.tdesc<f32>)
func.func private @foo2(%arg : !fir.tdesc<f32>)
// CHECK-LABEL: foo2
// CHECK-SAME: !llvm.ptr<i8>
func private @foo3(%arg : !fir.tdesc<!fir.type<derived7{f1:f32,f2:f32}>>)
func.func private @foo3(%arg : !fir.tdesc<!fir.type<derived7{f1:f32,f2:f32}>>)
// CHECK-LABEL: foo3
// CHECK-SAME: !llvm.ptr<i8>
// -----
// Test nested tuple types
func private @foo0(%arg0: tuple<i64, tuple<f32, i64>>)
func.func private @foo0(%arg0: tuple<i64, tuple<f32, i64>>)
// 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<i64, !fir.box<i32>>)
func.func private @foo0(%arg0: tuple<i64, !fir.box<i32>>)
// CHECK-LABEL: foo0
// CHECK-SAME: !llvm.struct<(i64, struct<(ptr<i32>, i{{.*}})>)>
func private @foo1(%arg0: !fir.type<derived8{a:i64,b:!fir.box<i32>}>)
func.func private @foo1(%arg0: !fir.type<derived8{a:i64,b:!fir.box<i32>}>)
// CHECK-LABEL: foo1
// CHECK-SAME: !llvm.struct<"derived8", (i64, struct<(ptr<i32>, i{{.*}})>)>
@ -423,6 +423,6 @@ func private @foo1(%arg0: !fir.type<derived8{a:i64,b:!fir.box<i32>}>)
// Test fir.box<none> translation.
// `none` is used for polymorphic type.
func private @foo0(%arg0: !fir.box<none>)
func.func private @foo0(%arg0: !fir.box<none>)
// CHECK-LABEL: foo0
// CHECK-SAME: !llvm.ptr<struct<(ptr<struct<()>>, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}})>>)

View File

@ -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>

View File

@ -209,7 +209,7 @@ def ConstantOp : Func_Op<"constant",
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 @@ def FuncOp : Func_Op<"func", [
/// Returns the result types of this function.
ArrayRef<Type> getResultTypes() { return getFunctionType().getResults(); }
//===------------------------------------------------------------------===//
// OpAsmOpInterface Methods
//===------------------------------------------------------------------===//
/// Allow the dialect prefix to be omitted.
static StringRef getDefaultDialect() { return "func"; }
//===------------------------------------------------------------------===//
// SymbolOpInterface Methods
//===------------------------------------------------------------------===//

View File

@ -630,10 +630,6 @@ void OpState::printOpName(Operation *op, OpAsmPrinter &p,
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;
}

View File

@ -1602,11 +1602,6 @@ FailureOr<OperationName> OperationParser::parseCustomOperationName() {
// 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();

View File

@ -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

View File

@ -211,7 +211,7 @@ func.func @nested_region(
// 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 @@ func.func @nested_region2(
// 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,

View File

@ -387,7 +387,7 @@ static void printFirstOfEach(MlirContext ctx, MlirOperation operation) {
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 testTypeID(MlirContext ctx) {
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));

View File

@ -1325,7 +1325,7 @@ func.func @test_negf() -> (f32) {
// 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 @@ func @test_remui() -> (vector<4xi32>) {
// 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 @@ func @test_remui_1(%arg : vector<4xi32>) -> (vector<4xi32>) {
// 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 @@ func @test_remsi() -> (vector<4xi32>) {
// 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>

View File

@ -672,7 +672,7 @@ func.func @write_into_constant_via_alias(%v : vector<5xi32>,
// -----
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 @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})

View File

@ -31,7 +31,7 @@ module attributes {gpu.container_module} {
}
// 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 @@ module attributes {gpu.container_module} {
}
// 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) {

View File

@ -160,7 +160,7 @@ func.func @conv_slice(%input: tensor<1x225x225x3xf32>, %filter: tensor<3x3x3x32x
//-----
// 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>

View File

@ -658,14 +658,14 @@ func.func @generic_index_op2(%arg0: tensor<1x8xf64>, %arg1: tensor<1x8xi32>) ->
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 @@ func.func @generic_index_op2(%arg0: tensor<1x8xf64>, %arg1: tensor<1x8xi32>) ->
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>

View File

@ -21,7 +21,7 @@ transform.with_pdl_patterns {
// 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>) {

View File

@ -708,7 +708,7 @@ func.func @omp_atomic_update9(%x: memref<i32>, %expr: i32) {
// -----
func @omp_atomic_update(%x: memref<i32>, %expr: i32) {
func.func @omp_atomic_update(%x: memref<i32>, %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<i32> {
^bb0(%xval: i32):
@ -720,7 +720,7 @@ func @omp_atomic_update(%x: memref<i32>, %expr: i32) {
// -----
func @omp_atomic_update(%x: memref<i32>, %expr: i32) {
func.func @omp_atomic_update(%x: memref<i32>, %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<i32> {
^bb0(%xval: i32):
@ -732,7 +732,7 @@ func @omp_atomic_update(%x: memref<i32>, %expr: i32) {
// -----
func @omp_atomic_update(%x: memref<i32>, %expr: i32) {
func.func @omp_atomic_update(%x: memref<i32>, %expr: i32) {
// expected-error @below {{invalid_hint is not a valid hint}}
omp.atomic.update hint(invalid_hint) %x : memref<i32> {
^bb0(%xval: i32):
@ -884,7 +884,7 @@ func.func @omp_atomic_capture(%x: memref<i32>, %y: memref<i32>, %v: memref<i32>,
// -----
func @omp_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) {
func.func @omp_atomic_capture(%x: memref<i32>, %v: memref<i32>, %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<i32> {
@ -899,7 +899,7 @@ func @omp_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) {
// -----
func @omp_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) {
func.func @omp_atomic_capture(%x: memref<i32>, %v: memref<i32>, %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<i32> {
@ -914,7 +914,7 @@ func @omp_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) {
// -----
func @omp_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) {
func.func @omp_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) {
// expected-error @below {{invalid_hint is not a valid hint}}
omp.atomic.capture hint(invalid_hint) {
omp.atomic.update %x : memref<i32> {
@ -929,7 +929,7 @@ func @omp_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) {
// -----
func @omp_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) {
func.func @omp_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) {
// expected-error @below {{operations inside capture region must not have hint clause}}
omp.atomic.capture {
omp.atomic.update hint(uncontended) %x : memref<i32> {
@ -1146,7 +1146,7 @@ func.func @omp_task(%mem: memref<1xf32>) {
// -----
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_cancel() {
// -----
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_cancel1() {
// -----
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_cancel2() {
// -----
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_cancel3(%arg1 : i32, %arg2 : i32, %arg3 : i32) -> () {
// -----
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_cancel4(%arg1 : i32, %arg2 : i32, %arg3 : i32) -> () {
// -----
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_cancel5() -> () {
// -----
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_cancellationpoint() {
// -----
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_cancellationpoint1() {
// -----
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)

View File

@ -1277,7 +1277,7 @@ func.func @omp_threadprivate() {
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 @@ func @omp_cancel_parallel(%if_cond : i1) -> () {
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 @@ func @omp_cancel_wsloop(%lb : index, %ub : index, %step : index) {
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 @@ func @omp_cancel_sections() -> () {
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 @@ func @omp_cancellationpoint_parallel() -> () {
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 @@ func @omp_cancellationpoint_wsloop(%lb : index, %ub : index, %step : index) {
return
}
func @omp_cancellationpoint_sections() -> () {
func.func @omp_cancellationpoint_sections() -> () {
omp.sections {
omp.section {
// CHECK: omp.cancellationpoint cancellation_construct_type(sections)

View File

@ -137,7 +137,7 @@ func.func @nested_parallel(%0: memref<?x?x?xf64>) -> memref<?x?x?xf64> {
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 private @side_effect()
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 @@ func.func @all_unused(%cond: i1) {
%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 @@ func.func @for_yields_3(%lb : index, %ub : index, %step : index) -> (i32, i32, i
%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 @@ func.func @for_yields_3(%lb : index, %ub : index, %step : index) -> (i32, i32, i
// 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 @@ func.func @last_value(%t0: tensor<128x128xf32>, %t1: tensor<128x128xf32>,
%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 @@ func.func @matmul_on_tensors(%t0: tensor<32x1024xf32>, %t1: tensor<1024x1024xf32
// 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<?x?xf32>
// CHECK: %[[DONE:.*]] = call @do(%[[CAST]]) : (tensor<?x?xf32>) -> tensor<?x?xf32>
// CHECK: %[[DONE:.*]] = func.call @do(%[[CAST]]) : (tensor<?x?xf32>) -> tensor<?x?xf32>
// CHECK: %[[UNCAST:.*]] = tensor.cast %[[DONE]] : tensor<?x?xf32> to tensor<32x1024xf32>
// CHECK: scf.yield %[[UNCAST]] : tensor<32x1024xf32>
%0 = tensor.cast %t0 : tensor<32x1024xf32> to tensor<?x?xf32>
%1 = scf.for %i = %c0 to %c1024 step %c32 iter_args(%iter_t0 = %0) -> (tensor<?x?xf32>) {
%2 = call @do(%iter_t0) : (tensor<?x?xf32>) -> tensor<?x?xf32>
%2 = func.call @do(%iter_t0) : (tensor<?x?xf32>) -> tensor<?x?xf32>
scf.yield %2 : tensor<?x?xf32>
}
// CHECK-NOT: tensor.cast

View File

@ -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<i8>, memref<?xindex>, memref<i32>) -> i1
// CHECK: %[[Cond:.*]] = func.call @getNextI32(%[[Iter]], %[[IndD]], %[[ElemBuffer]]) : (!llvm.ptr<i8>, memref<?xindex>, memref<i32>) -> i1
// CHECK: scf.condition(%[[Cond]])
// CHECK: } do {
// CHECK: %[[Iv0:.*]] = memref.load %[[IndS]][%[[I0]]] : memref<1xindex>
@ -76,7 +76,7 @@ func.func @sparse_convert_1d(%arg0: tensor<13xi32, #SparseVector>) -> tensor<13x
// CHECK-DAG: %[[M:.*]] = memref.alloc(%[[SizeI0]]) : memref<?xi32>
// CHECK-DAG: linalg.fill ins(%[[zeroI32]] : i32) outs(%[[M]] : memref<?xi32>)
// CHECK: scf.while : () -> () {
// CHECK: %[[Cond:.*]] = call @getNextI32(%[[Iter]], %[[IndD]], %[[ElemBuffer]]) : (!llvm.ptr<i8>, memref<?xindex>, memref<i32>) -> i1
// CHECK: %[[Cond:.*]] = func.call @getNextI32(%[[Iter]], %[[IndD]], %[[ElemBuffer]]) : (!llvm.ptr<i8>, memref<?xindex>, memref<i32>) -> i1
// CHECK: scf.condition(%[[Cond]])
// CHECK: } do {
// CHECK: %[[Iv0:.*]] = memref.load %[[IndS]][%[[I0]]] : memref<1xindex>
@ -119,7 +119,7 @@ func.func @sparse_convert_1d_dyn(%arg0: tensor<?xi32, #SparseVector>) -> tensor<
// 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<i8>, memref<?xindex>, memref<f64>) -> i1
// CHECK: %[[Cond:.*]] = func.call @getNextF64(%[[Iter]], %[[IndD]], %[[ElemBuffer]]) : (!llvm.ptr<i8>, memref<?xindex>, memref<f64>) -> i1
// CHECK: scf.condition(%[[Cond]])
// CHECK: } do {
// CHECK: %[[Iv0:.*]] = memref.load %[[IndS]][%[[I0]]] : memref<2xindex>
@ -163,7 +163,7 @@ func.func @sparse_convert_2d(%arg0: tensor<2x4xf64, #SparseMatrix>) -> tensor<2x
// CHECK-DAG: %[[E0:.*]] = arith.constant 0.000000e+00 : f64
// CHECK-DAG: linalg.fill ins(%[[E0]] : f64) outs(%[[M]] : memref<?x4xf64>)
// CHECK: scf.while : () -> () {
// CHECK: %[[Cond:.*]] = call @getNextF64(%[[Iter]], %[[IndD]], %[[ElemBuffer]]) : (!llvm.ptr<i8>, memref<?xindex>, memref<f64>) -> i1
// CHECK: %[[Cond:.*]] = func.call @getNextF64(%[[Iter]], %[[IndD]], %[[ElemBuffer]]) : (!llvm.ptr<i8>, memref<?xindex>, memref<f64>) -> i1
// CHECK: scf.condition(%[[Cond]])
// CHECK: } do {
// CHECK: %[[Iv0:.*]] = memref.load %[[IndS]][%[[I0]]] : memref<2xindex>
@ -207,7 +207,7 @@ func.func @sparse_convert_2d_dyn0(%arg0: tensor<?x4xf64, #SparseMatrix>) -> tens
// 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<i8>, memref<?xindex>, memref<f64>) -> i1
// CHECK: %[[Cond:.*]] = func.call @getNextF64(%[[Iter]], %[[IndD]], %[[ElemBuffer]]) : (!llvm.ptr<i8>, memref<?xindex>, memref<f64>) -> i1
// CHECK: scf.condition(%[[Cond]])
// CHECK: } do {
// CHECK: %[[Iv0:.*]] = memref.load %[[IndS]][%[[I0]]] : memref<2xindex>
@ -251,7 +251,7 @@ func.func @sparse_convert_2d_dyn1(%arg0: tensor<2x?xf64, #SparseMatrix>) -> tens
// CHECK-DAG: %[[E0:.*]] = arith.constant 0.000000e+00 : f64
// CHECK-DAG: linalg.fill ins(%[[E0]] : f64) outs(%[[M]] : memref<?x?xf64>)
// CHECK: scf.while : () -> () {
// CHECK: %[[Cond:.*]] = call @getNextF64(%[[Iter]], %[[IndD]], %[[ElemBuffer]]) : (!llvm.ptr<i8>, memref<?xindex>, memref<f64>) -> i1
// CHECK: %[[Cond:.*]] = func.call @getNextF64(%[[Iter]], %[[IndD]], %[[ElemBuffer]]) : (!llvm.ptr<i8>, memref<?xindex>, memref<f64>) -> i1
// CHECK: scf.condition(%[[Cond]])
// CHECK: } do {
// CHECK: %[[Iv0:.*]] = memref.load %[[IndS]][%[[I0]]] : memref<2xindex>
@ -299,7 +299,7 @@ func.func @sparse_convert_2d_dyn2(%arg0: tensor<?x?xf64, #SparseMatrix>) -> tens
// 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<i8>, memref<?xindex>, memref<f64>) -> i1
// CHECK: %[[Cond:.*]] = func.call @getNextF64(%[[Iter]], %[[IndD]], %[[ElemBuffer]]) : (!llvm.ptr<i8>, memref<?xindex>, memref<f64>) -> i1
// CHECK: scf.condition(%[[Cond]])
// CHECK: } do {
// CHECK: %[[Iv0:.*]] = memref.load %[[IndS]][%[[I0]]] : memref<3xindex>

View File

@ -638,7 +638,7 @@ func.func @dont_fold_expand_collapse(%arg0: vector<1x1x64xf32>) -> vector<8x8xf3
// 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 @@ func @fold_broadcast_shapecast(%arg0: vector<4xf32>) -> vector<4xf32> {
// 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 @@ func @dont_fold_broadcast_shapecast_scalar(%arg0: f32) -> vector<1xf32> {
// 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 @@ func.func @extract_element_splat_fold(%a : i32) -> i32 {
// 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 <add>, %a : vector<1xf32> into f32
return %s : f32
}
@ -1580,7 +1580,7 @@ func @reduce_one_element_vector_extract(%a : vector<1xf32>) -> f32 {
// 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 <add>, %a, %b : vector<1xf32> into f32
return %s : f32
}
@ -1592,7 +1592,7 @@ func @reduce_one_element_vector_addf(%a : vector<1xf32>, %b: f32) -> f32 {
// 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 <mul>, %a, %b : vector<1xf32> into f32
return %s : f32
}
@ -1601,7 +1601,7 @@ func @reduce_one_element_vector_mulf(%a : vector<1xf32>, %b: f32) -> f32 {
// 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 <add>, %a : vector<4xf32> into f32
return %s : f32
}

View File

@ -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">

View File

@ -412,7 +412,7 @@ func.func @disallowed_case7_fail() {
//===----------------------------------------------------------------------===//
// CHECK-LABEL: func @allowed_cases_pass
func @allowed_cases_pass() {
func.func @allowed_cases_pass() {
// CHECK: test.op_with_bit_enum <read,write>
"test.op_with_bit_enum"() {value = #test.bit_enum<read, write>} : () -> ()
// CHECK: test.op_with_bit_enum <read,execute>
@ -423,7 +423,7 @@ func @allowed_cases_pass() {
// -----
// CHECK-LABEL: func @allowed_cases_pass
func @allowed_cases_pass() {
func.func @allowed_cases_pass() {
// CHECK: test.op_with_bit_enum_vbar <user|group>
"test.op_with_bit_enum_vbar"() {
value = #test.bit_enum_vbar<user|group>
@ -435,7 +435,7 @@ func @allowed_cases_pass() {
// -----
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<sticky>} : () -> ()

View File

@ -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<i32, f64>
@ -18,7 +18,7 @@ func @succeededDynamicTypeVerifier() {
// -----
func @failedDynamicTypeVerifier() {
func.func @failedDynamicTypeVerifier() {
// expected-error@+1 {{expected 0 type arguments, but had 1}}
"unregistered_op"() : () -> !test.dynamic_singleton<f64>
return
@ -26,7 +26,7 @@ func @failedDynamicTypeVerifier() {
// -----
func @failedDynamicTypeVerifier2() {
func.func @failedDynamicTypeVerifier2() {
// expected-error@+1 {{expected 2 type arguments, but had 1}}
"unregistered_op"() : () -> !test.dynamic_pair<f64>
return
@ -35,7 +35,7 @@ func @failedDynamicTypeVerifier2() {
// -----
// CHECK-LABEL: func @customTypeParserPrinter
func @customTypeParserPrinter() {
func.func @customTypeParserPrinter() {
// CHECK: "unregistered_op"() : () -> !test.dynamic_custom_assembly_format<f32:f64>
"unregistered_op"() : () -> !test.dynamic_custom_assembly_format<f32 : f64>
return
@ -48,7 +48,7 @@ func @customTypeParserPrinter() {
//===----------------------------------------------------------------------===//
// 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 @succeededDynamicAttributeVerifier() {
// -----
func @failedDynamicAttributeVerifier() {
func.func @failedDynamicAttributeVerifier() {
// expected-error@+1 {{expected 0 attribute arguments, but had 1}}
"unregistered_op"() {test_attr = #test.dynamic_singleton<f64>} : () -> ()
return
@ -68,7 +68,7 @@ func @failedDynamicAttributeVerifier() {
// -----
func @failedDynamicAttributeVerifier2() {
func.func @failedDynamicAttributeVerifier2() {
// expected-error@+1 {{expected 2 attribute arguments, but had 1}}
"unregistered_op"() {test_attr = #test.dynamic_pair<f64>} : () -> ()
return
@ -77,7 +77,7 @@ func @failedDynamicAttributeVerifier2() {
// -----
// CHECK-LABEL: func @customAttributeParserPrinter
func @customAttributeParserPrinter() {
func.func @customAttributeParserPrinter() {
// CHECK: "unregistered_op"() {test_attr = #test.dynamic_custom_assembly_format<f32:f64>} : () -> ()
"unregistered_op"() {test_attr = #test.dynamic_custom_assembly_format<f32:f64>} : () -> ()
return
@ -90,7 +90,7 @@ func @customAttributeParserPrinter() {
// -----
// 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 @succeededDynamicOpVerifier(%a: f32) {
// -----
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 @failedDynamicOpVerifier() {
// -----
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 @@ func @failedDynamicOpVerifier2(%a: f32) {
// -----
// 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

View File

@ -826,7 +826,7 @@ func.func @mixed_named_arguments(f32,
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
}

View File

@ -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

View File

@ -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 @@ func @foo() {
cf.br ^header
}
func private @bar() {
func.func private @bar() {
return
}

View File

@ -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<?xf64, #SparseVector>,
%argb: tensor<?xf64, #SparseVector>) -> tensor<?xf64, #SparseVector> {
func.func @vector_min(%arga: tensor<?xf64, #SparseVector>,
%argb: tensor<?xf64, #SparseVector>) -> tensor<?xf64, #SparseVector> {
%c = arith.constant 0 : index
%d = tensor.dim %arga, %c : tensor<?xf64, #SparseVector>
%xv = sparse_tensor.init [%d] : tensor<?xf64, #SparseVector>
@ -63,8 +63,8 @@ module {
// 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<?xf64, #SparseVector>,
%argb: tensor<?xf64>) -> tensor<?xf64, #SparseVector> {
func.func @vector_mul(%arga: tensor<?xf64, #SparseVector>,
%argb: tensor<?xf64>) -> tensor<?xf64, #SparseVector> {
%c = arith.constant 0 : index
%d = tensor.dim %arga, %c : tensor<?xf64, #SparseVector>
%xv = sparse_tensor.init [%d] : tensor<?xf64, #SparseVector>
@ -87,8 +87,8 @@ module {
// 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<?xf64, #SparseVector>,
%argb: tensor<?xf64, #SparseVector>) -> tensor<?xf64, #SparseVector> {
func.func @vector_setdiff(%arga: tensor<?xf64, #SparseVector>,
%argb: tensor<?xf64, #SparseVector>) -> tensor<?xf64, #SparseVector> {
%c = arith.constant 0 : index
%d = tensor.dim %arga, %c : tensor<?xf64, #SparseVector>
%xv = sparse_tensor.init [%d] : tensor<?xf64, #SparseVector>
@ -106,7 +106,7 @@ module {
}
// Return the index of each entry
func @vector_index(%arga: tensor<?xf64, #SparseVector>) -> tensor<?xi32, #SparseVector> {
func.func @vector_index(%arga: tensor<?xf64, #SparseVector>) -> tensor<?xi32, #SparseVector> {
%c = arith.constant 0 : index
%d = tensor.dim %arga, %c : tensor<?xf64, #SparseVector>
%xv = sparse_tensor.init [%d] : tensor<?xi32, #SparseVector>
@ -130,8 +130,8 @@ module {
// 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<?x?xf64, #DCSR>,
%argb: tensor<?x?xf64, #DCSR>) -> tensor<?x?xf64, #DCSR> {
func.func @matrix_intersect(%arga: tensor<?x?xf64, #DCSR>,
%argb: tensor<?x?xf64, #DCSR>) -> tensor<?x?xf64, #DCSR> {
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
%d0 = tensor.dim %arga, %c0 : tensor<?x?xf64, #DCSR>
@ -159,7 +159,7 @@ module {
}
// Dumps a sparse vector of type f64.
func @dump_vec(%arg0: tensor<?xf64, #SparseVector>) {
func.func @dump_vec(%arg0: tensor<?xf64, #SparseVector>) {
// 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 @@ module {
}
// Dumps a sparse vector of type i32.
func @dump_vec_i32(%arg0: tensor<?xi32, #SparseVector>) {
func.func @dump_vec_i32(%arg0: tensor<?xi32, #SparseVector>) {
// 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 @@ module {
}
// Dump a sparse matrix.
func @dump_mat(%arg0: tensor<?x?xf64, #DCSR>) {
func.func @dump_mat(%arg0: tensor<?x?xf64, #DCSR>) {
%d0 = arith.constant 0.0 : f64
%c0 = arith.constant 0 : index
%dm = sparse_tensor.convert %arg0 : tensor<?x?xf64, #DCSR> to tensor<?x?xf64>
@ -205,7 +205,7 @@ module {
}
// Driver method to call and verify vector kernels.
func @entry() {
func.func @entry() {
%c0 = arith.constant 0 : index
// Setup sparse vectors.

View File

@ -16,7 +16,7 @@
module {
// Performs zero-preserving math to sparse vector.
func @sparse_tanh(%vec: tensor<?xf64, #SparseVector>
func.func @sparse_tanh(%vec: tensor<?xf64, #SparseVector>
{linalg.inplaceable = true})
-> tensor<?xf64, #SparseVector> {
%0 = linalg.generic #trait_op
@ -29,7 +29,7 @@ module {
}
// Dumps a sparse vector of type f64.
func @dump_vec_f64(%arg0: tensor<?xf64, #SparseVector>) {
func.func @dump_vec_f64(%arg0: tensor<?xf64, #SparseVector>) {
// 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 @@ module {
}
// 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] ],

View File

@ -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<?xf64, #SparseVector>) -> tensor<?xi32, #SparseVector> {
func.func @vector_complement(%arga: tensor<?xf64, #SparseVector>) -> tensor<?xi32, #SparseVector> {
%c = arith.constant 0 : index
%ci1 = arith.constant 1 : i32
%d = tensor.dim %arga, %c : tensor<?xf64, #SparseVector>
@ -48,7 +48,7 @@ module {
}
// Negate existing values. Fill missing ones with +1.
func @vector_negation(%arga: tensor<?xf64, #SparseVector>) -> tensor<?xf64, #SparseVector> {
func.func @vector_negation(%arga: tensor<?xf64, #SparseVector>) -> tensor<?xf64, #SparseVector> {
%c = arith.constant 0 : index
%cf1 = arith.constant 1.0 : f64
%d = tensor.dim %arga, %c : tensor<?xf64, #SparseVector>
@ -72,7 +72,7 @@ module {
}
// Clips values to the range [3, 7].
func @matrix_clip(%argx: tensor<?x?xf64, #DCSR>) -> tensor<?x?xf64, #DCSR> {
func.func @matrix_clip(%argx: tensor<?x?xf64, #DCSR>) -> tensor<?x?xf64, #DCSR> {
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
%cfmin = arith.constant 3.0 : f64
@ -100,7 +100,7 @@ module {
}
// Dumps a sparse vector of type f64.
func @dump_vec_f64(%arg0: tensor<?xf64, #SparseVector>) {
func.func @dump_vec_f64(%arg0: tensor<?xf64, #SparseVector>) {
// 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 @@ module {
}
// Dumps a sparse vector of type i32.
func @dump_vec_i32(%arg0: tensor<?xi32, #SparseVector>) {
func.func @dump_vec_i32(%arg0: tensor<?xi32, #SparseVector>) {
// 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 @@ module {
}
// Dump a sparse matrix.
func @dump_mat(%arg0: tensor<?x?xf64, #DCSR>) {
func.func @dump_mat(%arg0: tensor<?x?xf64, #DCSR>) {
%c0 = arith.constant 0 : index
%d0 = arith.constant -1.0 : f64
%0 = sparse_tensor.values %arg0 : tensor<?x?xf64, #DCSR> to memref<?xf64>
@ -149,7 +149,7 @@ module {
}
// Driver method to call and verify vector kernels.
func @entry() {
func.func @entry() {
%c0 = arith.constant 0 : index
// Setup sparse vectors.

View File

@ -11,10 +11,10 @@
// CHECK-NEXT: }
// CHECK: func @outline_if_else(
// CHECK-NEXT: %{{.*}} = scf.if %{{.*}} -> (i8) {
// CHECK-NEXT: %{{.*}} = call @outlined_then0(%{{.*}}, %{{.*}}) : (i1, memref<?xf32>) -> i8
// CHECK-NEXT: %{{.*}} = func.call @outlined_then0(%{{.*}}, %{{.*}}) : (i1, memref<?xf32>) -> 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 @@ func.func @outline_if_else(%cond: i1, %a: index, %b: memref<?xf32>, %c: i8) {
// CHECK-NEXT: }
// CHECK: func @outline_if(
// CHECK-NEXT: scf.if %{{.*}} {
// CHECK-NEXT: call @outlined_then0(%{{.*}}, %{{.*}}) : (i1, memref<?xf32>) -> ()
// CHECK-NEXT: func.call @outlined_then0(%{{.*}}, %{{.*}}) : (i1, memref<?xf32>) -> ()
// CHECK-NEXT: }
// CHECK-NEXT: return
// CHECK-NEXT: }
@ -60,9 +60,9 @@ func.func @outline_if(%cond: i1, %a: index, %b: memref<?xf32>, %c: i8) {
// 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<?xf32>) -> ()
// CHECK-NEXT: func.call @outlined_else0(%{{.*}}, %{{.*}}) : (i1, memref<?xf32>) -> ()
// CHECK-NEXT: }
// CHECK-NEXT: return
// CHECK-NEXT: }

View File

@ -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
}

View File

@ -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

View File

@ -75,7 +75,7 @@ def testTraverseOpRegionBlockIterators():
# 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 @@ def testTraverseOpRegionBlockIndices():
# 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 @@ def testOperationLoc():
@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 @@ def testModuleMerge():
@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 @@ def testAppendMoveFromAnotherBlock():
@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: