[flang-commits] [flang] [flang][OpenMP] Lower array-section workdistribute assign to element loop (PR #225595)
via flang-commits
flang-commits at lists.llvm.org
Tue Oct 13 23:07:40 PDT 2026
================
@@ -469,6 +488,28 @@ static bool isFortranAssignSrcScalarAndDestArray(fir::CallOp callOp) {
return srcIsScalar && destIsArray;
}
+/// Check if the FortranAAssign call has both src and dest as array descriptors.
+/// This is the array-section copy case (e.g. a(0,:,:) = b(n,:,:)) that a flat
+/// omp_target_memcpy would get wrong for strided sections. Matching the runtime
+/// signature, dest is a reference to a box and src is a box passed by value.
+static bool isFortranAssignSrcArrayAndDestArray(fir::CallOp callOp) {
+ if (callOp.getNumOperands() < 2)
+ return false;
+ auto srcConvert = callOp.getOperand(1).getDefiningOp<fir::ConvertOp>();
+ auto destConvert = callOp.getOperand(0).getDefiningOp<fir::ConvertOp>();
+ if (!srcConvert || !destConvert)
+ return false;
+ Type srcTy = srcConvert.getValue().getType();
+ Type destTy = destConvert.getValue().getType();
+ if (!isEnclosedTypeBoxArray(srcTy) || !isEnclosedTypeRefToBoxArray(destTy))
----------------
skc7 wrote:
Thanks for suggestion. Switched to fir hepers in new patch, which now also accepts allocatables. Added new test `lower-workdistribute-runtime-assign-array-alloc.mlir`.
https://github.com/llvm/llvm-project/pull/225595
More information about the flang-commits
mailing list