[flang] Carry the whole polymorphic box in PolymorphicValue
authorValentin Clement <clementval@gmail.com>
Thu, 12 Jan 2023 16:59:18 +0000 (17:59 +0100)
committerValentin Clement <clementval@gmail.com>
Thu, 12 Jan 2023 17:00:16 +0000 (18:00 +0100)
commit9f1bb307da6fec6fc8123bdec79ecec28fced874
tree49557fc7c99f5e16a57a3f8181c3575dd49001c7
parent77c5eac2aa9b9b1a12850295abf84d51f87745de
[flang] Carry the whole polymorphic box in PolymorphicValue

Until now, only the address of the type descriptor was hold in
a PolymorphicValue. In some cases, the element size and the
type code are also needed when creating new polymorphic
descriptors from an element of a polymorphic entity.

This patch updates PolymorphicValue to carry the source
descriptor from which the element is extracted. The source
descriptor is then used when emboxing the element to a new
polymorphic descriptor.

This simplify the code done in D141274 and will be used
when creating polymorphic temporary as well.

Reviewed By: jeanPerier, PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D141609
18 files changed:
flang/include/flang/Optimizer/Builder/BoxValue.h
flang/include/flang/Optimizer/CodeGen/CGOps.td
flang/include/flang/Optimizer/Dialect/FIROps.td
flang/lib/Lower/ConvertExpr.cpp
flang/lib/Optimizer/Builder/BoxValue.cpp
flang/lib/Optimizer/Builder/FIRBuilder.cpp
flang/lib/Optimizer/Builder/MutableBox.cpp
flang/lib/Optimizer/CodeGen/CodeGen.cpp
flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
flang/lib/Optimizer/Dialect/FIROps.cpp
flang/test/Fir/fir-ops.fir
flang/test/Fir/invalid.fir
flang/test/Fir/polymorphic.fir
flang/test/Lower/allocatable-polymorphic.f90
flang/test/Lower/dispatch.f90
flang/test/Lower/pointer-association-polymorphic.f90
flang/test/Lower/polymorphic.f90
flang/test/Lower/select-type.f90