Add some cleanup to the DataLayout changes requested by Chandler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166607 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Micah Villmow
2012-10-24 18:36:13 +00:00
parent 199063ea37
commit b52fb87617
11 changed files with 38 additions and 27 deletions

View File

@ -2364,8 +2364,9 @@ private:
Value *getAdjustedAllocaPtr(IRBuilder<> &IRB, Type *PointerTy) {
assert(BeginOffset >= NewAllocaBeginOffset);
unsigned AS = cast<PointerType>(PointerTy)->getAddressSpace();
APInt Offset(TD.getPointerSizeInBits(AS), BeginOffset - NewAllocaBeginOffset);
assert(PointerTy->isPointerTy() &&
"Type must be pointer type!");
APInt Offset(TD.getTypeSizeInBits(PointerTy), BeginOffset - NewAllocaBeginOffset);
return getAdjustedPtr(IRB, TD, &NewAI, Offset, PointerTy, getName(""));
}
@ -2687,9 +2688,8 @@ private:
= P.getMemTransferOffsets(II);
assert(OldPtr->getType()->isPointerTy() && "Must be a pointer type!");
unsigned AS = cast<PointerType>(OldPtr->getType())->getAddressSpace();
// Compute the relative offset within the transfer.
unsigned IntPtrWidth = TD.getPointerSizeInBits(AS);
unsigned IntPtrWidth = TD.getTypeSizeInBits(OldPtr->getType());
APInt RelOffset(IntPtrWidth, BeginOffset - (IsDest ? MTO.DestBegin
: MTO.SourceBegin));