diff --git a/mlir/include/mlir/ExecutionEngine/MemRefUtils.h b/mlir/include/mlir/ExecutionEngine/MemRefUtils.h index 918647d9feac3..f355dfb8648ec 100644 --- a/mlir/include/mlir/ExecutionEngine/MemRefUtils.h +++ b/mlir/include/mlir/ExecutionEngine/MemRefUtils.h @@ -48,7 +48,8 @@ inline std::array makeStrides(ArrayRef shape) { std::array res; int64_t running = 1; for (int64_t idx = N - 1; idx >= 0; --idx) { - assert(shape[idx] && "size must be non-negative for all shape dimensions"); + assert(shape[idx] >= 0 && + "size must be non-negative for all shape dimensions"); res[idx] = running; running *= shape[idx]; }