diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp --- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp +++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp @@ -2049,9 +2049,9 @@ Value v1, Value v2, ArrayAttr mask, ArrayRef attrs) { auto containerType = v1.getType(); - auto vType = LLVM::getVectorType( - LLVM::getVectorElementType(containerType), mask.size(), - containerType.cast().isScalable()); + auto vType = LLVM::getVectorType(LLVM::getVectorElementType(containerType), + mask.size(), + LLVM::isScalableVectorType(containerType)); build(b, result, vType, v1, v2, mask); result.addAttributes(attrs); } diff --git a/mlir/test/Target/LLVMIR/Import/incorrect-scalable-vector-check.ll b/mlir/test/Target/LLVMIR/Import/incorrect-scalable-vector-check.ll new file mode 100644 --- /dev/null +++ b/mlir/test/Target/LLVMIR/Import/incorrect-scalable-vector-check.ll @@ -0,0 +1,8 @@ +; RUN: mlir-translate --import-llvm %s | FileCheck %s + +; CHECK: llvm.func @shufflevector_crash +define void @shufflevector_crash(<2 x i32*> %arg0) { + ; CHECK: llvm.shufflevector %{{.+}}, %{{.+}} [1 : i32, 0 : i32] : !llvm.vec<2 x ptr>, !llvm.vec<2 x ptr> + %1 = shufflevector <2 x i32*> %arg0, <2 x i32*> undef, <2 x i32> + ret void +}