[llvm] [SLP] Inefficient cost-modelling and codegen for reductions with slp-… (PR #197875)
Sushant Gokhale via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 9 17:55:36 PDT 2026
================
@@ -30379,19 +30402,13 @@ class HorizontalReduction {
if (auto *VecTy = dyn_cast<FixedVectorType>(ScalarTy)) {
assert(SLPReVec && "FixedVectorType is not expected.");
unsigned ScalarTyNumElements = VecTy->getNumElements();
- for (unsigned I : seq<unsigned>(ReducedVals.size())) {
- VectorCost += TTI->getShuffleCost(
- TTI::SK_PermuteSingleSrc,
- FixedVectorType::get(VecTy->getScalarType(),
- ReducedVals.size()),
- VectorTy,
- createStrideMask(I, ScalarTyNumElements, ReducedVals.size()));
- VectorCost += TTI->getArithmeticReductionCost(RdxOpcode, VecTy,
- FMF, CostKind);
+ for (unsigned I : seq<unsigned>(ReducedVals.size() - 1)) {
+ VectorCost +=
+ ::getShuffleCost(*TTI, TTI::SK_ExtractSubvector, VectorTy, {},
+ CostKind, I * ScalarTyNumElements, VecTy);
+ VectorCost +=
+ TTI->getArithmeticInstrCost(RdxOpcode, VecTy, CostKind);
----------------
sushgokh wrote:
done
https://github.com/llvm/llvm-project/pull/197875
More information about the llvm-commits
mailing list