[flang][hlfir] Removed incorrect clean-up in the implied-do lowering.
authorSlava Zakharin <szakharin@nvidia.com>
Wed, 19 Jul 2023 17:03:27 +0000 (10:03 -0700)
committerSlava Zakharin <szakharin@nvidia.com>
Wed, 19 Jul 2023 21:38:31 +0000 (14:38 -0700)
commitb9e435cbe494c919e8edc973e696e88e08e0dace
treeca6c0e600f83a7799fb8c70e372f37b4e60ee7f5
parentb63698727d84a84f2163386aa3209ab28cc73c7e
[flang][hlfir] Removed incorrect clean-up in the implied-do lowering.

The lowering of calls/expressions unconditionally inserts DestroyOp
clean-up for hlfir.expr values, which is wrong in the case where
the value is used as a result of the elemental operation created
during the implied-do lowering. A cleaner fix could be to avoid
DestroyOp insertion at all, but I have not figure out an easy
way to do it. The DestroyOp look-up I used seems to be quite
reliable, so it should just work.

Reviewed By: clementval

Differential Revision: https://reviews.llvm.org/D155665
flang/include/flang/Optimizer/HLFIR/HLFIROps.td
flang/lib/Lower/ConvertArrayConstructor.cpp
flang/test/Lower/HLFIR/array-ctor-as-elemental.f90