[flang-commits] [flang] [FIR] add a fir.shape_extents operation (PR #199361)
via flang-commits
flang-commits at lists.llvm.org
Tue Jun 2 01:44:00 PDT 2026
================
@@ -316,6 +323,36 @@ void FIRToMemRef::populateShape(SmallVectorImpl<Value> &vec,
vec.append(shape.getExtents().begin(), shape.getExtents().end());
}
+bool FIRToMemRef::materializeShapeExtents(
+ Value shapeVal, PatternRewriter &rewriter, Location loc,
+ SmallVectorImpl<Value> &shapeVec) const {
+ if (!shapeVal)
+ return false;
+
+ while (auto convertOp = shapeVal.getDefiningOp<fir::ConvertOp>())
+ shapeVal = convertOp.getOperand();
+
+ if (auto shapeOp = shapeVal.getDefiningOp<fir::ShapeOp>()) {
+ shapeVec.append(shapeOp.getExtents().begin(), shapeOp.getExtents().end());
+ return true;
+ }
+
+ if (auto extentsOp = shapeVal.getDefiningOp<fir::ShapeExtentsOp>()) {
----------------
jeanPerier wrote:
I am lost at what `shapeVal` is supposed to be here, is it a fir.shape or an extent?
https://github.com/llvm/llvm-project/pull/199361
More information about the flang-commits
mailing list