[PATCH] D81617: [SVE] Bail from cstfp_pred_ty before walking scalable vector

Christopher Tetreault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 10 16:08:20 PDT 2020


ctetreau created this revision.
Herald added subscribers: llvm-commits, psnobl, rkruppe, tschuett.
Herald added a reviewer: efriedma.
Herald added a project: LLVM.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81617

Files:
  llvm/include/llvm/IR/PatternMatch.h


Index: llvm/include/llvm/IR/PatternMatch.h
===================================================================
--- llvm/include/llvm/IR/PatternMatch.h
+++ llvm/include/llvm/IR/PatternMatch.h
@@ -333,6 +333,10 @@
         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?");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81617.269985.patch
Type: text/x-patch
Size: 720 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200610/15c15167/attachment.bin>


More information about the llvm-commits mailing list