[llvm-branch-commits] [flang] [Flang][OpenMP] - When mapping a `fir.boxchar`, map the underlying data pointer as a member (PR #141715)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jun 3 14:12:53 PDT 2025


================
@@ -743,6 +800,37 @@ class MapInfoFinalizationPass
         return mlir::WalkResult::advance();
       });
 
+      func->walk([&](mlir::omp::MapInfoOp op) {
+        if (!op.getMembers().empty())
+          return;
+
+        if (!mlir::isa<fir::BoxCharType>(fir::unwrapRefType(op.getVarType())))
+          return;
+
+        // POSSIBLE_HACK_ALERT: If the boxchar has been implicitly mapped then
+        // it is likely that the underlying pointer to the data
----------------
agozillon wrote:

I think as long as it's the same address, the runtime wouldn't necessarily invoke another data transferal, just bump the ref counter, so it wouldn't be too costly in these cases I think! But it is nice to avoid generating extra maps where feasible :-)  

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


More information about the llvm-branch-commits mailing list