diff options
| author | Cameron Zwarich <zwarich@apple.com> | 2011-04-20 21:48:16 +0000 |
|---|---|---|
| committer | Cameron Zwarich <zwarich@apple.com> | 2011-04-20 21:48:16 +0000 |
| commit | 4cd9a4a9759c5ffa9c08a5f2d6e4a6b435aed7be (patch) | |
| tree | 4673b2b21120c39beb6f018c06d16cebb82166e3 | |
| parent | 1b06a10d62ba658c2a6ef37bcdc76b388a0392e2 (diff) | |
| download | bcm5719-llvm-4cd9a4a9759c5ffa9c08a5f2d6e4a6b435aed7be.tar.gz bcm5719-llvm-4cd9a4a9759c5ffa9c08a5f2d6e4a6b435aed7be.zip | |
Cleanup some code to better use an early return style in preparation for adding
more cases.
llvm-svn: 129876
| -rw-r--r-- | llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 95c36c93ed6..984f5c85d8b 100644 --- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -337,16 +337,20 @@ void ConvertToScalarInfo::MergeInType(const Type *In, uint64_t Offset, unsigned EltSize = In->getPrimitiveSizeInBits()/8; if (IsLoadOrStore && EltSize == AllocaSize) return; + // 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 && - (VectorTy == 0 || - cast<VectorType>(VectorTy)->getElementType() - ->getPrimitiveSizeInBits()/8 == EltSize)) { - if (VectorTy == 0) + if (Offset % EltSize == 0 && AllocaSize % EltSize == 0) { + if (!VectorTy) { VectorTy = VectorType::get(In, AllocaSize/EltSize); - return; + return; + } + + unsigned CurrentEltSize = cast<VectorType>(VectorTy)->getElementType() + ->getPrimitiveSizeInBits()/8; + if (EltSize == CurrentEltSize) + return; } } |

