Skip to content

[flang][openacc] Allow finalize clause on exit data more than once #135415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions flang/test/Lower/OpenACC/acc-exit-data.f90
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,9 @@ subroutine acc_exit_data
!CHECK: acc.exit_data wait_devnum(%[[WAIT6]] : i32) wait(%[[WAIT4]], %[[WAIT5]] : i32, i32) dataOperands(%[[DEVPTR]] : !fir.ref<!fir.array<10x10xf32>>)
!CHECK: acc.delete accPtr(%[[DEVPTR]] : !fir.ref<!fir.array<10x10xf32>>) {name = "a", structured = false}

!$acc exit data delete(a) finalize
!CHECK: acc.exit_data dataOperands(%{{.*}} : !fir.ref<!fir.array<10x10xf32>>) attributes {finalize}

!$acc exit data delete(a) finalize finalize
!CHECK: acc.exit_data dataOperands(%{{.*}} : !fir.ref<!fir.array<10x10xf32>>) attributes {finalize}
end subroutine acc_exit_data
2 changes: 1 addition & 1 deletion flang/test/Semantics/OpenACC/acc-data.f90
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ program openacc_data_validity

!$acc exit data delete(aa) finalize

!ERROR: At most one FINALIZE clause can appear on the EXIT DATA directive
! OK
!$acc exit data delete(aa) finalize finalize

!ERROR: Argument `cc` on the DETACH clause must be a variable or array with the POINTER or ALLOCATABLE attribute
Expand Down
12 changes: 4 additions & 8 deletions llvm/include/llvm/Frontend/OpenACC/ACC.td
Original file line number Diff line number Diff line change
Expand Up @@ -535,14 +535,10 @@ def ACC_EnterData : Directive<"enter data"> {

// 2.14.7
def ACC_ExitData : Directive<"exit data"> {
let allowedClauses = [
VersionedClause<ACCC_Wait>
];
let allowedOnceClauses = [
VersionedClause<ACCC_Async>,
VersionedClause<ACCC_If>,
VersionedClause<ACCC_Finalize>
];
let allowedClauses = [VersionedClause<ACCC_Finalize>,
VersionedClause<ACCC_Wait>];
let allowedOnceClauses = [VersionedClause<ACCC_Async>,
VersionedClause<ACCC_If>];
let requiredClauses = [
VersionedClause<ACCC_Copyout>,
VersionedClause<ACCC_Delete>,
Expand Down