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

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 10 11:06:29 PDT 2025


================
@@ -6515,72 +6515,76 @@ 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/multiplication with call to the right intrinsic.
 ///
 /// \param I Compare instruction.
-/// \param MulVal Result of 'mult' instruction.  It is one of the arguments of
+/// \param Val Result of add/mul instruction.  It is one of the arguments of
 ///               the compare instruction.  Must be of integer type.
----------------
topperc wrote:

This line should have 3 spaces removes so "the" lines up with "Result" on the previous line like it used to.

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


More information about the llvm-commits mailing list