[Mlir-commits] [mlir] [mlir][shape] Fix crash in ShapeOfOpToConstShapeOp (PR #180737)
Matthias Springer
llvmlistbot at llvm.org
Tue Feb 10 06:25:03 PST 2026
================
@@ -1706,14 +1706,18 @@ struct ShapeOfOpToConstShapeOp : public OpRewritePattern<shape::ShapeOfOp> {
auto type = llvm::dyn_cast<ShapedType>(op.getArg().getType());
if (!type || !type.hasStaticShape())
return failure();
+ Type resultType = op.getResult().getType();
+ if (isa<ShapeType>(resultType))
----------------
matthias-springer wrote:
Do we really have to bail here? You can create a `ConstShapeOp` with `!shape.shape`, at least I can see it in the docs:
```mlir
%0 = shape.const_shape [] : !shape.shape
%1 = shape.const_shape [1, 2, 3] : !shape.shape
%2 = shape.const_shape [4, 5, 6] : tensor<3xindex>
```
https://github.com/llvm/llvm-project/pull/180737
More information about the Mlir-commits
mailing list