[all-commits] [llvm/llvm-project] 375932: [Flang][OpenMP] Support iterator modifiers in map ...

Chi-Chun, Chen via All-commits all-commits at lists.llvm.org
Tue Aug 4 14:48:45 PDT 2026


  Branch: refs/heads/users/cchen/flang_openmp_motion_map_iterator
  Home:   https://github.com/llvm/llvm-project
  Commit: 37593219816525757a8b1367459324b62b9ca941
      https://github.com/llvm/llvm-project/commit/37593219816525757a8b1367459324b62b9ca941
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-08-04 (Tue, 04 Aug 2026)

  Changed paths:
    M flang/lib/Lower/OpenMP/ClauseProcessor.cpp
    M flang/lib/Lower/OpenMP/Utils.cpp
    M flang/lib/Lower/OpenMP/Utils.h
    M flang/lib/Optimizer/OpenMP/MapInfoFinalization.cpp
    R flang/test/Lower/OpenMP/Todo/declare-mapper-iterator.f90
    R flang/test/Lower/OpenMP/Todo/from-iterator-modifier.f90
    R flang/test/Lower/OpenMP/Todo/to-iterator-modifier.f90
    A flang/test/Lower/OpenMP/declare-mapper-iterator.f90
    A flang/test/Lower/OpenMP/motion-iterator.f90

  Log Message:
  -----------
  [Flang][OpenMP] Support iterator modifiers in map and motion clauses

Support iterated array elements and array sections in map and motion clauses for
target data, target enter data, target exit data, and target update constructs.

Preserve mapper resolution for iterated entries, including explicit mappers,
user-defined default mappers, declare mapper entries, and implicit default
mappers.

This PR stacked on top of #197047 and #197752.

This patch is part of the feature work for #188061.

Assisted with copilot.


  Commit: 28cfff2f1a4a99713e249438961a07791d08d3ff
      https://github.com/llvm/llvm-project/commit/28cfff2f1a4a99713e249438961a07791d08d3ff
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-08-04 (Tue, 04 Aug 2026)

  Changed paths:
    M flang/lib/Optimizer/OpenMP/MapInfoFinalization.cpp
    M flang/test/Transforms/omp-map-info-finalization.fir

  Log Message:
  -----------
  Resolve feedback about MapInfoFinalization

Keep MapInfoFinalization from expanding `omp.map.info` operations nested
in omp.iterator regions. Those maps are yielded through the iterator
result, so rewriting them as outer target operands can violate SSA
dominance.


  Commit: cdd4c6c47130b69d1206fb850866bd95c7509c01
      https://github.com/llvm/llvm-project/commit/cdd4c6c47130b69d1206fb850866bd95c7509c01
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-08-04 (Tue, 04 Aug 2026)

  Changed paths:
    M flang/include/flang/Utils/OpenMP.h
    M flang/lib/Lower/OpenMP/ClauseProcessor.cpp
    M flang/lib/Utils/OpenMP.cpp

  Log Message:
  -----------
  Resolve feedback about createMapInfoOp usage

Build iterator-generated map entries through the shared createMapInfoOp
helper while preserving the FIR `var_ptr` type used to derive the OpenMP
`varPtrType` for `!llvm.ptr` iterator results.


  Commit: ae435dcd1a20af44ce79a1d046570a540ff906b6
      https://github.com/llvm/llvm-project/commit/ae435dcd1a20af44ce79a1d046570a540ff906b6
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-08-04 (Tue, 04 Aug 2026)

  Changed paths:
    M flang/lib/Lower/OpenMP/ClauseProcessor.cpp
    M flang/lib/Lower/OpenMP/OpenMP.cpp
    A flang/test/Lower/OpenMP/Todo/map-iterator-derived-member.f90
    A flang/test/Lower/OpenMP/Todo/motion-iterator-derived-member.f90
    A flang/test/Lower/OpenMP/Todo/target-iterator-derived-member.f90

  Log Message:
  -----------
  Resolve feedback about iterator member maps

