[llvm] [SelectionDAG] Convert to or mask if all insertions are -1 (PR #138213)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri May 2 05:06:16 PDT 2025
================
@@ -22987,6 +22986,19 @@ SDValue DAGCombiner::visitINSERT_VECTOR_ELT(SDNode *N) {
DAG.getBuildVector(VT, DL, Mask));
}
+ // If all insertions are -1, try to convert to OR mask.
+ if (!LegalOperations && llvm::isAllOnesConstant(InVal) &&
+ all_of(Ops, [InVal](SDValue Op) { return !Op || Op == InVal; }) &&
+ count_if(Ops, [InVal](SDValue Op) { return Op == InVal; }) >= 2) {
----------------
arsenm wrote:
Most of this is the same as the previous, merge them?
https://github.com/llvm/llvm-project/pull/138213
More information about the llvm-commits
mailing list