[flang-commits] [PATCH] D121892: [flang] handle allocatable components when creating array temps

Jean Perier via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Mar 17 02:03:23 PDT 2022


jeanPerier created this revision.
jeanPerier added reviewers: clementval, schweitz.
jeanPerier added a project: Flang.
Herald added subscribers: mehdi_amini, jdoerfert.
Herald added a reviewer: sscalpone.
Herald added a project: All.
jeanPerier requested review of this revision.

When creating an array temporary in the array copy pass, care must be
taken with allocatable components. The element components needs to be
given a clean unallocated status before being used in the assignments.
This is because assignment of allocatable components makes deep copy,
and may cause deallocation of the previous value if it was allocated.
Hence the previous allocation status cannot be let undefined.

On top of that, when cleaning-up the temp, all allocatable components
that may have been allocated must be deallocated.

This patch implements this by centralizing the code making and cleaning
array temps in ArrayValueCopy.cpp, and by calling Initialize and Destroy
runtime entry points when they are allocatable components.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121892

Files:
  flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp
  flang/test/Fir/array-value-copy-3.fir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121892.416100.patch
Type: text/x-patch
Size: 9453 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220317/a8a68e1d/attachment.bin>


More information about the flang-commits mailing list