Index: mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp =================================================================== --- mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp +++ mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp @@ -464,7 +464,7 @@ if (type.getShape().empty()) return VectorType::get({1}, elementType); Type vectorType = VectorType::get(type.getShape().back(), elementType, - type.getNumScalableDims()); + type.isScalable()); assert(LLVM::isCompatibleVectorType(vectorType) && "expected vector type compatible with the LLVM dialect"); auto shape = type.getShape(); Index: mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir =================================================================== --- mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir +++ mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir @@ -112,6 +112,21 @@ // ----- +func.func @broadcast_scalable_vec2d_from_scalar(%arg0: f32) -> vector<[2x3]xf32> { + %0 = vector.broadcast %arg0 : f32 to vector<[2x3]xf32> + return %0 : vector<[2x3]xf32> +} +// CHECK-LABEL: @broadcast_scalable_vec2d_from_scalar( +// CHECK-SAME: %[[A:.*]]: f32) +// CHECK: %[[T0:.*]] = llvm.insertelement %[[A]] +// CHECK: %[[T1:.*]] = llvm.shufflevector %[[T0]] +// CHECK: %[[T2:.*]] = llvm.insertvalue %[[T1]], %{{.*}}[0] : !llvm.array<2 x vector<[3]xf32>> +// CHECK: %[[T3:.*]] = llvm.insertvalue %[[T1]], %{{.*}}[1] : !llvm.array<2 x vector<[3]xf32>> +// CHECK: %[[T4:.*]] = builtin.unrealized_conversion_cast %[[T3]] : !llvm.array<2 x vector<[3]xf32>> to vector<[2x3]xf32> +// CHECK: return %[[T4]] : vector<[2x3]xf32> + +// ----- + func.func @broadcast_vec3d_from_scalar(%arg0: f32) -> vector<2x3x4xf32> { %0 = vector.broadcast %arg0 : f32 to vector<2x3x4xf32> return %0 : vector<2x3x4xf32>