[flang-commits] [flang] [flang][cuda] Split realloc for host-accessible CUDA Fortran allocatable assigns (PR #224195)

Valentin Clement バレンタイン クレメン via flang-commits flang-commits at lists.llvm.org
Thu Sep 17 11:18:48 PDT 2026


================
@@ -749,11 +750,21 @@ static mlir::Value allocateAndInitNewStorage(fir::FirOpBuilder &builder,
                                              const fir::MutableBoxValue &box,
                                              mlir::ValueRange extents,
                                              mlir::ValueRange lenParams,
-                                             llvm::StringRef allocName) {
+                                             llvm::StringRef allocName,
+                                             cuf::DataAttributeAttr dataAttr) {
   auto lengths = getNewLengths(builder, loc, box, lenParams);
+
+  if (dataAttr) {
+    auto newStorage =
+        cuf::AllocOp::create(builder, loc, box.getBaseTy(), allocName,
+                             allocName, dataAttr, lengths, extents)
+            .getResult();
+    return fir::ConvertOp::create(
+        builder, loc, fir::HeapType::get(box.getBaseTy()), newStorage);
----------------
clementval wrote:

I finally kept the genDerivedTypeInitialize because managed/pinned/unified are host-accessible

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


More information about the flang-commits mailing list