diff --git a/mlir/lib/IR/BuiltinTypes.cpp b/mlir/lib/IR/BuiltinTypes.cpp --- a/mlir/lib/IR/BuiltinTypes.cpp +++ b/mlir/lib/IR/BuiltinTypes.cpp @@ -801,10 +801,12 @@ ? getAffineSymbolExpr(nSymbols++, context) : getAffineConstantExpr(runningSize, context); expr = expr ? expr + dimExpr * stride : dimExpr * stride; - if (size > 0) + if (size > 0) { runningSize *= size; - else + assert(runningSize > 0 && "integer overflow in size computation"); + } else { dynamicPoisonBit = true; + } } return simplifyAffineExpr(expr, numDims, nSymbols); }