[llvm-commits] [llvm] r123383 - /llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp
Bob Wilson
bob.wilson at apple.com
Thu Jan 13 10:26:59 PST 2011
Author: bwilson
Date: Thu Jan 13 12:26:59 2011
New Revision: 123383
URL: http://llvm.org/viewvc/llvm-project?rev=123383&view=rev
Log:
Check for empty structs, and for consistency, zero-element arrays.
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=123383&r1=123382&r2=123383&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Thu Jan 13 12:26:59 2011
@@ -1084,12 +1084,12 @@
const Type *&EltTy) {
if (const ArrayType *AT = dyn_cast<ArrayType>(T)) {
NumElts = AT->getNumElements();
- EltTy = AT->getElementType();
+ EltTy = (NumElts == 0 ? 0 : AT->getElementType());
return true;
}
if (const StructType *ST = dyn_cast<StructType>(T)) {
NumElts = ST->getNumContainedTypes();
- EltTy = ST->getContainedType(0);
+ EltTy = (NumElts == 0 ? 0 : ST->getContainedType(0));
for (unsigned n = 1; n < NumElts; ++n) {
if (ST->getContainedType(n) != EltTy)
return false;
More information about the llvm-commits
mailing list