[Mlir-commits] [flang] [mlir] [Flang][MLIR][OpenMP] - Add support for firstprivate when translating omp.target ops from MLIR to LLVMIR (PR #131213)

Tom Eccles llvmlistbot at llvm.org
Mon Mar 31 02:13:59 PDT 2025


================
@@ -158,5 +169,50 @@ class MapsForPrivatizedSymbolsPass
       }
     }
   }
+  // As the name suggests, this function examines var to determine if
+  // it has dynamic size. If true, this pass'll have to extract these
+  // bounds from descriptor of var and add the bounds to the resultant
+  // MapInfoOp.
+  bool needsBoundsOps(mlir::Value var) {
+    assert(mlir::isa<omp::PointerLikeType>(var.getType()) &&
+           "needsBoundsOps can deal only with pointer types");
+    mlir::Type t = fir::unwrapRefType(var.getType());
+    // t could be a box, so look inside the box
+    auto innerType = fir::dyn_cast_ptrOrBoxEleTy(t);
+    if (innerType)
+      return fir::hasDynamicSize(innerType);
+    return fir::hasDynamicSize(t);
+  }
+  void genBoundsOps(fir::FirOpBuilder &builder, mlir::Value var,
----------------
tblah wrote:

ultra-nit
```suggestion
  }
  
  void genBoundsOps(fir::FirOpBuilder &builder, mlir::Value var,
```

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


More information about the Mlir-commits mailing list