[Mlir-commits] [flang] [llvm] [mlir] [flang][mlir][OpenMP] Support iterator modifier in declare mapper map clause (PR #215485)
Urvi Rav
llvmlistbot at llvm.org
Thu Oct 22 00:25:01 PDT 2026
================
@@ -2032,13 +2084,138 @@ bool ClauseProcessor::processMap(
}
}
- if (iterator)
- TODO(currentLocation,
- "Support for iterator modifiers is not implemented yet");
TodoLocators(currentLocation, objects);
- processMapObjects(stmtCtx, clauseLocation,
- std::get<omp::ObjectList>(clause.t), mapTypeBits,
+ if (!iterator) {
+ processMapObjects(stmtCtx, clauseLocation, objects, mapTypeBits,
+ parentMemberIndices, result.mapVars, *ptrMapObjects,
+ mapperIdName, /*isMotionModifier=*/false, directive);
+ return;
+ }
+
+ llvm::SmallVector<IteratorRange> iteratorRanges;
+ llvm::SmallPtrSet<const Fortran::semantics::Symbol *, 4> ivSyms;
+ collectIteratorIVs(clause, converter, stmtCtx, iteratorRanges, ivSyms);
+
+ // Objects that reference an iterator induction variable are expanded at
+ // runtime via `omp.iterator`/`map_iterated`; the rest go through the
+ // regular static map-info path below.
+ omp::ObjectList staticObjects;
+ fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder();
+ for (const omp::Object &object : objects) {
+ if (!hasIteratorIVReference(object, ivSyms)) {
----------------
ravurvi20 wrote:
#227454 is already merged into main, `sourceIteratorReferences/getIteratorRangesForObject` (the same helpers depend/affinity use) were already available. `processMap's` iterator path now uses them too: each locator keeps its source-level iterator references instead of checking the folded expression and selects only the ranges it actually references instead of every range in the clause.
`map(iterator(i=3:2): v%a(1+0*i))` now builds a (zero-trip) iterator for i rather than folding to a static `v%a(1)`.
`map(iterator(i=1:2,j=3:2): v%a(i))` now builds a single-dimension iterator (just i).
Added regression coverage for both in `map-iterator-per-locator.f90`.
https://github.com/llvm/llvm-project/pull/215485
More information about the Mlir-commits
mailing list