[flang-commits] [flang] [flang] Assume matching shapes in elemental assignment with non-realloc lhs. (PR #118552)

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Tue Dec 3 17:40:15 PST 2024


================
@@ -13,7 +13,7 @@ subroutine sb1(a, x, y, z)
   integer :: a
   integer :: x(:)
   integer :: y(:)
-  integer :: z(:)
+  integer, allocatable :: z(:)
----------------
vzakhari wrote:

Yes, this change is required, if you want to keep testing the fact that the `fir.allocmem` and `fir.freemem` are placed in the `omp.single` regions. Those operations appear due to the optimized bufferization not being able to optimize the assignment without a runtime call, which requires the RHS to be computed into a temporary array.

With this patch the line 18 statement will be optimized such that there is no runtime call at all, and hence no temporary array allocation/deallocation.

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


More information about the flang-commits mailing list