diff --git a/src/arith/const_fold.h b/src/arith/const_fold.h index 7bc04a184633..0e675c6806a2 100644 --- a/src/arith/const_fold.h +++ b/src/arith/const_fold.h @@ -108,6 +108,9 @@ inline PrimExpr TryConstFold(PrimExpr a, PrimExpr b) { template <> inline PrimExpr TryConstFold(PrimExpr a, PrimExpr b) { TVM_ARITH_CONST_PROPAGATION({ + ICHECK(!(pa && pa->dtype.is_uint() && pa->value == 0U && b.dtype().is_uint())) + << "Checked failed. Minuend 's value is 0U and it's dtype is uint " + << "while Subtrahend's dtype is uint; which will cause a negative uint"; const DataType& rtype = a.dtype(); if (pa && pb) return IntImm(rtype, pa->value - pb->value); if (pb && pb->value == 0) return a;