[flang] Keep fully qualified !fir.heap type for fir.freemem op

Re-introduce a fully qualified type on teh fir.freemem operation.
Since this is the only operation where the prefix gets elided in fir, this
patch make it fully qualified so the dialect syntax feels more consistent.

Reviewed By: vdonaldson

Differential Revision: https://reviews.llvm.org/D122839
This commit is contained in:
Valentin Clement 2022-03-31 21:34:55 +02:00
parent 4c14519ecb
commit 868c212f42
No known key found for this signature in database
GPG Key ID: 086D54783C928776
7 changed files with 11 additions and 11 deletions

View File

@ -250,7 +250,7 @@ def fir_FreeMemOp : fir_Op<"freemem", [MemoryEffects<[MemFree]>]> {
let arguments = (ins Arg<fir_HeapType, "", [MemFree]>:$heapref);
let assemblyFormat = "$heapref attr-dict `:` type($heapref)";
let assemblyFormat = "$heapref attr-dict `:` qualified(type($heapref))";
}
def fir_LoadOp : fir_OneResultOp<"load"> {

View File

@ -130,7 +130,7 @@ func @conversion_with_temporary(%arr0 : !fir.ref<!fir.array<10xi32>>) {
// CHECK: fir.store %[[LOAD0]] to %[[COOR1]] : !fir.ref<i32>
// CHECK: }
// Free temporary array.
// CHECK: fir.freemem %[[TEMP]] : <!fir.array<10xi32>>
// CHECK: fir.freemem %[[TEMP]] : !fir.heap<!fir.array<10xi32>>
// -----
@ -211,7 +211,7 @@ func @conversion_with_temporary_multidim(%0: !fir.ref<!fir.array<10x5xi32>>) {
// CHECK: %[[COOR1:.*]] = fir.array_coor %[[ARR0]](%{{.*}}) %{{.*}}, %{{.*}} : (!fir.ref<!fir.array<10x5xi32>>, !fir.shape<2>, index, index) -> !fir.ref<i32>
// CHECK: %[[LOAD0:.*]] = fir.load %[[COOR0]] : !fir.ref<i32>
// CHECK: fir.store %[[LOAD0]] to %[[COOR1]] : !fir.ref<i32>
// CHECK: fir.freemem %[[TEMP]] : <!fir.array<10x5xi32>>
// CHECK: fir.freemem %[[TEMP]] : !fir.heap<!fir.array<10x5xi32>>
// -----
@ -309,7 +309,7 @@ func private @user_defined_assignment(!fir.ref<f32>, !fir.ref<f32>)
// CHECK: fir.store %[[LOAD0]] to %[[COOR1]] : !fir.ref<f32>
// CHECK: }
// Free the temporary array.
// CHECK: fir.freemem %[[TEMP]] : <!fir.array<100xf32>>
// CHECK: fir.freemem %[[TEMP]] : !fir.heap<!fir.array<100xf32>>
// CHECK: return
// CHECK: }
@ -425,7 +425,7 @@ func @conversion_with_temporary_boxed_array(%arr0 : !fir.box<!fir.array<10xi32>>
// CHECK: fir.store %[[LOAD0]] to %[[COOR1]] : !fir.ref<i32>
// CHECK: }
// Free temporary array.
// CHECK: fir.freemem %[[TEMP]] : <!fir.array<10xi32>>
// CHECK: fir.freemem %[[TEMP]] : !fir.heap<!fir.array<10xi32>>
// -----

View File

@ -128,7 +128,7 @@ func @instructions() {
%31 = fir.no_reassoc %29 : i64
// CHECK: fir.call @user_i64([[VAL_35]]) : (i64) -> ()
// CHECK: fir.freemem [[VAL_5]] : <!fir.array<100xf32>>
// CHECK: fir.freemem [[VAL_5]] : !fir.heap<!fir.array<100xf32>>
// CHECK: [[VAL_36:%.*]] = fir.call @get_func() : () -> (() -> ())
// CHECK: fir.call [[VAL_36]]() : () -> ()
// CHECK: [[VAL_37:%.*]] = fir.address_of(@it1) : !fir.ref<() -> !fir.int<4>>

View File

@ -32,7 +32,7 @@
! CHECK: fir.result
! CHECK: }
! CHECK: fir.array_merge_store %[[Z_BOX]], %[[Z_COPY_FROM_RESULT]] to %[[Z]] : !fir.array<2x2xf32>, !fir.array<2x2xf32>, !fir.ref<!fir.array<2x2xf32>>
! CHECK: fir.freemem %[[RESULT_TMP]] : <!fir.array<?x?xf32>>
! CHECK: fir.freemem %[[RESULT_TMP]] : !fir.heap<!fir.array<?x?xf32>>
subroutine matmul_test(x,y,z)
real :: x(3,1), y(1,3), z(2,2)
z = matmul(x,y)
@ -59,7 +59,7 @@ end subroutine
!CHECK: fir.result
!CHECK: }
!CHECK: fir.array_merge_store %[[Z]], %[[Z_COPY_FROM_RESULT]] to %[[Z_BOX]] : !fir.array<?x!fir.logical<4>>, !fir.array<?x!fir.logical<4>>, !fir.box<!fir.array<?x!fir.logical<4>>>
!CHECK: fir.freemem %[[RESULT_TMP]] : <!fir.array<?x!fir.logical<4>>>
!CHECK: fir.freemem %[[RESULT_TMP]] : !fir.heap<!fir.array<?x!fir.logical<4>>>
subroutine matmul_test2(X, Y, Z)
logical :: X(:,:)
logical :: Y(:)

View File

@ -18,7 +18,7 @@ subroutine repeat_test(c, n)
! CHECK-DAG: fir.box_elesize
! CHECK: fir.call @{{.*}}bar_repeat_test
call bar_repeat_test(repeat(c,n))
! CHECK: fir.freemem %[[tmpAddr]] : <!fir.char<1,?>>
! CHECK: fir.freemem %[[tmpAddr]] : !fir.heap<!fir.char<1,?>>
return
end subroutine

View File

@ -19,6 +19,6 @@ subroutine transpose_test(mat)
! CHECK: %[[tmp2:.*]] = fir.box_addr %[[tmp1]] : (!fir.box<!fir.heap<!fir.array<?x?xf32>>>) -> !fir.heap<!fir.array<?x?xf32>>
! CHECK: %[[tmp3:.*]] = fir.convert %[[tmp2]] : (!fir.heap<!fir.array<?x?xf32>>) -> !fir.ref<!fir.array<3x2xf32>>
! CHECK: fir.call @_QPbar_transpose_test(%[[tmp3]]) : (!fir.ref<!fir.array<3x2xf32>>) -> ()
! CHECK: fir.freemem %[[tmp2]] : <!fir.array<?x?xf32>
! CHECK: fir.freemem %[[tmp2]] : !fir.heap<!fir.array<?x?xf32>
end subroutine

View File

@ -15,7 +15,7 @@ subroutine trim_test(c)
! CHECK-DAG: fir.box_elesize
! CHECK: fir.call @{{.*}}bar_trim_test
call bar_trim_test(trim(c))
! CHECK: fir.freemem %[[tmpAddr]] : <!fir.char<1,?>>
! CHECK: fir.freemem %[[tmpAddr]] : !fir.heap<!fir.char<1,?>>
return
end subroutine