diff --git a/mlir/lib/Dialect/SPIRV/Transforms/UnifyAliasedResourcePass.cpp b/mlir/lib/Dialect/SPIRV/Transforms/UnifyAliasedResourcePass.cpp --- a/mlir/lib/Dialect/SPIRV/Transforms/UnifyAliasedResourcePass.cpp +++ b/mlir/lib/Dialect/SPIRV/Transforms/UnifyAliasedResourcePass.cpp @@ -506,8 +506,9 @@ dstElemVecType.getElementType()) { int64_t count = dstNumBytes / (srcElemVecType.getElementTypeBitWidth() / 8); - auto castType = - VectorType::get({count}, srcElemVecType.getElementType()); + auto castType = srcElemVecType.getElementType(); + if (count > 1) + castType = VectorType::get({count}, castType); for (auto &c : components) c = rewriter.create(loc, castType, c); }