From 82a02a4c667cbbd7006a620520c1d253424536c4 Mon Sep 17 00:00:00 2001 From: lipracer Date: Thu, 12 Jun 2025 19:12:26 +0800 Subject: [PATCH] [NFC][mlir] make the assert consistent with the declared behavior --- mlir/include/mlir/ExecutionEngine/MemRefUtils.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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]; }