[BasicTTI] Add missing scalable vector handling
BasicTTI needs to return an invalid cost for scalable vectors instead of crash. Without this, it is impossible to write tests for missing functionality in a target.
This commit is contained in:
parent
47039a1a4b
commit
c1fb8bd777
|
|
@ -2130,6 +2130,11 @@ public:
|
|||
/// vector is reduced on each iteration.
|
||||
InstructionCost getTreeReductionCost(unsigned Opcode, VectorType *Ty,
|
||||
TTI::TargetCostKind CostKind) {
|
||||
// Targets must implement a default value for the scalable case, since
|
||||
// we don't know how many lanes the vector has.
|
||||
if (isa<ScalableVectorType>(Ty))
|
||||
return InstructionCost::getInvalid();
|
||||
|
||||
Type *ScalarTy = Ty->getElementType();
|
||||
unsigned NumVecElts = cast<FixedVectorType>(Ty)->getNumElements();
|
||||
if ((Opcode == Instruction::Or || Opcode == Instruction::And) &&
|
||||
|
|
@ -2228,6 +2233,11 @@ public:
|
|||
InstructionCost getMinMaxReductionCost(VectorType *Ty, VectorType *CondTy,
|
||||
bool IsUnsigned,
|
||||
TTI::TargetCostKind CostKind) {
|
||||
// Targets must implement a default value for the scalable case, since
|
||||
// we don't know how many lanes the vector has.
|
||||
if (isa<ScalableVectorType>(Ty))
|
||||
return InstructionCost::getInvalid();
|
||||
|
||||
Type *ScalarTy = Ty->getElementType();
|
||||
Type *ScalarCondTy = CondTy->getElementType();
|
||||
unsigned NumVecElts = cast<FixedVectorType>(Ty)->getNumElements();
|
||||
|
|
|
|||
Loading…
Reference in New Issue