diff --git a/mlir/lib/IR/BuiltinTypes.cpp b/mlir/lib/IR/BuiltinTypes.cpp index ce47c60c9b932..280ab437c1bd5 100644 --- a/mlir/lib/IR/BuiltinTypes.cpp +++ b/mlir/lib/IR/BuiltinTypes.cpp @@ -285,8 +285,10 @@ VectorType VectorType::scaleElementBitwidth(unsigned scale) { VectorType VectorType::cloneWith(std::optional> shape, Type elementType) const { - return VectorType::get(shape.value_or(getShape()), elementType, - getScalableDims()); + auto shapeVal = shape.value_or(getShape()); + SmallVector scalableDims(getScalableDims()); + scalableDims.resize(shapeVal.size(), false); + return VectorType::get(shapeVal, elementType, scalableDims); } //===----------------------------------------------------------------------===//