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

via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 8 08:56:05 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))),
----------------
sweiglbosker wrote:

Use commutative add matcher here. Also i think this uadd.sat fold should also work with smin

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


More information about the llvm-commits mailing list