[llvm] [InstCombine] Canonicalize more saturated add variants (PR #100008)

Rose Silicon via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 28 12:10:00 PDT 2024


================
@@ -996,6 +989,30 @@ static Value *canonicalizeSaturatedAdd(ICmpInst *Cmp, Value *TVal, Value *FVal,
   if (!match(TVal, m_AllOnes()))
     return nullptr;
 
+  if ((Pred == ICmpInst::ICMP_UGE || Pred == ICmpInst::ICMP_UGT) &&
+      match(FVal, m_Add(m_Specific(Cmp0), m_APInt(C))) &&
+      match(Cmp1, m_SpecificIntAllowPoison(~*C))) {
----------------
RSilicon wrote:

See: uadd_sat_poison

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


More information about the llvm-commits mailing list