[flang-commits] [flang] [llvm] [mlir] [Flang][OpenMP] Remove target implicit allocatable member mapping from MapInfoFinalization and extend lowering to support it (PR #219434)

via flang-commits flang-commits at lists.llvm.org
Mon Sep 7 11:01:06 PDT 2026


================
@@ -340,29 +340,39 @@ mlir::FlatSymbolRefAttr getOrGenImplicitDefaultDeclareMapper(
           firOpBuilder, loc, recType, mapperIdName, mangler);
     }
 
-    auto ref =
-        getFieldRef(declareOp.getBase(), memberName, memberType, recordType);
-    llvm::SmallVector<mlir::Value> bounds;
-    genBoundsOps(ref, bounds);
-    mlir::Value mapOp = Fortran::utils::openmp::createMapInfoOp(firOpBuilder,
-        loc, ref, /*varPtrPtr=*/mlir::Value{}, /*name=*/"", bounds,
-        /*members=*/{},
-        /*membersIndex=*/mlir::ArrayAttr{}, mapFlag, captureKind, ref.getType(),
-        /*partialMap=*/false, mapperId);
-    memberMapOps.emplace_back(mapOp);
-    memberPlacementIndices.emplace_back(
-        llvm::SmallVector<int64_t>{(int64_t)entry.index()});
+    if (fir::isAllocatableType(fir::unwrapRefType(memberType)) ||
+        mlir::isa<fir::RecordType>(fir::getFortranElementType(memberType))) {
+      auto ref =
+          getFieldRef(declareOp.getBase(), memberName, memberType, recordType);
+      llvm::SmallVector<mlir::Value> bounds;
+      genBoundsOps(ref, bounds);
+
+      if (fir::isAllocatableType(fir::unwrapRefType(memberType)))
+        mapFlag |= mlir::omp::ClauseMapFlags::ref_ptee;
----------------
agozillon wrote:

Nice catch :-)

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


More information about the flang-commits mailing list