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

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 28 12:34:30 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:

You've been asked multiple times to stop resolving conversations with your reply.

0x8000000 is a negative number, but two negatives multiplied together is a positive number. 0x8000000*0x80000000 is 0x4000000000000000 a positive number.



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


More information about the llvm-commits mailing list