[all-commits] [llvm/llvm-project] c676c7: [flang][OpenMP] Lower DO and SIMD variants in meta...
Chi-Chun, Chen via All-commits
all-commits at lists.llvm.org
Mon Aug 3 14:54:18 PDT 2026
Branch: refs/heads/users/cchen/flang-metadirective-loop-core
Home: https://github.com/llvm/llvm-project
Commit: c676c7b386d27f0d9a54799f050fc6a74f1b4166
https://github.com/llvm/llvm-project/commit/c676c7b386d27f0d9a54799f050fc6a74f1b4166
Author: Chi-Chun, Chen <chichun.chen at hpe.com>
Date: 2026-08-03 (Mon, 03 Aug 2026)
Changed paths:
M flang/include/flang/Lower/PFTBuilder.h
M flang/include/flang/Semantics/openmp-utils.h
M flang/lib/Lower/Bridge.cpp
M flang/lib/Lower/OpenMP/DataSharingProcessor.cpp
M flang/lib/Lower/OpenMP/OpenMP.cpp
M flang/lib/Lower/OpenMP/Utils.cpp
M flang/lib/Lower/OpenMP/Utils.h
M flang/lib/Semantics/openmp-utils.cpp
A flang/test/Lower/OpenMP/Todo/metadirective-block-data-environment.f90
A flang/test/Lower/OpenMP/Todo/metadirective-block-eager-default-private.f90
A flang/test/Lower/OpenMP/Todo/metadirective-block-eager-privatization.f90
A flang/test/Lower/OpenMP/Todo/metadirective-block-host-association-clause.f90
A flang/test/Lower/OpenMP/Todo/metadirective-loop-associate-iv.f90
A flang/test/Lower/OpenMP/Todo/metadirective-loop-body-variant.f90
A flang/test/Lower/OpenMP/Todo/metadirective-loop-data-environment.f90
A flang/test/Lower/OpenMP/Todo/metadirective-loop-data-sharing-clause.f90
A flang/test/Lower/OpenMP/Todo/metadirective-loop-eager-privatization.f90
A flang/test/Lower/OpenMP/Todo/metadirective-loop-enclosing-data-environment.f90
A flang/test/Lower/OpenMP/Todo/metadirective-loop-pointer-allocatable-iv.f90
A flang/test/Lower/OpenMP/Todo/metadirective-loop-unstructured.f90
A flang/test/Lower/OpenMP/Todo/metadirective-loop-unsupported-directive.f90
R flang/test/Lower/OpenMP/Todo/metadirective-loop.f90
A flang/test/Lower/OpenMP/Todo/metadirective-target-loop.f90
A flang/test/Lower/OpenMP/metadirective-block-eager-shared.f90
M flang/test/Lower/OpenMP/metadirective-device-arch.f90
M flang/test/Lower/OpenMP/metadirective-implementation.f90
A flang/test/Lower/OpenMP/metadirective-loop.f90
M flang/test/Lower/OpenMP/metadirective-user.f90
Log Message:
-----------
[flang][OpenMP] Lower DO and SIMD variants in metadirectives
A standalone metadirective and its associated DO are sibling PFT evaluations,
so a selected loop replacement cannot directly reuse ordinary OpenMP loop
lowering. Runtime selection must also preserve exactly one copy of the loop in
each reachable branch. Temporarily associate the evaluations while lowering
to support DO, SIMD, and DO SIMD replacements without losing or duplicating the
ordinary fallback loop.
For example:
```fortran
!$omp metadirective &
!$omp& when(user={condition(flag)}: do) &
!$omp& otherwise(nothing)
do i = 1, n
a(i) = i
end do
```
is represented as sibling evaluations:
```text
METADIRECTIVE
DO
`-- a(i) = i
```
and runtime selection lowers conceptually as:
```text
if (flag)
omp.wsloop
omp.loop_nest
else
fir.do_loop
```
Build the statically applicable candidate set before lowering and use shared
selection utilities to preserve OpenMP ranking. Keep runtime guards separate
from static applicability, retain candidates reachable through a failed
condition, and apply loop-specific restrictions only after the reachable
replacements are known.
This change:
- Lowers DO, SIMD, and DO SIMD replacements through the existing loop-lowering
path for standalone and begin/end metadirectives.
- Supports static selection and runtime user conditions while preserving a
Fortran loop for NOTHING and other non-consuming replacements.
- Preserves compiler loop directives, statements following the associated
loop, and evaluation ownership across alternate ENTRY lowering.
- Applies COLLAPSE and ORDERED to the required depth without leaking temporary
loop-index attributes between replacement arms.
- Emits focused diagnostics when a reachable replacement requires unsupported
data-environment, host-association, capture, or eager-privatization handling.
Initial loop support remains limited to DO, SIMD, and DO SIMD. Diagnose
combined data-environment loops such as PARALLEL DO, explicit data-sharing and
DEFAULT clauses, loops nested in an existing OpenMP data environment, TARGET
and mixed block/loop replacements, non-canonical or unstructured loops,
insufficient COLLAPSE or ORDERED depth, and unsupported loop-index entities.
Add lowering coverage for candidate ranking, runtime fallback paths, DO and
SIMD composition, affected-loop depth, compiler directives, ENTRY handling,
and the unsupported boundaries above.
Assisted with codex.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list