[flang-commits] [flang] [llvm] [mlir] [flang][mlir][OpenMP] Support iterator modifier in declare mapper map clause (PR #215485)
Urvi Rav via flang-commits
flang-commits at lists.llvm.org
Fri Sep 25 04:06:46 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,
----------------
ravurvi20 wrote:
Replaced both occurrences (the direct-user check and the `iterUser` check in the iterator/yield `lookthrough`) with `llvm::isa<mlir::omp::MapClauseOwningOpInterface>(...)mlir::omp::MapClauseOwningOpInterface(...)`. Verified all six ops (`TargetOp`, `TargetDataOp`, `TargetUpdateOp`, `TargetExitDataOp`, `TargetEnterDataOp`, `DeclareMapperInfoOp`) pick up that interface.
https://github.com/llvm/llvm-project/pull/215485
More information about the flang-commits
mailing list