diff options
author | Jay Foad <jay.foad@gmail.com> | 2019-06-19 10:28:48 +0000 |
---|---|---|
committer | Jay Foad <jay.foad@gmail.com> | 2019-06-19 10:28:48 +0000 |
commit | 45d19fb470616851a1e2b15f247739c60902445c (patch) | |
tree | e2e1c188051774a1c6c3ea559915336c73f7283b /llvm/lib/Analysis/ConstantFolding.cpp | |
parent | 18737e81eb59a0f0f3898b161f39559dbba6bb79 (diff) | |
download | bcm5719-llvm-45d19fb470616851a1e2b15f247739c60902445c.tar.gz bcm5719-llvm-45d19fb470616851a1e2b15f247739c60902445c.zip |
[ConstantFolding] Fix assertion failure on non-power-of-two vector load.
Summary:
The test case does an (out of bounds) load from a global constant with
type <3 x float>. InstSimplify tried to turn this into an integer load
of the whole alloc size of the vector, which is 128 bits due to
alignment padding, and then bitcast this to <3 x vector> which failed
an assertion due to the type size mismatch.
The fix is to do an integer load of the normal size of the vector, with
no alignment padding.
Reviewers: tpr, arsenm, majnemer, dstuttard
Reviewed By: arsenm
Subscribers: hfinkel, wdng, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D63375
llvm-svn: 363784
Diffstat (limited to 'llvm/lib/Analysis/ConstantFolding.cpp')
-rw-r--r-- | llvm/lib/Analysis/ConstantFolding.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index 85390e37708..4657b855d09 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -515,7 +515,7 @@ Constant *FoldReinterpretLoadFromConstPtr(Constant *C, Type *LoadTy, MapTy = Type::getInt64Ty(C->getContext()); else if (LoadTy->isVectorTy()) { MapTy = PointerType::getIntNTy(C->getContext(), - DL.getTypeAllocSizeInBits(LoadTy)); + DL.getTypeSizeInBits(LoadTy)); } else return nullptr; |