diff options
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/SROA.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp index 2ecc517d485..d0f2561dd33 100644 --- a/llvm/lib/Transforms/Scalar/SROA.cpp +++ b/llvm/lib/Transforms/Scalar/SROA.cpp @@ -2393,10 +2393,11 @@ private: // pointer to the new alloca. if (!isa<Constant>(II.getLength())) { assert(!IsSplit); - assert(BeginOffset >= NewAllocaBeginOffset); - II.setDest(getAdjustedAllocaPtr(IRB, BeginOffset, OldPtr->getType())); + assert(NewBeginOffset == BeginOffset); + II.setDest(getAdjustedAllocaPtr(IRB, NewBeginOffset, OldPtr->getType())); Type *CstTy = II.getAlignmentCst()->getType(); - II.setAlignment(ConstantInt::get(CstTy, getOffsetAlign(BeginOffset))); + II.setAlignment(ConstantInt::get( + CstTy, getOffsetAlign(NewBeginOffset - NewAllocaBeginOffset))); deleteIfTriviallyDead(OldPtr); return false; |

