summaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/SROA.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-10-17 07:22:16 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-10-17 07:22:16 +0000
commit020d9d5feb59b4e92b4b55c5850fe3a5f77671b0 (patch)
treedf240f680e6c01a493d8746c011b60ded77b6d3d /lib/Transforms/Scalar/SROA.cpp
parentfda458c2df6c282a4fbe335157676f7fa4117021 (diff)
downloadllvm-020d9d5feb59b4e92b4b55c5850fe3a5f77671b0.tar.gz
llvm-020d9d5feb59b4e92b4b55c5850fe3a5f77671b0.tar.bz2
llvm-020d9d5feb59b4e92b4b55c5850fe3a5f77671b0.tar.xz
Fix a really annoying "bug" introduced in r165941. The change from that
revision makes no sense. We cannot use the address space of the *post indexed* type to conclude anything about a *pre indexed* pointer type's size. More importantly, this index can never be over a pointer. We are indexing over arrays and vectors here. Of course, I have no test case here. Neither did the original patch. =/ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166091 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/SROA.cpp')
-rw-r--r--lib/Transforms/Scalar/SROA.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/SROA.cpp b/lib/Transforms/Scalar/SROA.cpp
index 3e84a91c1d..e2078b4b44 100644
--- a/lib/Transforms/Scalar/SROA.cpp
+++ b/lib/Transforms/Scalar/SROA.cpp
@@ -1785,9 +1785,9 @@ static Value *getNaturalGEPWithType(IRBuilder<> &IRB, const DataLayout &TD,
break;
if (SequentialType *SeqTy = dyn_cast<SequentialType>(ElementTy)) {
ElementTy = SeqTy->getElementType();
- Indices.push_back(IRB.getInt(APInt(TD.getPointerSizeInBits(
- ElementTy->isPointerTy() ?
- cast<PointerType>(ElementTy)->getAddressSpace(): 0), 0)));
+ // Note that we use the default address space as this index is over an
+ // array or a vector, not a pointer.
+ Indices.push_back(IRB.getInt(APInt(TD.getPointerSizeInBits(0), 0)));
} else if (StructType *STy = dyn_cast<StructType>(ElementTy)) {
if (STy->element_begin() == STy->element_end())
break; // Nothing left to descend into.