[llvm] Add more cases for computeOverflowForSignedAdd (PR #99900)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 27 16:20:23 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
----------------
AtariDreams wrote:

If 0x3fffffff is the top value, then how is 0x40000000 not valid signed in 32 bits?

https://github.com/llvm/llvm-project/pull/99900


More information about the llvm-commits mailing list