[llvm] [InstCombine] Use existing `(icmp pred (add x, y), C)` folds with `or disjoint` (PR #87937)

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 8 21:28:05 PDT 2024


================
@@ -2986,10 +2986,10 @@ Instruction *InstCombinerImpl::foldICmpAddConstant(ICmpInst &Cmp,
   Value *Op0, *Op1;
   Instruction *Ext0, *Ext1;
   const CmpInst::Predicate Pred = Cmp.getPredicate();
-  if (match(Add,
-            m_Add(m_CombineAnd(m_Instruction(Ext0), m_ZExtOrSExt(m_Value(Op0))),
-                  m_CombineAnd(m_Instruction(Ext1),
-                               m_ZExtOrSExt(m_Value(Op1))))) &&
+  if (match(Add, m_AddLike(m_CombineAnd(m_Instruction(Ext0),
----------------
goldsteinn wrote:

Alright, ill sit on this for a bit, if he gets back in the next month or so ill close. Ill pull out the `add nuw` patch.

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


More information about the llvm-commits mailing list