-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Open
Labels
llvm:SLPVectorizerquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!
Description
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;
}
Metadata
Metadata
Assignees
Labels
llvm:SLPVectorizerquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!