[llvm] [DAGCombiner] Fold insert_vector_elt into a shared BUILD_VECTOR with undef lanes (PR #210905)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 21 01:14:33 PDT 2026
================
@@ -999,6 +999,14 @@ class LLVM_ABI TargetLoweringBase {
return false;
}
+ /// Return true if folding INSERT_VECTOR_ELT into a fresh BUILD_VECTOR is
+ /// profitable even when the source BUILD_VECTOR has multiple uses (which
+ /// un-shares it). This helps targets where BUILD_VECTOR is cheap glue (e.g.
+ /// lowered to REG_SEQUENCE) by avoiding copies of a shared poison-padded
+ /// base; targets where a vector copy is cheaper should keep the default and
+ /// retain the sharing.
+ virtual bool shouldUnshareBuildVectorForInsertElt(EVT) const { return false; }
----------------
arsenm wrote:
Don't introduce a new target hook. We already have too many for vector profitability, like here you probably want aggressivelyPreferBuildVectorSources
https://github.com/llvm/llvm-project/pull/210905
More information about the llvm-commits
mailing list