[BasicTTI] Return Invalid for scalable vectors reaching getScalarizationOverhead
If we would scalarize a fixed vector, we know we can't do so for a scalable one. However, there's no need to crash, we can instead simply return a invalid cost which will work its way through the computation (since invalid is sticky), and the client should bail out. Sorry for the lack of test here. The particular codepath I saw this reached on was the result of another bug.
This commit is contained in:
parent
31e2bba155
commit
bbf3fd4af1
|
|
@ -703,6 +703,8 @@ public:
|
|||
bool Insert, bool Extract) {
|
||||
/// FIXME: a bitfield is not a reasonable abstraction for talking about
|
||||
/// which elements are needed from a scalable vector
|
||||
if (isa<ScalableVectorType>(InTy))
|
||||
return InstructionCost::getInvalid();
|
||||
auto *Ty = cast<FixedVectorType>(InTy);
|
||||
|
||||
assert(DemandedElts.getBitWidth() == Ty->getNumElements() &&
|
||||
|
|
@ -725,6 +727,8 @@ public:
|
|||
/// Helper wrapper for the DemandedElts variant of getScalarizationOverhead.
|
||||
InstructionCost getScalarizationOverhead(VectorType *InTy, bool Insert,
|
||||
bool Extract) {
|
||||
if (isa<ScalableVectorType>(InTy))
|
||||
return InstructionCost::getInvalid();
|
||||
auto *Ty = cast<FixedVectorType>(InTy);
|
||||
|
||||
APInt DemandedElts = APInt::getAllOnes(Ty->getNumElements());
|
||||
|
|
|
|||
Loading…
Reference in New Issue