diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2016-07-01 00:36:54 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2016-07-01 00:36:54 +0000 |
commit | 8a4ab5e19f948708f190223ed49add4897cc7833 (patch) | |
tree | 4152eb4a9fc8a4f8b198f0d50baa1b92f6257c35 /llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp | |
parent | 5c5798c57c9908c64bae2cd82a2d273313f01e1b (diff) | |
download | bcm5719-llvm-8a4ab5e19f948708f190223ed49add4897cc7833.tar.gz bcm5719-llvm-8a4ab5e19f948708f190223ed49add4897cc7833.zip |
LoadStoreVectorizer: Fix crashes on sub-byte types
llvm-svn: 274306
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp')
-rw-r--r-- | llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp b/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp index 567e8e6eb1d..ceadb8d0634 100644 --- a/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp @@ -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) && |