mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-02 04:24:22 +00:00
Analogous fix to memset and memcpy rewriting. Don't have a test case
contrived for these yet, as I spotted them by inspection and the test cases are a bit more tricky to phrase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164691 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -2064,6 +2064,15 @@ private:
|
|||||||
// pointer to the new alloca.
|
// pointer to the new alloca.
|
||||||
if (!isa<Constant>(II.getLength())) {
|
if (!isa<Constant>(II.getLength())) {
|
||||||
II.setDest(getAdjustedAllocaPtr(IRB, II.getRawDest()->getType()));
|
II.setDest(getAdjustedAllocaPtr(IRB, II.getRawDest()->getType()));
|
||||||
|
|
||||||
|
Type *CstTy = II.getAlignmentCst()->getType();
|
||||||
|
if (!NewAI.getAlignment())
|
||||||
|
II.setAlignment(ConstantInt::get(CstTy, 0));
|
||||||
|
else
|
||||||
|
II.setAlignment(
|
||||||
|
ConstantInt::get(CstTy, MinAlign(NewAI.getAlignment(),
|
||||||
|
BeginOffset - NewAllocaBeginOffset)));
|
||||||
|
|
||||||
deleteIfTriviallyDead(OldPtr);
|
deleteIfTriviallyDead(OldPtr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2187,6 +2196,13 @@ private:
|
|||||||
else
|
else
|
||||||
II.setSource(getAdjustedAllocaPtr(IRB, II.getRawSource()->getType()));
|
II.setSource(getAdjustedAllocaPtr(IRB, II.getRawSource()->getType()));
|
||||||
|
|
||||||
|
Type *CstTy = II.getAlignmentCst()->getType();
|
||||||
|
if (II.getAlignment() > 1)
|
||||||
|
II.setAlignment(ConstantInt::get(
|
||||||
|
CstTy, MinAlign(II.getAlignment(),
|
||||||
|
MinAlign(NewAI.getAlignment(),
|
||||||
|
BeginOffset - NewAllocaBeginOffset))));
|
||||||
|
|
||||||
DEBUG(dbgs() << " to: " << II << "\n");
|
DEBUG(dbgs() << " to: " << II << "\n");
|
||||||
deleteIfTriviallyDead(OldOp);
|
deleteIfTriviallyDead(OldOp);
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user