[SVE] Bail from cstfp_pred_ty before walking scalable vector

Summary:
Bail out in cstfp_pred_ty before calling getNumElements and walking the
vector if the vector is scalable.

Reviewers: efriedma, lebedev.ri, fhahn, sdesmalen, fpetrogalli

Reviewed By: sdesmalen

Subscribers: tschuett, rkruppe, psnobl, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D81617
This commit is contained in:
Christopher Tetreault 2020-06-15 13:05:37 -07:00
parent 13331477c0
commit 3a726bc993

View File

@ -333,6 +333,10 @@ template <typename Predicate> struct cstfp_pred_ty : public Predicate {
if (const auto *CF = dyn_cast_or_null<ConstantFP>(C->getSplatValue()))
return this->isValue(CF->getValueAPF());
// Number of elements of a scalable vector unknown at compile time
if (isa<ScalableVectorType>(V->getType()))
return false;
// Non-splat vector constant: check each element for a match.
unsigned NumElts = cast<VectorType>(V->getType())->getNumElements();
assert(NumElts != 0 && "Constant vector with no elements?");