[llvm] [InstCombine] Detect uadd with overflow idiom (PR #140178)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed May 21 17:52:13 PDT 2025


================
@@ -6515,72 +6515,75 @@ bool InstCombinerImpl::OptimizeOverflowCheck(Instruction::BinaryOps BinaryOp,
   llvm_unreachable("Unexpected overflow result");
 }
 
-/// Recognize and process idiom involving test for multiplication
+/// Recognize and process idiom involving test for unsigned
 /// overflow.
 ///
 /// The caller has matched a pattern of the form:
+///   I = cmp u (add(zext A, zext B), V
 ///   I = cmp u (mul(zext A, zext B), V
 /// The function checks if this is a test for overflow and if so replaces
-/// multiplication with call to 'mul.with.overflow' intrinsic.
+/// addition with call to the right intrinsic.
----------------
topperc wrote:

addition -> addition/multiplication?

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


More information about the llvm-commits mailing list