[flang] Do not propagate type desc when box type is not polymorphic
authorValentin Clement <clementval@gmail.com>
Tue, 22 Nov 2022 08:41:09 +0000 (09:41 +0100)
committerValentin Clement <clementval@gmail.com>
Tue, 22 Nov 2022 08:41:50 +0000 (09:41 +0100)
commitfedf4dcd808b0e20113e06a09d36c1c0cd56091d
tree3368adf6ddff92b14d4100dcccd0fd7a9d7acd64
parente07ca2aeeb2f641e62f6ac7359472eb50111ea00
[flang] Do not propagate type desc when box type is not polymorphic

When the rhs is non-polymorphic the type descriptor should not
be propagated. An error in the EmboxOp verifier was raised in that case.
This patch propagate the type descriptor only if the result type of the
EmboxOp operation is polymorphic.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D138442
flang/lib/Optimizer/Builder/FIRBuilder.cpp
flang/test/Lower/polymorphic.f90