diff options
| author | Bob Wilson <bob.wilson@apple.com> | 2011-01-13 18:26:59 +0000 |
|---|---|---|
| committer | Bob Wilson <bob.wilson@apple.com> | 2011-01-13 18:26:59 +0000 |
| commit | c8056a952e2bbe1d7a1d3d9092405e04f124b714 (patch) | |
| tree | 32efe9efcb95e80b4034c4fb8dfb493ab6380caa /llvm/lib/Transforms | |
| parent | d43037cb70fca0e4775094202cc35cd42039beff (diff) | |
| download | bcm5719-llvm-c8056a952e2bbe1d7a1d3d9092405e04f124b714.tar.gz bcm5719-llvm-c8056a952e2bbe1d7a1d3d9092405e04f124b714.zip | |
Check for empty structs, and for consistency, zero-element arrays.
llvm-svn: 123383
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 0ec095749f9..e248413f438 100644 --- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -1084,12 +1084,12 @@ static bool isHomogeneousAggregate(const Type *T, unsigned &NumElts, 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; |

