Skip to content

Commit 3a726bc

Browse files
[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
1 parent 1333147 commit 3a726bc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

llvm/include/llvm/IR/PatternMatch.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,10 @@ template <typename Predicate> struct cstfp_pred_ty : public Predicate {
333333
if (const auto *CF = dyn_cast_or_null<ConstantFP>(C->getSplatValue()))
334334
return this->isValue(CF->getValueAPF());
335335

336+
// Number of elements of a scalable vector unknown at compile time
337+
if (isa<ScalableVectorType>(V->getType()))
338+
return false;
339+
336340
// Non-splat vector constant: check each element for a match.
337341
unsigned NumElts = cast<VectorType>(V->getType())->getNumElements();
338342
assert(NumElts != 0 && "Constant vector with no elements?");

0 commit comments

Comments
 (0)