[llvm-branch-commits] [flang] [flang] - Call _FortranAAssignSimple instead of _FortranAAssign for intrinsic-type array assignments (PR #213705)

Sairudra More via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Aug 3 22:57:06 PDT 2026


================
@@ -145,7 +149,26 @@ class AssignOpConversion : public mlir::OpRewritePattern<hlfir::AssignOp> {
           // type after the assignment.
           fir::runtime::genAssignPolymorphic(builder, loc, to, from);
         } else {
-          fir::runtime::genAssign(builder, loc, to, from);
+          // Use simple path for allocatable with trivial types (scalars and
+          // arrays) Only use Simple path when ranks match. Only use Simple path
+          // for non-volatile - volatile needs memory ordering NOTE: For
+          // allocatables, we assume contiguity - allocatable whole-array
+          // assignments
+          //       are always contiguous. Strided sections of allocatables go
+          //       through different path.
+          if (!lhs.isPolymorphic() &&
----------------
Saieiei wrote:

Should this path also be gated by `!useFortranAssignOnly`? The option is documented as disabling `_FortranAAssignSimple`, but only the non-allocatable path checks it. As a result, whole-allocatable assignments such as `@alloc_i32_array` still use `_FortranAAssignSimple` when the option is enabled. Could you add the same guard here and an option-specific test covering both paths?

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


More information about the llvm-branch-commits mailing list