[llvm] [LLVM][DAGCombiner][SVE] Fold vselect into merge_pasthru_op. (PR #146917)
Paul Walker via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 3 10:28:06 PDT 2025
================
@@ -25531,6 +25534,22 @@ static SDValue performVSelectCombine(SDNode *N, SelectionDAG &DAG) {
if (isAllInactivePredicate(N0))
return N->getOperand(2);
+ if (isMergePassthruOpcode(IfTrue.getOpcode()) && IfTrue.hasOneUse()) {
+ // vselect A, (merge_pasthru_op all_active, B,{Bn,} -), C
+ // vselect A, (merge_pasthru_op -, B,{Bn,} undef), C
+ // vselect A, (merge_pasthru_op A, B,{Bn,} -), C
+ // -> merge_pasthru_op A, B,{Bn,} C
+ if (isAllActivePredicate(DAG, IfTrue->getOperand(0)) ||
+ IfTrue->getOperand(IfTrue.getNumOperands() - 1).isUndef() ||
+ IfTrue->getOperand(0) == N0) {
----------------
paulwalker-arm wrote:
Whilst striving to extend the isel test coverage I've forgotten to test the DAG combine itself. I'll add tests to trigger the three cases.
https://github.com/llvm/llvm-project/pull/146917
More information about the llvm-commits
mailing list