llvm-project
de109db6 - [mlir][IntRange] Avoid division by zero for empty divisor ranges in divs (#234159)

Commit
2 days ago
[mlir][IntRange] Avoid division by zero for empty divisor ranges in divs (#234159) inferSub can produce an empty range (smin > smax) when both nsw and nuw saturate, e.g. for `arith.subi 0, 1 overflow<nsw, nuw>`, whose result is poison. inferDivSRange only checked rhsMax.isNegative() to rule out a zero divisor, so it then evaluated sdiv with rhsMin == 0 and asserted in APInt::udiv. Treat an empty divisor range as unknown and return the max range instead. Fixes #231845
Author
Parents
Loading