[llvm] [SLP]Support vectorization of previously vectorized scalars in split nodes (PR #134286)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 10 02:56:43 PDT 2025


================
@@ -9248,22 +9248,26 @@ bool BoUpSLP::canBuildSplitNode(ArrayRef<Value *> VL,
   // as alternate ops.
   if (NumParts >= VL.size())
     return false;
+  constexpr TTI::TargetCostKind Kind = TTI::TCK_RecipThroughput;
+  InstructionCost InsertCost = ::getShuffleCost(
+      *TTI, TTI::SK_InsertSubvector, VecTy, {}, Kind, Op1.size(), Op2VecTy);
+  FixedVectorType *SubVecTy =
+      getWidenedType(ScalarTy, std::max(Op1.size(), Op2.size()));
+  InstructionCost NewShuffleCost =
+      ::getShuffleCost(*TTI, TTI::SK_PermuteTwoSrc, SubVecTy, Mask, Kind);
+  if (LocalState.getOpcode() != Instruction::ICmp &&
+      LocalState.getOpcode() != Instruction::FCmp &&
+      LocalState.getAltOpcode() != Instruction::ICmp &&
+      LocalState.getAltOpcode() != Instruction::FCmp && NumParts <= 1 &&
----------------
RKSimon wrote:

Add a InstructionsState::isCmpOp helper?

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


More information about the llvm-commits mailing list