[llvm] [LV] Add initial support for vectorizing literal struct return values (PR #109833)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 3 09:47:25 PDT 2024
================
@@ -5452,10 +5453,13 @@ InstructionCost LoopVectorizationCostModel::computePredInstDiscount(
// and phi nodes.
TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput;
if (isScalarWithPredication(I, VF) && !I->getType()->isVoidTy()) {
- ScalarCost += TTI.getScalarizationOverhead(
- cast<VectorType>(ToVectorTy(I->getType(), VF)),
- APInt::getAllOnes(VF.getFixedValue()), /*Insert*/ true,
- /*Extract*/ false, CostKind);
+ Type *WideTy = ToWideTy(I->getType(), VF);
+ for (Type *VectorTy : getContainedTypes(WideTy)) {
+ ScalarCost += TTI.getScalarizationOverhead(
+ cast<VectorType>(VectorTy), APInt::getAllOnes(VF.getFixedValue()),
+ /*Insert*/ true,
+ /*Extract*/ false, CostKind);
----------------
arsenm wrote:
```suggestion
/*Insert=*/ true,
/*Extract=*/ false, CostKind);
```
https://github.com/llvm/llvm-project/pull/109833
More information about the llvm-commits
mailing list