[all-commits] [llvm/llvm-project] e45f6e: [flang][hlfir] Make the parent type the first comp...
jeanPerier via All-commits
all-commits at lists.llvm.org
Fri Oct 20 02:31:12 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e45f6e93d0b90e917eff61ac104a673c52ee2322
https://github.com/llvm/llvm-project/commit/e45f6e93d0b90e917eff61ac104a673c52ee2322
Author: jeanPerier <jperier at nvidia.com>
Date: 2023-10-20 (Fri, 20 Oct 2023)
Changed paths:
M flang/include/flang/Lower/ConvertType.h
M flang/include/flang/Semantics/tools.h
M flang/include/flang/Semantics/type.h
M flang/lib/Lower/ConvertConstant.cpp
M flang/lib/Lower/ConvertExprToHLFIR.cpp
M flang/lib/Lower/ConvertType.cpp
M flang/lib/Lower/ConvertVariable.cpp
M flang/lib/Semantics/type.cpp
M flang/test/Lower/HLFIR/calls-constant-expr-arg-polymorphic.f90
M flang/test/Lower/HLFIR/local-end-of-scope-component-dealloc.f90
M flang/test/Lower/HLFIR/parent-component-ref.f90
M flang/test/Lower/HLFIR/private-components.f90
M flang/test/Lower/HLFIR/structure-constructor.f90
M flang/test/Lower/HLFIR/type-bound-call-mismatch.f90
M flang/test/Lower/HLFIR/type-info.f90
Log Message:
-----------
[flang][hlfir] Make the parent type the first component (#69348)
Type extension is currently handled in FIR by inlining the parents
components as the first member of the record type.
This is not correct from a memory layout point of view since the storage
size of the parent type may be bigger than the sum of the size of its
component (due to alignment requirement). To avoid making FIR types
target dependent and fix this issue, make the parent component a single
component with the parent type at the beginning of the record type.
This also simplifies addressing since parent component is now a "normal"
component that can be designated with hlfir.designate.
StructureComponent lowering however is a bit more complex since the
symbols in the structure component may refer to subcomponents of parent
types.
Notes:
1. The fix is only done in HLFIR for now, a similar fix should be done
in ConvertExpr.cpp to fix the path without HLFIR (I will likely still do
it in a new patch since it would be an annoying bug to investigate for
people testing flang without HLFIR).
2. The private component extra mangling is useless after this patch. I
will remove it after 1.
3. The "parent component" TODO in constant CTOR is free to implement for
HLFIR after this patch, but I would rather remove it and test it in a
different patch.
More information about the All-commits
mailing list