[flang-commits] [PATCH] D149970: [flang][hlfir] Add TODO for polymorphic vector subscripted entities

Jean Perier via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri May 5 09:16:34 PDT 2023


jeanPerier created this revision.
jeanPerier added a reviewer: vzakhari.
jeanPerier added a project: Flang.
Herald added subscribers: sunshaoce, mehdi_amini, jdoerfert.
Herald added a project: All.
jeanPerier requested review of this revision.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149970

Files:
  flang/lib/Lower/ConvertExprToHLFIR.cpp


Index: flang/lib/Lower/ConvertExprToHLFIR.cpp
===================================================================
--- flang/lib/Lower/ConvertExprToHLFIR.cpp
+++ flang/lib/Lower/ConvertExprToHLFIR.cpp
@@ -729,6 +729,11 @@
       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 @@
     // 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 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149970.519892.patch
Type: text/x-patch
Size: 1514 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230505/bc8e2104/attachment-0001.bin>


More information about the flang-commits mailing list