[flang-commits] [flang] 2a9126d - [flang][hlfir] Add TODO for polymorphic vector subscripted entities

Jean Perier via flang-commits flang-commits at lists.llvm.org
Sun May 7 07:26:50 PDT 2023


Author: Jean Perier
Date: 2023-05-07T16:25:50+02:00
New Revision: 2a9126d40dfbc384692f707def114b4e5b43e239

URL: https://github.com/llvm/llvm-project/commit/2a9126d40dfbc384692f707def114b4e5b43e239
DIFF: https://github.com/llvm/llvm-project/commit/2a9126d40dfbc384692f707def114b4e5b43e239.diff

LOG: [flang][hlfir] Add TODO for polymorphic vector subscripted entities

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

Added: 
    

Modified: 
    flang/lib/Lower/ConvertExprToHLFIR.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Lower/ConvertExprToHLFIR.cpp b/flang/lib/Lower/ConvertExprToHLFIR.cpp
index 87c0099814fa8..b5bee6b94543e 100644
--- a/flang/lib/Lower/ConvertExprToHLFIR.cpp
+++ b/flang/lib/Lower/ConvertExprToHLFIR.cpp
@@ -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
@@ -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 {


        


More information about the flang-commits mailing list