[llvm] [InstCombine] Fold extended add/sub of the same type (PR #185259)

Andreas Jonson via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 8 04:37:16 PDT 2026


================
@@ -1081,6 +1081,28 @@ Instruction *InstCombinerImpl::visitTrunc(TruncInst &Trunc) {
 
   Value *A, *B;
   Constant *C;
+  ConstantInt *CInt;
+
+  if (match(Src, m_UMin(m_Add(m_ZExt(m_Value(A)), m_ZExt(m_Value(B))),
----------------
andjo403 wrote:

missing m_OneUse around m_UMin maybe also for the m_Add. you need som test with multiple uses of the different instructions to see when it is profitable to make the fold.

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


More information about the llvm-commits mailing list