[llvm] [InstCombine] Add optimization to combine adds through zext nneg, and add testcase (PR #157723)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 19 08:38:04 PDT 2025
================
@@ -1910,6 +1910,33 @@ Instruction *InstCombinerImpl::visitAdd(BinaryOperator &I) {
if (Instruction *Res = foldBinOpOfSelectAndCastOfSelectCondition(I))
return Res;
+ {
+ Value *X;
+ const APInt *C1, *C2;
+ if (match(&I, m_c_Add(m_NNegZExt(m_Add(m_Value(X), m_APInt(C1))),
----------------
dtcxzyw wrote:
```suggestion
if (match(&I, m_Add(m_NNegZExt(m_Add(m_Value(X), m_APInt(C1))),
```
https://github.com/llvm/llvm-project/pull/157723
More information about the llvm-commits
mailing list