[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:29:38 PDT 2026


================
@@ -533,6 +533,34 @@ static LogicalResult checkImplementationStatus(Operation &op) {
       result = todo("map/motion clause with iterator modifier");
   };
 
+  // `declare_mapper.info` supports the simple case emitted by Flang's
+  // lowering: a single-dimension iterator whose body directly yields one
+  // bounds-free, member-free omp.map.info. Anything else still falls back to
+  // the generic (not yet implemented) diagnostic above.
+  auto checkDeclareMapperMap = [&todo](omp::DeclareMapperInfoOp op,
+                                       LogicalResult &result) {
+    for (Value iterVal : op.getMapIterated()) {
+      auto itersOp = iterVal.getDefiningOp<omp::IteratorOp>();
+      bool supported = itersOp && itersOp.getLoopLowerBounds().size() == 1;
+      if (supported) {
+        auto yieldOp =
----------------
ravurvi20 wrote:

Fixed — both `checkDeclareMapperMap` and the per-iterator loop in `emitUserDefinedMapper` now use `IteratorOp::getYieldOp()` (locates the region's unique `omp.yield` across all blocks) instead of assuming `region.front().getTerminator()`. Verified end-to-end with a real LEN_TRIM-driven locator `(map(iterator(i=1:2): v%a(i+len_trim(v%text))))` compiled through to LLVM IR — added as `Integration/OpenMP/map-iterator-multi-block.f90`, plus a hand-written multi-block case in `openmp-iterator.mlir`.

https://github.com/llvm/llvm-project/pull/215485


More information about the Mlir-commits mailing list