Reject iterator-dependent derived type member maps for now. These maps
would otherwise bypass the parent/member bookkeeping in processMapObjects,
including parentMemberIndices construction and mapper resolution with
hasParentObj=true.

Without that bookkeeping, lowering map(iterator(...): x%a(i)) could emit
an incomplete parent partial map. Emit a TODO instead of silently generating
incorrect or incomplete mapping IR.


  Commit: 2eba3988cd6873feca95616c7fcff0356583087f
      https://github.com/llvm/llvm-project/commit/2eba3988cd6873feca95616c7fcff0356583087f
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-08-04 (Tue, 04 Aug 2026)

  Changed paths:
    M flang/lib/Lower/OpenMP/Utils.cpp

  Log Message:
  -----------
  Add comment about iterator map bounds

Clarify why iterator map lowering keeps a stable base address while
lowering iterator-dependent subscripts inside the omp.iterator body.
This documents the difference from ordinary map bounds generation.


  Commit: 384bbfc7eefb183c2f67047107b0ce5d15073809
      https://github.com/llvm/llvm-project/commit/384bbfc7eefb183c2f67047107b0ce5d15073809
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-08-04 (Tue, 04 Aug 2026)

  Changed paths:
    M flang/lib/Lower/OpenMP/ClauseProcessor.cpp
    M flang/lib/Lower/OpenMP/ClauseProcessor.h

  Log Message:
  -----------
  Preserve iterator-dependent locators in shared map lowering

Share the iterated-map handling between map and motion clauses while
preserving iterator-dependent locators on map_iterated and keeping
standard map lowering for other clause objects.


  Commit: f1040394ca638f1e861050e51879b8f8651197c2
      https://github.com/llvm/llvm-project/commit/f1040394ca638f1e861050e51879b8f8651197c2
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-08-04 (Tue, 04 Aug 2026)

  Changed paths:
    M flang/lib/Lower/OpenMP/Utils.cpp
    M flang/test/Lower/OpenMP/motion-iterator.f90

  Log Message:
  -----------
  Preserve descriptor strides for iterator map bounds

Iterator map lowering keeps a stable array base pointer and describes the
selected element or section with bounds inside omp.iterator. For boxed arrays,
those bounds must use the byte stride stored for each descriptor dimension.

Use fir.box_dims for boxed iterator map bounds and pass through each
dimension's descriptor byte stride. This preserves non-contiguous
assumed-shape actuals while keeping unit element strides for non-box arrays.


  Commit: 698f71e7f8b905a055a83edc03f4f5bd8c86e269
      https://github.com/llvm/llvm-project/commit/698f71e7f8b905a055a83edc03f4f5bd8c86e269
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-08-04 (Tue, 04 Aug 2026)

  Changed paths:
    M flang/lib/Lower/OpenMP/ClauseProcessor.cpp
    M flang/lib/Lower/OpenMP/Utils.cpp

  Log Message:
  -----------
  Remove unnecessary lambda and helpers


  Commit: 578db39633059080817f996c5b18e99899096feb
      https://github.com/llvm/llvm-project/commit/578db39633059080817f996c5b18e99899096feb
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-08-04 (Tue, 04 Aug 2026)

  Changed paths:
    M flang/lib/Lower/OpenMP/ClauseProcessor.cpp
    M flang/lib/Lower/OpenMP/Utils.cpp
    M flang/test/Lower/OpenMP/Todo/map-iterator-derived-member.f90
    M flang/test/Lower/OpenMP/Todo/motion-iterator-derived-member.f90
    M flang/test/Lower/OpenMP/Todo/target-iterator-derived-member.f90
    M flang/test/Lower/OpenMP/declare-mapper-iterator.f90
    M flang/test/Lower/OpenMP/motion-iterator.f90

  Log Message:
  -----------
  Fix iterator map var_ptr for allocatable/pointer arrays

