[llvm] [InstCombine] Constant fold binops through `vector.insert` (PR #164624)
Benjamin Maxwell via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 23 05:26:55 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)));
+}
----------------
MacDue wrote:
Added some matching utils for this :+1:
https://github.com/llvm/llvm-project/pull/164624
More information about the llvm-commits
mailing list