LoadStoreVectorizer: Fix crashes on sub-byte types

llvm-svn: 274306
This commit is contained in:
Matt Arsenault
2016-07-01 00:36:54 +00:00
parent 5c5798c57c
commit 8a4ab5e19f
2 changed files with 213 additions and 2 deletions

View File

@@ -437,8 +437,14 @@ void Vectorizer::collectInstructions(BasicBlock *BB) {
if (!VectorType::isValidElementType(Ty->getScalarType()))
continue;
// Skip weird non-byte sizes. They probably aren't worth the effort of
// handling correctly.
unsigned TySize = DL.getTypeSizeInBits(Ty);
if (TySize < 8)
continue;
// No point in looking at these if they're too big to vectorize.
if (DL.getTypeSizeInBits(Ty) > VecRegSize / 2)
if (TySize > VecRegSize / 2)
continue;
// Make sure all the users of a vector are constant-index extracts.
@@ -464,7 +470,13 @@ void Vectorizer::collectInstructions(BasicBlock *BB) {
if (!VectorType::isValidElementType(Ty->getScalarType()))
continue;
if (DL.getTypeSizeInBits(Ty) > VecRegSize / 2)
// Skip weird non-byte sizes. They probably aren't worth the effort of
// handling correctly.
unsigned TySize = DL.getTypeSizeInBits(Ty);
if (TySize < 8)
continue;
if (TySize > VecRegSize / 2)
continue;
if (isa<VectorType>(Ty) &&