mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-13 09:33:50 +00:00
[SROA] Simplify some of the logic to dig out the old pointer value by
using OldPtr more heavily. Lots of this code was written before the rewriter had an OldPtr member setup ahead of time. There are already asserts in place that should ensure this doesn't change any functionality. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202135 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
10b2920851
commit
b59c39e520
@ -2330,8 +2330,7 @@ private:
|
||||
if (!isa<Constant>(II.getLength())) {
|
||||
assert(!IsSplit);
|
||||
assert(BeginOffset >= NewAllocaBeginOffset);
|
||||
II.setDest(
|
||||
getAdjustedAllocaPtr(IRB, BeginOffset, II.getRawDest()->getType()));
|
||||
II.setDest(getAdjustedAllocaPtr(IRB, BeginOffset, OldPtr->getType()));
|
||||
Type *CstTy = II.getAlignmentCst()->getType();
|
||||
II.setAlignment(ConstantInt::get(CstTy, getOffsetAlign(BeginOffset)));
|
||||
|
||||
@ -2363,7 +2362,7 @@ private:
|
||||
Type *SizeTy = II.getLength()->getType();
|
||||
Constant *Size = ConstantInt::get(SizeTy, NewEndOffset - NewBeginOffset);
|
||||
CallInst *New = IRB.CreateMemSet(
|
||||
getAdjustedAllocaPtr(IRB, NewBeginOffset, II.getRawDest()->getType()),
|
||||
getAdjustedAllocaPtr(IRB, NewBeginOffset, OldPtr->getType()),
|
||||
II.getValue(), Size, getOffsetAlign(SliceOffset), II.isVolatile());
|
||||
(void)New;
|
||||
DEBUG(dbgs() << " to: " << *New << "\n");
|
||||
@ -2470,19 +2469,18 @@ private:
|
||||
// memcpy, and so simply updating the pointers is the necessary for us to
|
||||
// update both source and dest of a single call.
|
||||
if (!IsSplittable) {
|
||||
Value *OldOp = IsDest ? II.getRawDest() : II.getRawSource();
|
||||
Value *AdjustedPtr =
|
||||
getAdjustedAllocaPtr(IRB, BeginOffset, OldPtr->getType());
|
||||
if (IsDest)
|
||||
II.setDest(
|
||||
getAdjustedAllocaPtr(IRB, BeginOffset, II.getRawDest()->getType()));
|
||||
II.setDest(AdjustedPtr);
|
||||
else
|
||||
II.setSource(getAdjustedAllocaPtr(IRB, BeginOffset,
|
||||
II.getRawSource()->getType()));
|
||||
II.setSource(AdjustedPtr);
|
||||
|
||||
Type *CstTy = II.getAlignmentCst()->getType();
|
||||
II.setAlignment(ConstantInt::get(CstTy, Align));
|
||||
|
||||
DEBUG(dbgs() << " to: " << II << "\n");
|
||||
deleteIfTriviallyDead(OldOp);
|
||||
deleteIfTriviallyDead(OldPtr);
|
||||
return false;
|
||||
}
|
||||
// For split transfer intrinsics we have an incredibly useful assurance:
|
||||
@ -2531,9 +2529,8 @@ private:
|
||||
// a single, simple GEP in most cases.
|
||||
OtherPtr = getAdjustedPtr(IRB, DL, OtherPtr, RelOffset, OtherPtrTy);
|
||||
|
||||
Value *OurPtr = getAdjustedAllocaPtr(
|
||||
IRB, NewBeginOffset,
|
||||
IsDest ? II.getRawDest()->getType() : II.getRawSource()->getType());
|
||||
Value *OurPtr =
|
||||
getAdjustedAllocaPtr(IRB, NewBeginOffset, OldPtr->getType());
|
||||
Type *SizeTy = II.getLength()->getType();
|
||||
Constant *Size = ConstantInt::get(SizeTy, NewEndOffset - NewBeginOffset);
|
||||
|
||||
@ -2631,8 +2628,7 @@ private:
|
||||
ConstantInt *Size
|
||||
= ConstantInt::get(cast<IntegerType>(II.getArgOperand(0)->getType()),
|
||||
NewEndOffset - NewBeginOffset);
|
||||
Value *Ptr =
|
||||
getAdjustedAllocaPtr(IRB, NewBeginOffset, II.getArgOperand(1)->getType());
|
||||
Value *Ptr = getAdjustedAllocaPtr(IRB, NewBeginOffset, OldPtr->getType());
|
||||
Value *New;
|
||||
if (II.getIntrinsicID() == Intrinsic::lifetime_start)
|
||||
New = IRB.CreateLifetimeStart(Ptr, Size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user