[Mlir-commits] [mlir] [mlir] Fix VectorType clone with shape of a different rank (PR #173007)
Andrey Pavlenko
llvmlistbot at llvm.org
Fri Dec 19 06:09:12 PST 2025
https://github.com/AndreyPavlenko created https://github.com/llvm/llvm-project/pull/173007
If the new shape has a different number of dims, VectorType::verify() fail with error: 'number of dims must match'.
>From d71ac2265e63be8c2d32bf1c225c3fedadc92d19 Mon Sep 17 00:00:00 2001
From: Andrey Pavlenko <andrey.a.pavlenko at gmail.com>
Date: Fri, 19 Dec 2025 14:02:52 +0000
Subject: [PATCH] Fix VectorType clone with shape of a different rank
If the new shape has a different number of dims, VectorType::verify
fai with error: 'number of dims must match'.
---
mlir/lib/IR/BuiltinTypes.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
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<ArrayRef<int64_t>> shape,
Type elementType) const {
- return VectorType::get(shape.value_or(getShape()), elementType,
- getScalableDims());
+ auto shapeVal = shape.value_or(getShape());
+ SmallVector<bool> scalableDims(getScalableDims());
+ scalableDims.resize(shapeVal.size(), false);
+ return VectorType::get(shapeVal, elementType, scalableDims);
}
//===----------------------------------------------------------------------===//
More information about the Mlir-commits
mailing list