Skip to content

Commit

Permalink
[flang][hlfir] Add TODO for polymorphic vector subscripted entities
Browse files Browse the repository at this point in the history
I removed the barriers a bit fast. Some mold is needed on
hlfir.elemental for polymorphic vector subscripted designator (and for
parenthesized polymorphic) so that a temporary can be later created.

The parenthesized array case may also just used asExpr and that
could later use AssignTemporary to deal with this. But the vector
subscripted designator case will need to use some new runtime
to get some mold allocation done for the temp.

Add TODOs in the meantime.

Differential Revision: https://reviews.llvm.org/D149970
  • Loading branch information
jeanPerier committed May 7, 2023
1 parent 49bef60 commit 2a9126d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions flang/lib/Lower/ConvertExprToHLFIR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,11 @@ class HlfirDesignatorBuilder {
llvm::ArrayRef<mlir::Value> resultExtents) {
fir::FirOpBuilder &builder = getBuilder();
mlir::Value shape = builder.genShape(loc, resultExtents);
// For polymorphic entities, it will be needed to add a mold on the
// hlfir.elemental_addr/hlfir.elemental so that we are able to create
// temporary storage for it.
if (partInfo.base && partInfo.base->isPolymorphic())
TODO(loc, "vector subscripted polymorphic entity in HLFIR");
// The type parameters to be added on the hlfir.elemental_addr are the ones
// of the whole designator (not the ones of the vector subscripted part).
// These are not yet known and will be added when finalizing the designator
Expand Down Expand Up @@ -1365,6 +1370,11 @@ class HlfirBuilder {
// Elemental expression.
mlir::Type elementType;
if constexpr (R::category == Fortran::common::TypeCategory::Derived) {
// TODO: need to pass a mold to hlfir.elemental for polymorphic arrays
// if using hlfir.elemental here so that it can get the dynamic type
// info.
if (left.isPolymorphic())
TODO(loc, "parenthesized polymorphic arrays in HLFIR");
elementType = Fortran::lower::translateDerivedTypeToFIRType(
getConverter(), op.derived().GetType().GetDerivedTypeSpec());
} else {
Expand Down

0 comments on commit 2a9126d

Please sign in to comment.