[llvm] [InstCombine] Constant fold binops through `vector.insert` (PR #164624)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 23 04:04:26 PDT 2025


================
@@ -2323,6 +2323,32 @@ Constant *InstCombinerImpl::unshuffleConstant(ArrayRef<int> ShMask, Constant *C,
   return ConstantVector::get(NewVecC);
 }
 
+// Match a vector.insert where both the destination and subvector are constant.
+static bool matchConstantSubVector(Value *V, Constant *&Dest,
+                                   Constant *&SubVector, Value *&Idx) {
+  return match(V, m_Intrinsic<Intrinsic::vector_insert>(
+                      m_Constant(Dest), m_Constant(SubVector), m_Value(Idx)));
+}
----------------
paulwalker-arm wrote:

Can you add something like m_VectorInsert to PatternMatch instead? and use that inline.

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


More information about the llvm-commits mailing list