| Issue |
169118
|
| Summary |
[SLP] ExtractElement Cost Calculation
|
| Labels |
new issue
|
| Assignees |
bababuck
|
| Reporter |
bababuck
|
I noticed we calculate the extraction cost differently in different places, I'm curious why we would want to use different models at these different times.
When we are trying to include an ExtractElement instruction in our Vector Chain (`SLPVectorizer.cpp::14677`). This was updated in #125725
```
auto GetVectorCost = [&, &TTI = *TTI](InstructionCost CommonCost) {
return CommonCost - (DemandedElts.isZero()
? TTI::TCC_Free
: TTI.getScalarizationOverhead(
SrcVecTy, DemandedElts, /*Insert=*/false,
/*Extract=*/true, CostKind));
};
```
But when we have an external use that will require an ExtractElement (`SLPVectorizer.cpp::16305`):
```
ExtraCost =
getVectorInstrCost(*TTI, ScalarTy, Instruction::ExtractElement, VecTy,
CostKind, EU.Lane, EU.Scalar, ScalarUserAndIdx);
```
For `class TargetTransformInfoImplBase`:
```
virtual InstructionCost getScalarizationOverhead(
VectorType *Ty, const APInt &DemandedElts, bool Insert, bool Extract,
TTI::TargetCostKind CostKind, bool ForPoisonSrc = true,
ArrayRef<Value *> VL = {}) const {
return 0;
}
...
virtual InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val,
TTI::TargetCostKind CostKind,
unsigned Index, const Value *Op0,
const Value *Op1) const {
return 1;
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs