summaryrefslogtreecommitdiff
path: root/lib/IR/DataLayout.cpp
diff options
context:
space:
mode:
authorEduard Burtescu <edy.burt@gmail.com>2016-01-22 01:33:43 +0000
committerEduard Burtescu <edy.burt@gmail.com>2016-01-22 01:33:43 +0000
commit17a7116948f1db36e325db7f057d7efc435cacce (patch)
tree5d2e1d22e1add82c60f367a4bf79b821b0fe1cf0 /lib/IR/DataLayout.cpp
parent3e0fdb894493b6dd2610b2c79155883792c8f737 (diff)
[opaque pointer types] [NFC] gep_type_{begin,end} now take source element type and address space.
Reviewers: mjacob, dblaikie Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D16436 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258474 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR/DataLayout.cpp')
-rw-r--r--lib/IR/DataLayout.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/IR/DataLayout.cpp b/lib/IR/DataLayout.cpp
index 8230f429b05..0f2e5ba5895 100644
--- a/lib/IR/DataLayout.cpp
+++ b/lib/IR/DataLayout.cpp
@@ -729,8 +729,11 @@ uint64_t DataLayout::getIndexedOffset(Type *ptrTy,
assert(Ty->isPointerTy() && "Illegal argument for getIndexedOffset()");
uint64_t Result = 0;
+ // We can use 0 as the address space as we don't need
+ // to get pointer types back from gep_type_iterator.
+ unsigned AS = 0;
generic_gep_type_iterator<Value* const*>
- TI = gep_type_begin(ptrTy, Indices);
+ TI = gep_type_begin(ptrTy->getPointerElementType(), AS, Indices);
for (unsigned CurIDX = 0, EndIDX = Indices.size(); CurIDX != EndIDX;
++CurIDX, ++TI) {
if (StructType *STy = dyn_cast<StructType>(*TI)) {