For allocatable or pointer arrays used in iterator map/motion locators (for
example, `target update to(iterator(i = 1:n): a(i))`), getIteratorMapEntity
returned the descriptor address, causing omp.map.info to record the Fortran
descriptor in var_ptr instead of the array data. This affected both whole-array
locators and derived-type component locators such as v%a(i) (via declare
mappers).

Load the descriptor in getIteratorMapEntity and use fir.box_addr for var_ptr,
while continuing to derive bounds and byte strides from the descriptor.
Assumed-shape and non-allocatable entities are unaffected.

Also replace the indirect `directive != OMPD_unknown` declare-mapper check with
a direct lookup of an enclosing omp.declare_mapper region.


  Commit: 932ffbbfbf5eed394f143fad175724554c996f5d
      https://github.com/llvm/llvm-project/commit/932ffbbfbf5eed394f143fad175724554c996f5d
  Author: Chi-Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-08-04 (Tue, 04 Aug 2026)

  Changed paths:
    M flang/lib/Lower/OpenMP/ClauseProcessor.cpp
    R flang/test/Lower/OpenMP/Todo/target-iterator-derived-member.f90
    A flang/test/Lower/OpenMP/Todo/target-map-iterator.f90

  Log Message:
  -----------
  Reject target map iterator modifiers

Executable target regions need stable block arguments for iterator-mapped
objects. Without separate captures, implicit lowering adds a whole-object
`tofrom` map that changes the requested extent and direction.

Reject this unsupported case until target map iterator captures are
available, and add TODO coverage for the reported array use.


  Commit: fdadf2f308b0657e5903d3b980e977c0bce73fe1
      https://github.com/llvm/llvm-project/commit/fdadf2f308b0657e5903d3b980e977c0bce73fe1
  Author: Chi-Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-08-04 (Tue, 04 Aug 2026)

  Changed paths:
    M flang/lib/Optimizer/OpenMP/MapInfoFinalization.cpp
    A flang/test/Lower/OpenMP/map-iterator-descriptor-finalization.f90

  Log Message:
  -----------
  Make iterator map finalization more robust

MapInfoFinalization skips maps nested in `omp.iterator`, so descriptor-backed
iterator maps are not expanded. Add end-to-end Fortran coverage for
assumed-shape and allocatable arrays.

Make the iterator guard explicit in the record-member walk and remove the
unreachable `omp.yield` traversal from `getFirstTargetUser`.


  Commit: 7c30f67547d9bce4bde980111f0af7f2bf31dd0e
      https://github.com/llvm/llvm-project/commit/7c30f67547d9bce4bde980111f0af7f2bf31dd0e
  Author: Chi-Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-08-04 (Tue, 04 Aug 2026)

  Changed paths:
    M flang/lib/Lower/OpenMP/ClauseProcessor.cpp
    M flang/lib/Semantics/check-omp-structure.cpp
    M flang/test/Lower/OpenMP/map-iterator-descriptor-finalization.f90
    M flang/test/Semantics/OpenMP/target-enter-data-temp-descriptor-omp61.f90
    M flang/test/Semantics/OpenMP/target-enter-data-temp-descriptor.f90

  Log Message:
  -----------
  Align descriptor warnings with iterator maps

Iterator maps lower descriptor-backed arrays to data-only entries. Skip the
temporary-descriptor warning for those maps and document the contract.


  Commit: 67c30390f049be2d627800f41963a3cf25400c8b
      https://github.com/llvm/llvm-project/commit/67c30390f049be2d627800f41963a3cf25400c8b
  Author: Chi-Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-08-04 (Tue, 04 Aug 2026)

  Changed paths:
    M flang/lib/Lower/OpenMP/ClauseProcessor.cpp
    A flang/test/Lower/OpenMP/Todo/map-iterator-optional.f90
    A flang/test/Lower/OpenMP/Todo/motion-iterator-optional.f90

  Log Message:
  -----------
  Reject optional iterator locators

Optional iterator locators require presence-aware map construction. Reject
them until lowering can omit absent optional list items safely.


Compare: https://github.com/llvm/llvm-project/compare/f2cdab4c2e8b...67c30390f049

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