[llvm] [ConstantRange] Bail out early in unsignedMulMayOverflow for wide integer types (PR #192275)
Max Graey via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 17 10:11:11 PDT 2026
================
@@ -2022,9 +2051,43 @@ APInt APInt::umul_ov(const APInt &RHS, bool &Overflow) const {
if (Res.ult(RHS))
Overflow = true;
}
+
return Res;
}
+bool APInt::umul_has_overflow(const APInt &RHS) const {
----------------
MaxGraey wrote:
Add similar path as `APInt::umul_ov`
```suggestion
bool APInt::umul_has_overflow(const APInt &RHS) const {
if (BitWidth == 0)
return false;
```
which make `BitWidth - 1` later valid for all bit widths
https://github.com/llvm/llvm-project/pull/192275
More information about the llvm-commits
mailing list