[llvm] [RISCV][Isel] Remove redundant vmerge for the scalable vwadd(u).wv (PR #80079)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 22:22:58 PST 2024


================
@@ -13795,13 +13798,22 @@ static SDValue combineVWADDWSelect(SDNode *N, SelectionDAG &DAG) {
 
   // False value of MergeOp should be all zeros
   SDValue Z = MergeOp->getOperand(2);
-  if (Z.getOpcode() != ISD::INSERT_SUBVECTOR)
-    return SDValue();
-  if (!ISD::isBuildVectorAllZeros(Z.getOperand(1).getNode()))
-    return SDValue();
-  if (!isNullOrNullSplat(Z.getOperand(0)) && !Z.getOperand(0).isUndef())
+
+  // Scalable vector
+  if (MergeOpc == ISD::VSELECT &&
+      !ISD::isConstantSplatVectorAllZeros(Z.getNode()))
----------------
lukel97 wrote:

But for the fixed length vector case aren't we checking for a build_vector anyway? 

I think we could unify the paths if we first tried to unwrap Z like this:
(insert_subvector null/undef, build_vector ...) -> (build_vector ...)


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


More information about the llvm-commits mailing list