Skip to content

[Flang][OpenMP][Lower] Clause lowering cleanup #103058

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 2 commits into from
Aug 14, 2024
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
22 changes: 0 additions & 22 deletions flang/lib/Lower/OpenMP/ClauseProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,28 +256,6 @@ bool ClauseProcessor::processCollapse(
return found;
}

bool ClauseProcessor::processDefault() const {
if (auto *clause = findUniqueClause<omp::clause::Default>()) {
// Private, Firstprivate, Shared, None
switch (clause->v) {
case omp::clause::Default::DataSharingAttribute::Shared:
case omp::clause::Default::DataSharingAttribute::None:
// Default clause with shared or none do not require any handling since
// Shared is the default behavior in the IR and None is only required
// for semantic checks.
break;
case omp::clause::Default::DataSharingAttribute::Private:
// TODO Support default(private)
break;
case omp::clause::Default::DataSharingAttribute::Firstprivate:
// TODO Support default(firstprivate)
break;
}
return true;
}
return false;
}

bool ClauseProcessor::processDevice(lower::StatementContext &stmtCtx,
mlir::omp::DeviceClauseOps &result) const {
const parser::CharBlock *source = nullptr;
Expand Down
1 change: 0 additions & 1 deletion flang/lib/Lower/OpenMP/ClauseProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class ClauseProcessor {
processCollapse(mlir::Location currentLocation, lower::pft::Evaluation &eval,
mlir::omp::LoopRelatedOps &result,
llvm::SmallVectorImpl<const semantics::Symbol *> &iv) const;
bool processDefault() const;
bool processDevice(lower::StatementContext &stmtCtx,
mlir::omp::DeviceClauseOps &result) const;
bool processDeviceType(mlir::omp::DeviceTypeClauseOps &result) const;
Expand Down
21 changes: 10 additions & 11 deletions flang/lib/Lower/OpenMP/OpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1055,8 +1055,9 @@ static void genFlushClauses(lower::AbstractConverter &converter,
if (!objects.empty())
genObjectList(objects, converter, operandRange);

if (!clauses.empty())
TODO(converter.getCurrentLocation(), "Handle OmpMemoryOrderClause");
ClauseProcessor cp(converter, semaCtx, clauses);
cp.processTODO<clause::AcqRel, clause::Acquire, clause::Release,
clause::SeqCst>(loc, llvm::omp::OMPD_flush);
}

static void
Expand Down Expand Up @@ -1096,7 +1097,6 @@ static void genParallelClauses(
llvm::SmallVectorImpl<const semantics::Symbol *> &reductionSyms) {
ClauseProcessor cp(converter, semaCtx, clauses);
cp.processAllocate(clauseOps);
cp.processDefault();
cp.processIf(llvm::omp::Directive::OMPD_parallel, clauseOps);
cp.processNumThreads(stmtCtx, clauseOps);
cp.processProcBind(clauseOps);
Expand Down Expand Up @@ -1129,7 +1129,7 @@ static void genSimdClauses(lower::AbstractConverter &converter,
cp.processSimdlen(clauseOps);

// TODO Support delayed privatization.
cp.processTODO<clause::Allocate, clause::Linear, clause::Nontemporal>(
cp.processTODO<clause::Linear, clause::Nontemporal>(
loc, llvm::omp::Directive::OMPD_simd);
}

Expand Down Expand Up @@ -1167,15 +1167,15 @@ static void genTargetClauses(
cp.processIsDevicePtr(clauseOps, devicePtrTypes, devicePtrLocs,
devicePtrSyms);
cp.processMap(loc, stmtCtx, clauseOps, &mapSyms, &mapLocs, &mapTypes);
cp.processThreadLimit(stmtCtx, clauseOps);

if (processHostOnlyClauses)
cp.processNowait(clauseOps);

cp.processThreadLimit(stmtCtx, clauseOps);

cp.processTODO<clause::Allocate, clause::Defaultmap, clause::Firstprivate,
clause::InReduction, clause::Reduction,
clause::UsesAllocators>(loc,
llvm::omp::Directive::OMPD_target);
clause::InReduction, clause::UsesAllocators>(
loc, llvm::omp::Directive::OMPD_target);

// `target private(..)` is only supported in delayed privatization mode.
if (!enableDelayedPrivatizationStaging)
Expand Down Expand Up @@ -1223,14 +1223,15 @@ static void genTargetEnterExitUpdateDataClauses(
cp.processDepend(clauseOps);
cp.processDevice(stmtCtx, clauseOps);
cp.processIf(directive, clauseOps);
cp.processNowait(clauseOps);

if (directive == llvm::omp::Directive::OMPD_target_update) {
cp.processMotionClauses<clause::To>(stmtCtx, clauseOps);
cp.processMotionClauses<clause::From>(stmtCtx, clauseOps);
} else {
cp.processMap(loc, stmtCtx, clauseOps);
}

cp.processNowait(clauseOps);
}

static void genTaskClauses(lower::AbstractConverter &converter,
Expand All @@ -1240,7 +1241,6 @@ static void genTaskClauses(lower::AbstractConverter &converter,
mlir::omp::TaskOperands &clauseOps) {
ClauseProcessor cp(converter, semaCtx, clauses);
cp.processAllocate(clauseOps);
cp.processDefault();
cp.processDepend(clauseOps);
cp.processFinal(stmtCtx, clauseOps);
cp.processIf(llvm::omp::Directive::OMPD_task, clauseOps);
Expand Down Expand Up @@ -1279,7 +1279,6 @@ static void genTeamsClauses(lower::AbstractConverter &converter,
mlir::omp::TeamsOperands &clauseOps) {
ClauseProcessor cp(converter, semaCtx, clauses);
cp.processAllocate(clauseOps);
cp.processDefault();
cp.processIf(llvm::omp::Directive::OMPD_teams, clauseOps);
cp.processNumTeams(stmtCtx, clauseOps);
cp.processThreadLimit(stmtCtx, clauseOps);
Expand Down
Loading