[flang-commits] [flang] 939bdae - [flang][openacc] Attach attribute only when there is an exit operation
Valentin Clement via flang-commits
flang-commits at lists.llvm.org
Wed Aug 16 13:10:48 PDT 2023
Author: Valentin Clement
Date: 2023-08-16T13:10:43-07:00
New Revision: 939bdaec18c9f22ac52809fea5a1ab0301a90f02
URL: https://github.com/llvm/llvm-project/commit/939bdaec18c9f22ac52809fea5a1ab0301a90f02
DIFF: https://github.com/llvm/llvm-project/commit/939bdaec18c9f22ac52809fea5a1ab0301a90f02.diff
LOG: [flang][openacc] Attach attribute only when there is an exit operation
Not all declare clause have an exit operation attach to them and
therefore no dealloc function generated. Attach
the pre/post deallocation attribute only for the clauses that have
an exit operation.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D158106
Added:
Modified:
flang/lib/Lower/OpenACC.cpp
Removed:
################################################################################
diff --git a/flang/lib/Lower/OpenACC.cpp b/flang/lib/Lower/OpenACC.cpp
index d2c42cf2b76621..d2db10c0d0cb5c 100644
--- a/flang/lib/Lower/OpenACC.cpp
+++ b/flang/lib/Lower/OpenACC.cpp
@@ -3048,6 +3048,14 @@ void Fortran::lower::attachDeclarePostAllocAction(
void Fortran::lower::attachDeclarePreDeallocAction(
AbstractConverter &converter, fir::FirOpBuilder &builder,
mlir::Value beginOpValue, const Fortran::semantics::Symbol &sym) {
+ if (!sym.test(Fortran::semantics::Symbol::Flag::AccCreate) &&
+ !sym.test(Fortran::semantics::Symbol::Flag::AccCopyIn) &&
+ !sym.test(Fortran::semantics::Symbol::Flag::AccCopyInReadOnly) &&
+ !sym.test(Fortran::semantics::Symbol::Flag::AccCopy) &&
+ !sym.test(Fortran::semantics::Symbol::Flag::AccCopyOut) &&
+ !sym.test(Fortran::semantics::Symbol::Flag::AccDeviceResident))
+ return;
+
std::stringstream fctName;
fctName << converter.mangleName(sym) << declarePreDeallocSuffix.str();
beginOpValue.getDefiningOp()->setAttr(
@@ -3062,6 +3070,14 @@ void Fortran::lower::attachDeclarePreDeallocAction(
void Fortran::lower::attachDeclarePostDeallocAction(
AbstractConverter &converter, fir::FirOpBuilder &builder,
const Fortran::semantics::Symbol &sym) {
+ if (!sym.test(Fortran::semantics::Symbol::Flag::AccCreate) &&
+ !sym.test(Fortran::semantics::Symbol::Flag::AccCopyIn) &&
+ !sym.test(Fortran::semantics::Symbol::Flag::AccCopyInReadOnly) &&
+ !sym.test(Fortran::semantics::Symbol::Flag::AccCopy) &&
+ !sym.test(Fortran::semantics::Symbol::Flag::AccCopyOut) &&
+ !sym.test(Fortran::semantics::Symbol::Flag::AccDeviceResident))
+ return;
+
std::stringstream fctName;
fctName << converter.mangleName(sym) << declarePostDeallocSuffix.str();
mlir::Operation &op = builder.getInsertionBlock()->back();
More information about the flang-commits
mailing list