diff options
author | Cameron Zwarich <zwarich@apple.com> | 2011-06-09 01:45:33 +0000 |
---|---|---|
committer | Cameron Zwarich <zwarich@apple.com> | 2011-06-09 01:45:33 +0000 |
commit | 77a699a8296b270fd5b383967f010b28f567093f (patch) | |
tree | edb87579f03794ea0c18e578f882c3f806532ad2 /llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp | |
parent | 11edab6a4667f5c3900bc3000b87a5a1eb3dd938 (diff) | |
download | bcm5719-llvm-77a699a8296b270fd5b383967f010b28f567093f.tar.gz bcm5719-llvm-77a699a8296b270fd5b383967f010b28f567093f.zip |
Fix PR10104 by adding a bounds check on a vector element access check. It was
assuming that all offsets are legal vector accesses, and thus trying to access
the float member of { <2 x float>, float } as the 3rd element of the first
member.
llvm-svn: 132766
Diffstat (limited to 'llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 9f286b56422..09e597fe666 100644 --- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -342,7 +342,10 @@ void ConvertToScalarInfo::MergeInType(const Type *In, uint64_t Offset, // If we're accessing something that could be an element of a vector, see // if the implied vector agrees with what we already have and if Offset is // compatible with it. - if (Offset % EltSize == 0 && AllocaSize % EltSize == 0) { + if (Offset % EltSize == 0 && AllocaSize % EltSize == 0 && + Offset * 8 < + (VectorTy ? VectorTy->getPrimitiveSizeInBits() + : (AllocaSize / EltSize) * In->getPrimitiveSizeInBits())) { if (!VectorTy) { VectorTy = VectorType::get(In, AllocaSize/EltSize); return; |