[llvm-commits] [llvm] r129876 - /llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp
Cameron Zwarich
zwarich at apple.com
Wed Apr 20 14:48:16 PDT 2011
Author: zwarich
Date: Wed Apr 20 16:48:16 2011
New Revision: 129876
URL: http://llvm.org/viewvc/llvm-project?rev=129876&view=rev
Log:
Cleanup some code to better use an early return style in preparation for adding
more cases.
Modified:
llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=129876&r1=129875&r2=129876&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Wed Apr 20 16:48:16 2011
@@ -337,16 +337,20 @@
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;
}
}
More information about the llvm-commits
mailing list