[flang-commits] [flang] [llvm] [mlir] [flang][mlir][OpenMP] Support iterator modifier in declare mapper map clause (PR #215485)
via flang-commits
flang-commits at lists.llvm.org
Wed Sep 23 13:59:25 PDT 2026
================
@@ -801,6 +801,23 @@ class MapInfoFinalizationPass
if (auto mapUser = llvm::dyn_cast<mlir::omp::MapInfoOp>(user))
return getFirstTargetUser(mapUser);
+
+ // A map produced inside an `omp.iterator` body (for an `iterator`
+ // modifier on a map/motion clause) is only directly used by the
+ // region's `omp.yield`; look through it to the op consuming the
+ // iterator's `map_iterated` result instead.
+ if (llvm::isa<mlir::omp::YieldOp>(user)) {
+ if (auto iterOp = llvm::dyn_cast_if_present<mlir::omp::IteratorOp>(
+ user->getParentOp())) {
+ for (auto *iterUser : iterOp.getIterated().getUsers())
+ if (llvm::isa<mlir::omp::TargetOp, mlir::omp::TargetDataOp,
----------------
chichunchen wrote:
I'd suggest replace these 6 checks with `llvm::isa<mlir::omp::MapClauseOwningOpInterface>(iterUser)`.
https://github.com/llvm/llvm-project/pull/215485
More information about the flang-commits
mailing list