[llvm] [SLP]: Introduce and use getDataFlowCost (PR #112999)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 21 15:35:36 PDT 2024
================
@@ -9222,6 +9223,18 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
OpTE->Scalars.size());
}
+ // Calculate the cost difference of propagating a vector vs series of
+ // scalars across blocks. This may be nonzero in the case of illegal
+ // vectors.
+ Type *ScalarTy = VL0->getType()->getScalarType();
+ if (ScalarTy && isValidElementType(ScalarTy)) {
+ ScalarCost += TTI->getDataFlowCost(ScalarTy,
+ /*IsCallingConv=*/false) *
+ EntryVF;
+ CommonCost += TTI->getDataFlowCost(
+ FixedVectorType::get(ScalarTy, EntryVF), /*IsCallingConv=*/false);
----------------
alexey-bataev wrote:
```suggestion
ScalarCost += TTI->getDataFlowCost(ScalarTy,
/*IsCallingConv=*/false) *
EntryVF;
CommonCost += TTI->getDataFlowCost(
VecTy, /*IsCallingConv=*/false);
```
https://github.com/llvm/llvm-project/pull/112999
More information about the llvm-commits
mailing list