[llvm] Add more cases for computeOverflowForSignedAdd (PR #99900)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 27 18:12:34 PDT 2024
================
@@ -4242,8 +4242,19 @@ SelectionDAG::computeOverflowForSignedAdd(SDValue N0, SDValue N1) const {
if (ComputeNumSignBits(N0) > 1 && ComputeNumSignBits(N1) > 1)
return OFK_Never;
- // TODO: Add ConstantRange::signedAddMayOverflow handling.
- return OFK_Sometime;
+ // smulhi + any value never overflow
----------------
topperc wrote:
> The useful thing you know about smulhi is that it is in a restricted range, e.g. (for 32 bits) -0x40000000 to +0x3fffffff.
Isn't the maximum positive value 0x40000000 from 0x8000000*0x8000000?
https://github.com/llvm/llvm-project/pull/99900
More information about the llvm-commits
mailing list