aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/ScalarReplAggregates.cpp
diff options
context:
space:
mode:
authorCameron Zwarich <zwarich@apple.com>2011-06-09 01:45:33 +0000
committerCameron Zwarich <zwarich@apple.com>2011-06-09 01:45:33 +0000
commit96cc1d0dfbcf9c7ffffc65f0aa008ff532d444f4 (patch)
tree977db1c3a32badee87361b9606b556a72cdc0f33 /lib/Transforms/Scalar/ScalarReplAggregates.cpp
parentefe12907dd58d1d34ab10b0bd2ae9a099b996f53 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132766 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/ScalarReplAggregates.cpp')
-rw-r--r--lib/Transforms/Scalar/ScalarReplAggregates.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp
index 9f286b5642..09e597fe66 100644
--- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp
+++ b/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;