diff --git a/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp b/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp --- a/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp +++ b/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp @@ -1186,7 +1186,7 @@ continue; } APInt index; - if (!matchPattern(*operandsIt, m_ConstantInt(&index))) { + if (!matchPattern(*operandsIt, m_ConstantInt(&index)) || index.getSExtValue() < 1) { newShape.push_back(ShapedType::kDynamic); newOperands.push_back(*operandsIt++); continue;