[all-commits] [llvm/llvm-project] 1ca458: [flang][hlfir] Lower structure constructor via Ass...

Slava Zakharin via All-commits all-commits at lists.llvm.org
Wed May 31 11:31:11 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1ca458f78e26e785b6eca2946a7558d8c39c7490
  Author: Slava Zakharin <szakharin at nvidia.com>
  Date:   2023-05-31 (Wed, 31 May 2023)

  Changed paths:
    M flang/lib/Lower/ConvertExprToHLFIR.cpp
    A flang/test/Lower/HLFIR/structure-constructor.f90

  Log Message:
  [flang][hlfir] Lower structure constructor via AssignOp.

I tried this patch, first. Some tests failed because of the extra
finalizations for the temporary LHSs: when LHS component is a derived
type with final subprograms, the finalizations might be detected
by counting/printing in the final subprograms and treated as errors
in the tests, because they are not expected.
So I also tried to reuse the StructureConstructor code lowering to FIR
followed by AsExprOp to produce the HLFIR "value". Unfortunately,
this did not resolve the finalization issues, because AsExprOp may
end up being bufferized into AssignOp as well.
So the extra finalizations are inherent problem for AssignOp,
and it has to be resolved separately. Thus, I decided to proceed
with a "cleaner" direct lowering to HLFIR (the initial patch).

I am thinking about adding an extra flag for AssignOp that would
indicate that the LHS is a compiler generated temporary, so we could
use something like AssignTemporary() in HLFIR-to-FIR converter.

Reviewed By: tblah

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

More information about the All-commits mailing list