Skip to content

Commit 52f9e74

Browse files
committed
Address review comments
1 parent f41c39e commit 52f9e74

File tree

4 files changed

+24
-7
lines changed

4 files changed

+24
-7
lines changed

flang/lib/Lower/OpenMP/ClauseProcessor.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,15 +395,14 @@ bool ClauseProcessor::processNumThreads(
395395
}
396396

397397
bool ClauseProcessor::processOrder(mlir::omp::OrderClauseOps &result) const {
398-
if (auto *clause = findUniqueClause<omp::clause::Order>()) {
398+
using Order = omp::clause::Order;
399+
if (auto *clause = findUniqueClause<Order>()) {
399400
fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder();
400401
result.orderAttr = mlir::omp::ClauseOrderKindAttr::get(
401402
firOpBuilder.getContext(), mlir::omp::ClauseOrderKind::Concurrent);
402-
using Order = omp::clause::Order;
403403
const auto &modifier =
404404
std::get<std::optional<Order::OrderModifier>>(clause->t);
405-
if (modifier &&
406-
*modifier == omp::clause::Order::OrderModifier::Unconstrained) {
405+
if (modifier && *modifier == Order::OrderModifier::Unconstrained) {
407406
result.orderModAttr = mlir::omp::OrderModifierAttr::get(
408407
firOpBuilder.getContext(), mlir::omp::OrderModifier::unconstrained);
409408
} else {

flang/lib/Lower/OpenMP/OpenMP.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,6 +1037,7 @@ static void genDistributeClauses(lower::AbstractConverter &converter,
10371037
ClauseProcessor cp(converter, semaCtx, clauses);
10381038
cp.processAllocate(clauseOps);
10391039
cp.processDistSchedule(stmtCtx, clauseOps);
1040+
cp.processOrder(clauseOps);
10401041
// TODO Support delayed privatization.
10411042
}
10421043

flang/test/Lower/OpenMP/order-clause.f90

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,23 @@ end subroutine do_simd_order
5454
subroutine do_simd_order_parallel
5555
!CHECK: omp.parallel {
5656
!CHECK: omp.wsloop order(reproducible:concurrent) {
57-
!$omp parallel
58-
!$omp do simd order(reproducible:concurrent)
57+
!$omp parallel do simd order(reproducible:concurrent)
5958
do i = 1, 10
6059
end do
61-
!$omp end parallel
6260
end subroutine do_simd_order_parallel
61+
62+
63+
subroutine distribute_order
64+
!CHECK: omp.distribute order(reproducible:concurrent) {
65+
!$omp teams distribute order(concurrent)
66+
do i=1,10
67+
end do
68+
!CHECK: omp.distribute order(reproducible:concurrent) {
69+
!$omp teams distribute order(reproducible:concurrent)
70+
do i=1,10
71+
end do
72+
!CHECK: omp.distribute order(unconstrained:concurrent) {
73+
!$omp teams distribute order(unconstrained:concurrent)
74+
do i = 1, 10
75+
end do
76+
end subroutine

llvm/include/llvm/Frontend/OpenMP/OMP.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,7 @@ def OMP_Distribute : Directive<"distribute"> {
665665
let allowedOnceClauses = [
666666
VersionedClause<OMPC_Collapse>,
667667
VersionedClause<OMPC_DistSchedule>,
668+
VersionedClause<OMPC_Order, 50>,
668669
];
669670
let association = AS_Loop;
670671
let category = CA_Executable;
@@ -2057,6 +2058,7 @@ def OMP_TargetTeamsDistribute : Directive<"target teams distribute"> {
20572058
VersionedClause<OMPC_NoWait>,
20582059
VersionedClause<OMPC_NumTeams>,
20592060
VersionedClause<OMPC_OMPX_DynCGroupMem>,
2061+
VersionedClause<OMPC_Order, 50>,
20602062
VersionedClause<OMPC_ThreadLimit>,
20612063
];
20622064
let leafConstructs = [OMP_Target, OMP_Teams, OMP_Distribute];
@@ -2330,6 +2332,7 @@ def OMP_TeamsDistribute : Directive<"teams distribute"> {
23302332
];
23312333
let allowedOnceClauses = [
23322334
VersionedClause<OMPC_If>,
2335+
VersionedClause<OMPC_Order, 50>,
23332336
];
23342337
let leafConstructs = [OMP_Teams, OMP_Distribute];
23352338
let category = CA_Executable;

0 commit comments

Comments
 (0)