[flang-commits] [flang] [flang] Fix optimization of array assignments after #146408 (PR #147371)

Leandro Lupori via flang-commits flang-commits at lists.llvm.org
Tue Jul 8 07:02:43 PDT 2025


================
@@ -805,13 +805,12 @@ llvm::LogicalResult BroadcastAssignBufferization::matchAndRewrite(
                                                shape, /*slice=*/mlir::Value{});
     } else {
       // Array references must have fixed shape, when used in assignments.
+      auto refTy = mlir::cast<fir::ReferenceType>(lhs.getType());
----------------
luporl wrote:

Thanks for the review.

On line 786 there is a call to `hlfir::derefPointersAndAllocatables`:
`lhs = hlfir::derefPointersAndAllocatables(loc, builder, lhs);`
Shouldn't it handle fir.heap/fir.ptr already?

Also, after getting the flat array reference type, `lhs` is converted to it. Would this convert be valid for fir.heap/fir.ptr?

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


More information about the flang-commits mailing list