[flang] Accept polymorphic component element in storage_size
commitb7691d7be0362499eaadbec13cec5f2e248836f6
authorValentin Clement <clementval@gmail.com>
Thu, 23 Feb 2023 16:28:07 +0000 (23 17:28 +0100)
committerValentin Clement <clementval@gmail.com>
Thu, 23 Feb 2023 16:28:25 +0000 (23 17:28 +0100)
tree863ad083373a7c79f4144e44745f41e436903b52
parente89a00db6d0596fe0263ca0a1052e5e6859744e9
[flang] Accept polymorphic component element in storage_size

When an element is extracted from a polymorphic array, it is
represented as a PolymorphicValue. The PolymorphicValue is
not a boxed value but holds the original polyrmophic array
and the element itself. This was raising an error in storage_size
lowering since we expect a boxed value to take advantage of
fir.box_elesize.
This patch handles PolymorphicValue correctly.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D144643
flang/lib/Optimizer/Builder/IntrinsicCall.cpp
flang/test/Lower/Intrinsics/storage_size.f90