[flang] Embox derived-type directly to fir.class without fir.convert
authorValentin Clement <clementval@gmail.com>
Thu, 13 Oct 2022 08:39:29 +0000 (10:39 +0200)
committerValentin Clement <clementval@gmail.com>
Thu, 13 Oct 2022 08:39:59 +0000 (10:39 +0200)
commit89c923655aad6de837e386aa6e1dfa72c16e2697
tree9d6b5e104feda444aa6c0c3b2325832d2ab66880
parente74390cc9616417c3741af75f8eb19fdc5cd589f
[flang] Embox derived-type directly to fir.class without fir.convert

non-polymorphic derived-type can call type-bound procedure with passed-object.
In that case, the derived-type is emboxed in order to be passed to the call.
Until now the emboxing was done to a fir.box followed by a fir.convert.
This patch update the createBox function so that we can directly embox to
a fir.class and avoid the extra fir.convert.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D135790
flang/include/flang/Optimizer/Builder/FIRBuilder.h
flang/lib/Lower/ConvertExpr.cpp
flang/lib/Optimizer/Builder/FIRBuilder.cpp
flang/test/Lower/polymorphic.f90