[all-commits] [llvm/llvm-project] 3ed899: [flang] handle allocatable components when creatin...

jeanPerier via All-commits all-commits at lists.llvm.org
Thu Mar 17 02:57:16 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3ed899cc741aea7480a0e764b7e9f5358538d810
      https://github.com/llvm/llvm-project/commit/3ed899cc741aea7480a0e764b7e9f5358538d810
  Author: Jean Perier <jperier at nvidia.com>
  Date:   2022-03-17 (Thu, 17 Mar 2022)

  Changed paths:
    M flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp
    A flang/test/Fir/array-value-copy-3.fir

  Log Message:
  -----------
  [flang] handle allocatable components when creating array temps

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.

Differential Revision: https://reviews.llvm.org/D121892




More information about the All-commits mailing list