mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-04 21:31:03 +00:00
[SROA] Use NewOffsetBegin in the unsplit case for memset merely for
consistency with memcpy rewriting, and fix a latent bug in the alignment management for memset. The alignment issue is that getAdjustedAllocaPtr is computing the *relative* offset into the new alloca, but the alignment isn't being set to the relative offset, it was using the the absolute offset which is into the old alloca. I don't think its possible to write a test case that actually reaches this code where the resulting alignment would be observably different, but the intent was clearly to use the relative offset within the new alloca. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202229 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f11f7a49b9
commit
f28c057c42
@ -2393,10 +2393,11 @@ private:
|
|||||||
// pointer to the new alloca.
|
// pointer to the new alloca.
|
||||||
if (!isa<Constant>(II.getLength())) {
|
if (!isa<Constant>(II.getLength())) {
|
||||||
assert(!IsSplit);
|
assert(!IsSplit);
|
||||||
assert(BeginOffset >= NewAllocaBeginOffset);
|
assert(NewBeginOffset == BeginOffset);
|
||||||
II.setDest(getAdjustedAllocaPtr(IRB, BeginOffset, OldPtr->getType()));
|
II.setDest(getAdjustedAllocaPtr(IRB, NewBeginOffset, OldPtr->getType()));
|
||||||
Type *CstTy = II.getAlignmentCst()->getType();
|
Type *CstTy = II.getAlignmentCst()->getType();
|
||||||
II.setAlignment(ConstantInt::get(CstTy, getOffsetAlign(BeginOffset)));
|
II.setAlignment(ConstantInt::get(
|
||||||
|
CstTy, getOffsetAlign(NewBeginOffset - NewAllocaBeginOffset)));
|
||||||
|
|
||||||
deleteIfTriviallyDead(OldPtr);
|
deleteIfTriviallyDead(OldPtr);
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user