[llvm] [InstCombine] Fold uadd.sat comparison using known operand relation (PR #212776)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 29 22:50:50 PDT 2026


================
@@ -4095,6 +4095,49 @@ Instruction *InstCombinerImpl::foldICmpBinOpWithConstant(ICmpInst &Cmp,
   return foldICmpBinOpWithConstantViaTruthTable(Cmp, BO, C);
 }
 
+/// Fold uadd.sat(X, C) <u C2 to X <u C2 - C when C2 >=u C is
+/// known to hold.
----------------
ParkHanbum wrote:

Please take a look at this patch: https://github.com/llvm/llvm-project/commit/23f0f061c399a51b9c846a7aaab1c15ce039e1a3

InstCombine already has a function for handling `icmp`, so this should be implemented there.


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


More information about the llvm-commits mailing list