[all-commits] [llvm/llvm-project] b63698: [flang][hlfir] Fixed finalization in hlfir.assign ...

Slava Zakharin via All-commits all-commits at lists.llvm.org
Wed Jul 19 14:38:48 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b63698727d84a84f2163386aa3209ab28cc73c7e
      https://github.com/llvm/llvm-project/commit/b63698727d84a84f2163386aa3209ab28cc73c7e
  Author: Slava Zakharin <szakharin at nvidia.com>
  Date:   2023-07-19 (Wed, 19 Jul 2023)

  Changed paths:
    M flang/include/flang/Optimizer/Builder/FIRBuilder.h
    M flang/lib/Optimizer/Builder/FIRBuilder.cpp
    M flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp
    M flang/test/HLFIR/assign-codegen.fir

  Log Message:
  -----------
  [flang][hlfir] Fixed finalization in hlfir.assign codegen.

When hlfir.assign is lowered into simple load/store,
we may still need to finalize the LHS.
The patch passes `needFinalization` to `genScalarAssignment`
for LHS of any derived type, so some `Destroy` calls
might be redundant. They can be removed later by propagating/deducing
IsFinalizable information about the LHS type.

Reviewed By: clementval

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


  Commit: b9e435cbe494c919e8edc973e696e88e08e0dace
      https://github.com/llvm/llvm-project/commit/b9e435cbe494c919e8edc973e696e88e08e0dace
  Author: Slava Zakharin <szakharin at nvidia.com>
  Date:   2023-07-19 (Wed, 19 Jul 2023)

  Changed paths:
    M flang/include/flang/Optimizer/HLFIR/HLFIROps.td
    M flang/lib/Lower/ConvertArrayConstructor.cpp
    M flang/test/Lower/HLFIR/array-ctor-as-elemental.f90

  Log Message:
  -----------
  [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


Compare: https://github.com/llvm/llvm-project/compare/42a024fad9fc...b9e435cbe494


More information about the All-commits mailing list