[flang][hlfir] Add hlfir.destroy operation.
authorJean Perier <jperier@nvidia.com>
Tue, 17 Jan 2023 10:24:40 +0000 (11:24 +0100)
committerJean Perier <jperier@nvidia.com>
Tue, 17 Jan 2023 10:28:14 +0000 (11:28 +0100)
commitd647c3f719e700826ca618d0c63a8f93d537221a
tree67038a5c9cb2f6669a01a8c1e25fc2efd9109af8
parentc373eeb1c5cc99cad338af083b106c27d2779a53
[flang][hlfir] Add hlfir.destroy operation.

Add the operation to mark the end of life of hlfir.expr.
As described in its description this is the easiest solution
to deploy given lowering "knows" where expression value are last
used.
However, inserting these points in lowering will probably make
it harder to do some IR transformation that would move the code
using or creating hlfir.expr (no use should be moved after an
hlfir.destroy).
Once the dust settle with the HLFIR change, it will be worth assessing
the situation and see if an analysis could do a better and safer job at
finding those destruction points.

Depends on D141832

Reviewed By: clementval

Differential Revision: https://reviews.llvm.org/D141839
flang/include/flang/Optimizer/HLFIR/HLFIROps.td
flang/lib/Optimizer/HLFIR/Transforms/BufferizeHLFIR.cpp
flang/test/HLFIR/destroy-codegen.fir [new file with mode: 0644]
flang/test/HLFIR/destroy.fir [new file with mode: 0644]