From 093ae49077dc7a12624262110e8c2c88808c58bf Mon Sep 17 00:00:00 2001 From: Eduard Burtescu Date: Fri, 22 Jan 2016 01:33:43 +0000 Subject: [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 llvm-svn: 258474 --- llvm/lib/IR/DataLayout.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'llvm/lib/IR/DataLayout.cpp') diff --git a/llvm/lib/IR/DataLayout.cpp b/llvm/lib/IR/DataLayout.cpp index 8230f429b05..0f2e5ba5895 100644 --- a/llvm/lib/IR/DataLayout.cpp +++ b/llvm/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 - 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(*TI)) { -- cgit v1.2.3