]> granicus.if.org Git - llvm/commit
[LSV] Skip all non-byte sizes, not only less than eight bits
authorBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Thu, 26 Oct 2017 13:42:55 +0000 (13:42 +0000)
committerBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Thu, 26 Oct 2017 13:42:55 +0000 (13:42 +0000)
commit941b1f1426afc67e96430b5cde03b93744efc5d8
treec67f7d7445f89e127c2927050639866209a7db6e
parent975b1d7a6b4e9ede4a5916aecf330f01b07a32c1
[LSV] Skip all non-byte sizes, not only less than eight bits

Summary:
The code comments indicate that no effort has been spent on
handling load/stores when the size isn't a multiple of the
byte size correctly. However, the code only avoided types
smaller than 8 bits. So for example a load of an i28 could
still be considered as a candidate for vectorization.

This patch adjusts the code to behave according to the code
comment.

The test case used to hit the following assert when
trying to use "cast" an i32 to i28 using CreateBitOrPointerCast:

opt: ../lib/IR/Instructions.cpp:2565: Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed.
#0 PrintStackTraceSignalHandler(void*)
#1 SignalHandler(int)
#2 __restore_rt
#3 __GI_raise
#4 __GI_abort
#5 __GI___assert_fail
#6 llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&, llvm::Instruction*)
#7 llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>::CreateBitOrPointerCast(llvm::Value*, llvm::Type*, llvm::Twine const&)
#8 (anonymous namespace)::Vectorizer::vectorizeLoadChain(llvm::ArrayRef<llvm::Instruction*>, llvm::SmallPtrSet<llvm::Instruction*, 16u>*)

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D39295

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316663 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
test/Transforms/LoadStoreVectorizer/X86/non-byte-size.ll [new file with mode: 0644]