[flang-commits] [flang] 08b09d7 - [flang][hlfir] get shape from HLFIR expr using hlfir.shape_of

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Mon Apr 17 06:28:00 PDT 2023


Author: Tom Eccles
Date: 2023-04-17T13:25:54Z
New Revision: 08b09d79b129d98c79fd9827e80b147582f2f900

URL: https://github.com/llvm/llvm-project/commit/08b09d79b129d98c79fd9827e80b147582f2f900
DIFF: https://github.com/llvm/llvm-project/commit/08b09d79b129d98c79fd9827e80b147582f2f900.diff

LOG: [flang][hlfir] get shape from HLFIR expr using hlfir.shape_of

Depends On: D146830

Differential Revision: https://reviews.llvm.org/D146831

Added: 
    

Modified: 
    flang/lib/Optimizer/Builder/HLFIRTools.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Optimizer/Builder/HLFIRTools.cpp b/flang/lib/Optimizer/Builder/HLFIRTools.cpp
index 072fb5c0fc27e..5fdf9928b244b 100644
--- a/flang/lib/Optimizer/Builder/HLFIRTools.cpp
+++ b/flang/lib/Optimizer/Builder/HLFIRTools.cpp
@@ -483,7 +483,7 @@ mlir::Value hlfir::genShape(mlir::Location loc, fir::FirOpBuilder &builder,
         return builder.create<fir::ShapeOp>(loc, s.getExtents());
   }
   if (entity.getType().isa<hlfir::ExprType>())
-    TODO(loc, "get shape from HLFIR expr without producer holding the shape");
+    return builder.create<hlfir::ShapeOfOp>(loc, entity.getBase());
   // There is no shape lying around for this entity. Retrieve the extents and
   // build a new fir.shape.
   return builder.create<fir::ShapeOp>(loc,


        


More information about the flang-commits mailing list