diff options
author | Chris Lattner <sabre@nondot.org> | 2009-02-02 18:02:59 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-02-02 18:02:59 +0000 |
commit | 996d7a97f94de45a3627b03eb3c44b2b325f3e51 (patch) | |
tree | c2ae2c3c4c79a19c163dd2dd186556e501f8075c /lib | |
parent | d5863dd9a806300bd020b80de3067fd36ac213c6 (diff) |
Fix a bug which caused us to miscompile a couple of Ada
tests. Thanks for the beautiful reduced testcase Duncan!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63529 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/ScalarReplAggregates.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 29970ecb44..0765e12876 100644 --- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -1166,12 +1166,17 @@ void SROA::CanonicalizeAllocaUsers(AllocationInst *AI) { static void MergeInType(const Type *In, uint64_t Offset, const Type *&Accum, const TargetData &TD) { // If this is our first type, just use it. - if (Accum == 0 || In == Type::VoidTy || + if ((Accum == 0 && Offset == 0) || In == Type::VoidTy || // Or if this is a same type, keep it. (In == Accum && Offset == 0)) { Accum = In; return; } + + // Merging something like i32 into offset 8 means that a "field" is merged in + // before the basic type is. Make sure to consider the offset below. + if (Accum == 0) + Accum = Type::Int8Ty; if (const VectorType *VATy = dyn_cast<VectorType>(Accum)) { if (VATy->getElementType() == In && |