diff options
| author | David Blaikie <dblaikie@gmail.com> | 2015-03-30 21:41:43 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2015-03-30 21:41:43 +0000 |
| commit | d288fb86810bbac1c2890b70e9ecd6f03744dfa7 (patch) | |
| tree | 22054f443f756bd7ca2d32649f00aaea4ebf4245 /llvm/lib/IR/Instructions.cpp | |
| parent | 0d68b4c5ed89f1c8a9e4466badf69de159ee20d7 (diff) | |
| download | bcm5719-llvm-d288fb86810bbac1c2890b70e9ecd6f03744dfa7.tar.gz bcm5719-llvm-d288fb86810bbac1c2890b70e9ecd6f03744dfa7.zip | |
[opaque pointer type] Change GetElementPtrInst::getIndexedType to take the pointee type
This pushes the use of PointerType::getElementType up into several
callers - I'll essentially just have to keep pushing that up the stack
until I can eliminate every call to it...
llvm-svn: 233604
Diffstat (limited to 'llvm/lib/IR/Instructions.cpp')
| -rw-r--r-- | llvm/lib/IR/Instructions.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp index af2aeb9ec62..f1dfea956c5 100644 --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -1258,11 +1258,7 @@ GetElementPtrInst::GetElementPtrInst(const GetElementPtrInst &GEPI) /// pointer type. /// template <typename IndexTy> -static Type *getIndexedTypeInternal(Type *Ptr, ArrayRef<IndexTy> IdxList) { - PointerType *PTy = dyn_cast<PointerType>(Ptr->getScalarType()); - if (!PTy) return nullptr; // Type isn't a pointer type! - Type *Agg = PTy->getElementType(); - +static Type *getIndexedTypeInternal(Type *Agg, ArrayRef<IndexTy> IdxList) { // Handle the special case of the empty set index set, which is always valid. if (IdxList.empty()) return Agg; @@ -1283,17 +1279,17 @@ static Type *getIndexedTypeInternal(Type *Ptr, ArrayRef<IndexTy> IdxList) { return CurIdx == IdxList.size() ? Agg : nullptr; } -Type *GetElementPtrInst::getIndexedType(Type *Ptr, ArrayRef<Value *> IdxList) { - return getIndexedTypeInternal(Ptr, IdxList); +Type *GetElementPtrInst::getIndexedType(Type *Ty, ArrayRef<Value *> IdxList) { + return getIndexedTypeInternal(Ty, IdxList); } -Type *GetElementPtrInst::getIndexedType(Type *Ptr, +Type *GetElementPtrInst::getIndexedType(Type *Ty, ArrayRef<Constant *> IdxList) { - return getIndexedTypeInternal(Ptr, IdxList); + return getIndexedTypeInternal(Ty, IdxList); } -Type *GetElementPtrInst::getIndexedType(Type *Ptr, ArrayRef<uint64_t> IdxList) { - return getIndexedTypeInternal(Ptr, IdxList); +Type *GetElementPtrInst::getIndexedType(Type *Ty, ArrayRef<uint64_t> IdxList) { + return getIndexedTypeInternal(Ty, IdxList); } /// hasAllZeroIndices - Return true if all of the indices of this GEP are |

