[flang-commits] [flang] [flang][openacc] Place post allocate/deallocate attribute correctly (PR #79883)
Valentin Clement バレンタイン クレメン via flang-commits
flang-commits at lists.llvm.org
Mon Jan 29 14:46:55 PST 2024
================
@@ -318,6 +318,18 @@ subroutine acc_declare_array_section(a)
! CHECK: acc.copyout accPtr(%[[COPYIN]] : !fir.ref<!fir.array<?xi32>>) bounds(%{{.*}}) to varPtr(%[[BOX_ADDR]] : !fir.ref<!fir.array<?xi32>>) {dataClause = #acc<data_clause acc_copy>, name = "a(1:10)"}
+ subroutine acc_declare_allocate_with_stat()
+ integer :: status
+ real, pointer, dimension(:) :: localptr
+ !$acc declare create(localptr)
+ allocate(localptr(n), stat=status)
+
+ deallocate(localptr, stat=status)
+ end subroutine
+
+! CHECK-LABEL: func.func @_QMacc_declarePacc_declare_allocate_with_stat()
+! CHECK: fir.call @_FortranAPointerAllocate(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) {{.*}} {acc.declare_action = #acc.declare_action<postAlloc = @_QMacc_declareFacc_declare_allocate_with_statElocalptr_acc_declare_update_desc_post_alloc>}
+! CHECK: fir.call @_FortranAPointerDeallocate(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) {{.*}} {acc.declare_action = #acc.declare_action<preDealloc = @_QMacc_declareFacc_declare_allocate_with_statElocalptr_acc_declare_update_desc_pre_dealloc>}
----------------
clementval wrote:
It was indeed good to check because it was actually overwritten by the preDeallocAction.
https://github.com/llvm/llvm-project/pull/79883
More information about the flang-commits
mailing list