Remove a weird static helper from the GEP instruction and just directly

compute the address space in the one place it was used.

Also write the getPointerAddressSpace member in terms of the
getPointerOperandType member.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167226 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chandler Carruth
2012-11-01 10:59:30 +00:00
parent acd01d1c64
commit 1521406a4b
2 changed files with 5 additions and 21 deletions

View File

@@ -1399,18 +1399,6 @@ Type *GetElementPtrInst::getIndexedType(Type *Ptr, ArrayRef<uint64_t> IdxList) {
return getIndexedTypeInternal(Ptr, IdxList);
}
unsigned GetElementPtrInst::getAddressSpace(Value *Ptr) {
Type *Ty = Ptr->getType();
if (VectorType *VTy = dyn_cast<VectorType>(Ty))
Ty = VTy->getElementType();
if (PointerType *PTy = dyn_cast<PointerType>(Ty))
return PTy->getAddressSpace();
llvm_unreachable("Invalid GEP pointer type");
}
/// hasAllZeroIndices - Return true if all of the indices of this GEP are
/// zeros. If so, the result pointer and the first operand have the same
/// value, just potentially different types.