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

Chi-Chun, Chen via All-commits all-commits at lists.llvm.org
Wed Jun 24 12:36:11 PDT 2026


  Branch: refs/heads/users/cchen/flang_openmp_motion_map_iterator
  Home:   https://github.com/llvm/llvm-project
  Commit: 9bdba2f9a775e4f184690afa615b6268be7c51b3
      https://github.com/llvm/llvm-project/commit/9bdba2f9a775e4f184690afa615b6268be7c51b3
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-06-24 (Wed, 24 Jun 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: e66ff4b3217d0a02d1bf466786c0f0c1be2e691a
      https://github.com/llvm/llvm-project/commit/e66ff4b3217d0a02d1bf466786c0f0c1be2e691a
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-06-24 (Wed, 24 Jun 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: c88cb8fe480677da90138f3fae510cee201666a7
      https://github.com/llvm/llvm-project/commit/c88cb8fe480677da90138f3fae510cee201666a7
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-06-24 (Wed, 24 Jun 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: 59526322de5ced24ff6b3decfc3ef545ff8de809
      https://github.com/llvm/llvm-project/commit/59526322de5ced24ff6b3decfc3ef545ff8de809
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-06-24 (Wed, 24 Jun 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: 22a65133b44111ddb2e5afc6ac3abf8a57c21bb3
      https://github.com/llvm/llvm-project/commit/22a65133b44111ddb2e5afc6ac3abf8a57c21bb3
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-06-24 (Wed, 24 Jun 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: 1aab5ac93019186176c5664d54e5774cd79f0bd3
      https://github.com/llvm/llvm-project/commit/1aab5ac93019186176c5664d54e5774cd79f0bd3
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-06-24 (Wed, 24 Jun 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: c516b3e2ce6bd343a0348e20841ad51af51c591f
      https://github.com/llvm/llvm-project/commit/c516b3e2ce6bd343a0348e20841ad51af51c591f
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-06-24 (Wed, 24 Jun 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: 07cab8dd6fb7d8bcf7cedc735d281c90f0f3fe7f
      https://github.com/llvm/llvm-project/commit/07cab8dd6fb7d8bcf7cedc735d281c90f0f3fe7f
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-06-24 (Wed, 24 Jun 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: f2cdab4c2e8bce895a78f9f00c27b902400c4923
      https://github.com/llvm/llvm-project/commit/f2cdab4c2e8bce895a78f9f00c27b902400c4923
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-06-24 (Wed, 24 Jun 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.


Compare: https://github.com/llvm/llvm-project/compare/8413e554a838...f2cdab4c2e8b

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