Skip to content

Commit 4954246

Browse files
committed
Fixed dsa of variables in task construct in the presence of in_reduction clause
1 parent 258259a commit 4954246

File tree

4 files changed

+24
-25
lines changed

4 files changed

+24
-25
lines changed

flang/include/flang/Semantics/symbol.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -754,12 +754,12 @@ class Symbol {
754754
// OpenMP data-copying attribute
755755
OmpCopyIn, OmpCopyPrivate,
756756
// OpenMP miscellaneous flags
757-
OmpCommonBlock, OmpReduction, OmpAligned, OmpNontemporal, OmpAllocate,
758-
OmpDeclarativeAllocateDirective, OmpExecutableAllocateDirective,
759-
OmpDeclareSimd, OmpDeclareTarget, OmpThreadprivate, OmpDeclareReduction,
760-
OmpFlushed, OmpCriticalLock, OmpIfSpecified, OmpNone, OmpPreDetermined,
761-
OmpImplicit, OmpDependObject, OmpInclusiveScan, OmpExclusiveScan,
762-
OmpInScanReduction);
757+
OmpCommonBlock, OmpReduction, OmpInReduction, OmpAligned, OmpNontemporal,
758+
OmpAllocate, OmpDeclarativeAllocateDirective,
759+
OmpExecutableAllocateDirective, OmpDeclareSimd, OmpDeclareTarget,
760+
OmpThreadprivate, OmpDeclareReduction, OmpFlushed, OmpCriticalLock,
761+
OmpIfSpecified, OmpNone, OmpPreDetermined, OmpImplicit, OmpDependObject,
762+
OmpInclusiveScan, OmpExclusiveScan, OmpInScanReduction);
763763
using Flags = common::EnumSet<Flag, Flag_enumSize>;
764764

765765
const Scope &owner() const { return *owner_; }

flang/lib/Lower/OpenMP/ClauseProcessor.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -976,18 +976,6 @@ bool ClauseProcessor::processIf(
976976
});
977977
return found;
978978
}
979-
980-
bool ClauseProcessor::processIsDevicePtr(
981-
mlir::omp::IsDevicePtrClauseOps &result,
982-
llvm::SmallVectorImpl<const semantics::Symbol *> &isDeviceSyms) const {
983-
return findRepeatableClause<omp::clause::IsDevicePtr>(
984-
[&](const omp::clause::IsDevicePtr &devPtrClause,
985-
const parser::CharBlock &) {
986-
addUseDeviceClause(converter, devPtrClause.v, result.isDevicePtrVars,
987-
isDeviceSyms);
988-
});
989-
}
990-
991979
bool ClauseProcessor::processInReduction(
992980
mlir::Location currentLocation, mlir::omp::InReductionClauseOps &result,
993981
llvm::SmallVectorImpl<const semantics::Symbol *> &outReductionSyms) const {
@@ -1012,6 +1000,17 @@ bool ClauseProcessor::processInReduction(
10121000
});
10131001
}
10141002

1003+
bool ClauseProcessor::processIsDevicePtr(
1004+
mlir::omp::IsDevicePtrClauseOps &result,
1005+
llvm::SmallVectorImpl<const semantics::Symbol *> &isDeviceSyms) const {
1006+
return findRepeatableClause<omp::clause::IsDevicePtr>(
1007+
[&](const omp::clause::IsDevicePtr &devPtrClause,
1008+
const parser::CharBlock &) {
1009+
addUseDeviceClause(converter, devPtrClause.v, result.isDevicePtrVars,
1010+
isDeviceSyms);
1011+
});
1012+
}
1013+
10151014
bool ClauseProcessor::processLink(
10161015
llvm::SmallVectorImpl<DeclareTargetCapturePair> &result) const {
10171016
return findRepeatableClause<omp::clause::Link>(

flang/lib/Lower/OpenMP/DataSharingProcessor.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -410,13 +410,7 @@ void DataSharingProcessor::collectSymbols(
410410
// that matches 'flag'.
411411
llvm::SetVector<const semantics::Symbol *> allSymbols;
412412

413-
auto itr = llvm::find_if(clauses, [](const omp::Clause &clause) {
414-
return clause.id == llvm::omp::Clause::OMPC_in_reduction;
415-
});
416-
417-
bool collectSymbols = (itr == clauses.end());
418-
419-
converter.collectSymbolSet(eval, allSymbols, flag, collectSymbols,
413+
converter.collectSymbolSet(eval, allSymbols, flag, /*collectSymbols=*/true,
420414
/*collectHostAssociatedSymbols=*/true);
421415

422416
llvm::SetVector<const semantics::Symbol *> symbolsInNestedRegions;

flang/lib/Semantics/resolve-directives.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,12 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
530530
return false;
531531
}
532532

533+
bool Pre(const parser::OmpInReductionClause &x) {
534+
auto &objects{std::get<parser::OmpObjectList>(x.t)};
535+
ResolveOmpObjectList(objects, Symbol::Flag::OmpInReduction);
536+
return false;
537+
}
538+
533539
bool Pre(const parser::OmpClause::Reduction &x) {
534540
const auto &objList{std::get<parser::OmpObjectList>(x.v.t)};
535541
ResolveOmpObjectList(objList, Symbol::Flag::OmpReduction);

0 commit comments

Comments
 (0)