[flang-commits] [flang] [flang][cuda] Split realloc for host-accessible CUDA Fortran allocatable assigns (PR #224195)
via flang-commits
flang-commits at lists.llvm.org
Thu Sep 17 07:52:44 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);
----------------
jeanPerier wrote:
Even though I see that you skipped derived type below, I think the code here should only skip the Allocmem + alignment but still fall into the derived type init if needed so that we do not get bitten if something else guards it without guarding derived type.
Or add an assert if calling genDerivedTypeInitialize is not possible/does not work as expected for managed/pinned/unified.
https://github.com/llvm/llvm-project/pull/224195
More information about the flang-commits
mailing list