[PATCH] Use correct address space size GEP index in SROA
Chandler Carruth
chandlerc at gmail.com
Wed Dec 11 17:42:01 PST 2013
See below, only half of this change is necessary.
================
Comment at: lib/Transforms/Scalar/SROA.cpp:2024-2026
@@ -2018,4 +2023,5 @@
assert(Offset >= NewAllocaBeginOffset);
- return getAdjustedPtr(IRB, DL, &NewAI, APInt(DL.getPointerSizeInBits(),
- Offset - NewAllocaBeginOffset),
+ return getAdjustedPtr(IRB, DL, &NewAI,
+ APInt(DL.getPointerTypeSizeInBits(PointerTy),
+ Offset - NewAllocaBeginOffset),
PointerTy);
----------------
This change is unnecessary, and doesn't make any sense. The alloca pointer is always in address space zero.
================
Comment at: lib/Transforms/Scalar/SROA.cpp:2432
@@ -2423,3 +2431,3 @@
// Compute the relative offset within the transfer.
- unsigned IntPtrWidth = DL.getPointerSizeInBits();
+ unsigned IntPtrWidth = DL.getPointerSizeInBits(AS);
APInt RelOffset(IntPtrWidth, NewBeginOffset - BeginOffset);
----------------
We should test this by wrapping around the end of the address space if we want to be pedantic. Maybe not necessary.
http://llvm-reviews.chandlerc.com/D1765
More information about the llvm-commits
mailing list