[flang-commits] [flang] c54bb3d - [flang][openacc] Set exit op for device_resident to acc.delete
Valentin Clement via flang-commits
flang-commits at lists.llvm.org
Thu Aug 10 11:02:34 PDT 2023
Author: Valentin Clement
Date: 2023-08-10T10:56:09-07:00
New Revision: c54bb3d2399364c1333f90e6317c03cb3767812f
URL: https://github.com/llvm/llvm-project/commit/c54bb3d2399364c1333f90e6317c03cb3767812f
DIFF: https://github.com/llvm/llvm-project/commit/c54bb3d2399364c1333f90e6317c03cb3767812f.diff
LOG: [flang][openacc] Set exit op for device_resident to acc.delete
The exit operation for the declare device_resident in function/subroutine
is set to delete. Make is consistent and set it also for global declare.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D157537
Added:
Modified:
flang/lib/Lower/OpenACC.cpp
flang/test/Lower/OpenACC/acc-declare.f90
Removed:
################################################################################
diff --git a/flang/lib/Lower/OpenACC.cpp b/flang/lib/Lower/OpenACC.cpp
index 97691232192b31..073cb9bc46a97b 100644
--- a/flang/lib/Lower/OpenACC.cpp
+++ b/flang/lib/Lower/OpenACC.cpp
@@ -2685,8 +2685,7 @@ genDeclareInModule(Fortran::lower::AbstractConverter &converter,
} else if (const auto *deviceResidentClause =
std::get_if<Fortran::parser::AccClause::DeviceResident>(
&clause.u)) {
- genGlobalCtors<mlir::acc::DeclareDeviceResidentOp,
- mlir::acc::DeclareDeviceResidentOp>(
+ genGlobalCtors<mlir::acc::DeclareDeviceResidentOp, mlir::acc::DeleteOp>(
converter, modBuilder, deviceResidentClause->v,
mlir::acc::DataClause::acc_declare_device_resident);
} else if (const auto *linkClause =
diff --git a/flang/test/Lower/OpenACC/acc-declare.f90 b/flang/test/Lower/OpenACC/acc-declare.f90
index b253294ab33cf0..d3b9efe438b1a2 100644
--- a/flang/test/Lower/OpenACC/acc-declare.f90
+++ b/flang/test/Lower/OpenACC/acc-declare.f90
@@ -54,6 +54,14 @@ module acc_declare_device_resident_test
! CHECK: acc.terminator
! CHECK: }
+! CHECK-LABEL: acc.global_dtor @_QMacc_declare_device_resident_testEdata1_acc_dtor {
+! CHECK: %[[GLOBAL_ADDR:.*]] = fir.address_of(@_QMacc_declare_device_resident_testEdata1) {acc.declare = #acc.declare<dataClause = acc_declare_device_resident>} : !fir.ref<!fir.array<5000xi32>>
+! CHECK: %[[DEVPTR:.*]] = acc.getdeviceptr varPtr(%[[GLOBAL_ADDR]] : !fir.ref<!fir.array<5000xi32>>) -> !fir.ref<!fir.array<5000xi32>> {dataClause = #acc<data_clause acc_declare_device_resident>, name = "data1", structured = false}
+! CHECK: acc.declare_exit dataOperands(%[[DEVICEPTR]] : !fir.ref<!fir.array<5000xi32>>)
+! CHECK: acc.delete accPtr(%[[DEVICEPTR]] : !fir.ref<!fir.array<5000xi32>>) {dataClause = #acc<data_clause acc_declare_device_resident>, name = "data1", structured = false}
+! CHECK: acc.terminator
+! CHECK: }
+
module acc_declare_device_link_test
integer, parameter :: n = 5000
integer, dimension(n) :: data1
More information about the flang-commits
mailing list