[all-commits] [llvm/llvm-project] da60b9: [flang] Fixed managing copy-in/copy-out temps.
Slava Zakharin via All-commits
all-commits at lists.llvm.org
Tue May 23 09:37:41 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: da60b9e7dc6b217ecd8f422a71ee3aa4a4022015
https://github.com/llvm/llvm-project/commit/da60b9e7dc6b217ecd8f422a71ee3aa4a4022015
Author: Slava Zakharin <szakharin at nvidia.com>
Date: 2023-05-23 (Tue, 23 May 2023)
Changed paths:
M flang/include/flang/Lower/CallInterface.h
M flang/include/flang/Optimizer/Builder/Runtime/Assign.h
M flang/include/flang/Optimizer/Builder/Runtime/Derived.h
M flang/include/flang/Runtime/assign.h
M flang/include/flang/Runtime/derived-api.h
M flang/lib/Lower/CallInterface.cpp
M flang/lib/Lower/ConvertCall.cpp
M flang/lib/Lower/ConvertExpr.cpp
M flang/lib/Optimizer/Builder/Runtime/Assign.cpp
M flang/lib/Optimizer/Builder/Runtime/Derived.cpp
M flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp
M flang/runtime/assign.cpp
M flang/runtime/derived-api.cpp
M flang/test/HLFIR/copy-in-out-codegen.fir
M flang/test/Lower/call-by-value-attr.f90
M flang/test/Lower/call-copy-in-out.f90
M flang/test/Lower/dummy-argument-assumed-shape-optional.f90
M flang/test/Lower/dummy-argument-optional-2.f90
M flang/test/Lower/optional-value-caller.f90
Log Message:
-----------
[flang] Fixed managing copy-in/copy-out temps.
There are several observations regarding the copy-in/copy-out:
* Actual argument associated with INTENT(OUT) dummy argument that
requires finalization (7.5.6.3 p. 7) may be read by the finalization
function, so a copy-in is required.
* A temporary created for the copy-in/copy-out must be destroyed
without finalization after the call (or after the corresponding copy-out),
otherwise, memory leaks may occur.
* The copy-out assignment must not perform finalization for the LHS.
* The copy-out assignment from the temporary to the actual argument
may or may not need to initialize the LHS.
This change-set introduces new runtime methods: CopyOutAssign and
DestroyWithoutFinalization. They are called by the compiler generated
code to match the behavior described above.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D151135
More information about the All-commits
mailing list