[PATCH] D79090: [SVE] Fix incorrect assert in getDoubleElementsVectorType()
David Sherwood via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 29 07:28:28 PDT 2020
david-arm created this revision.
david-arm added reviewers: kmclaughlin, sdesmalen, ctetreau.
Herald added subscribers: llvm-commits, psnobl, rkruppe, tschuett.
Herald added a reviewer: rengolin.
Herald added a reviewer: efriedma.
Herald added a project: LLVM.
In VectorType::getDoubleElementsVectorType we were asserting that
we could fit double the number of elements in an integer, however
the code was incorrectly using getVectorNumElements() for scalable
vectors. I've changed the code to use the element count instead.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D79090
Files:
llvm/include/llvm/IR/DerivedTypes.h
Index: llvm/include/llvm/IR/DerivedTypes.h
===================================================================
--- llvm/include/llvm/IR/DerivedTypes.h
+++ llvm/include/llvm/IR/DerivedTypes.h
@@ -519,8 +519,7 @@
/// input type and the same element type.
static VectorType *getDoubleElementsVectorType(VectorType *VTy) {
auto EltCnt = VTy->getElementCount();
- assert((VTy->getNumElements() * 2ull) <= UINT_MAX &&
- "Too many elements in vector");
+ assert((EltCnt.Min * 2ull) <= UINT_MAX && "Too many elements in vector");
return VectorType::get(VTy->getElementType(), EltCnt*2);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79090.260909.patch
Type: text/x-patch
Size: 618 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200429/2498bcc4/attachment.bin>
More information about the llvm-commits
mailing list