[flang] Lower elemental and transformational clean-up in HLFIR
authorJean Perier <jperier@nvidia.com>
Tue, 17 Jan 2023 10:40:09 +0000 (11:40 +0100)
committerJean Perier <jperier@nvidia.com>
Tue, 17 Jan 2023 10:44:23 +0000 (11:44 +0100)
commitc0b45fef155fbe3f17f9a6f99074682c69545488
tree94911f130891ff4a5baeaa1c74dffa361e6dccfb
parent6c37fbdfcf2550c5de8b7e1a434c0db1273e906b
[flang] Lower elemental and transformational clean-up in HLFIR

In lowering to hlfir, no clean-up was added yet for
the created hlfir.elemental. Add  the needed hlfir.destroy.

Regarding transformational lowering, clean-ups were created because
they are lowered in memory, but this is inconvenient because this
prevented lowering to hlfir from "moving" the created variable to
an expression. Add a new entry point in IntrinsicCall.h that keeps
track of whether or not the returned storage needs to be deallocated,
but does not insert the deallocation in the StatementContext.
This allows using the newly added hlfir.as_expr "move" aspect to be
used and save creating a copy.

Depends on D141839

Reviewed By: clementval

Differential Revision: https://reviews.llvm.org/D141841
flang/include/flang/Lower/IntrinsicCall.h
flang/lib/Lower/ConvertCall.cpp
flang/lib/Lower/ConvertExprToHLFIR.cpp
flang/lib/Lower/IntrinsicCall.cpp
flang/test/HLFIR/destroy-codegen.fir
flang/test/Lower/HLFIR/elemental-array-ops.f90
flang/test/Lower/HLFIR/elemental-intrinsics.f90
flang/test/Lower/HLFIR/elemental-user-procedure-ref.f90
flang/test/Lower/HLFIR/transformational.f90 [new file with mode: 0644]
flang/test/Lower/Intrinsics/transfer.f90
flang/test/Lower/Intrinsics/verify.f90