diff --git a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp --- a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp +++ b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp @@ -698,8 +698,8 @@ extents[pos] = getAffineConstantExpr(v.getShape()[idx], ctx); } } - assert(llvm::all_of(extents, [](AffineExpr e) { return e; }) && - "expected extent along all dimensions."); + if (!llvm::all_of(extents, [](AffineExpr e) { return e; })) + return op.emitOpError("Some input dimensions are used by neither the LHS nor the RHS."); AffineMap resMap = op.getIndexingMaps()[2]; auto extentsMap = AffineMap::get(/*dimCount=*/extents.size(),