From aa76e9e2cf50af190de90bc778b7f7e42ef9ceff Mon Sep 17 00:00:00 2001 From: Micah Villmow Date: Wed, 24 Oct 2012 15:52:52 +0000 Subject: Add in support for getIntPtrType to get the pointer type based on the address space. This checkin also adds in some tests that utilize these paths and updates some of the clients. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166578 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/Type.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/VMCore/Type.cpp') diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index 1a7a650989..54146e118c 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -233,7 +233,12 @@ unsigned Type::getVectorNumElements() const { } unsigned Type::getPointerAddressSpace() const { - return cast(this)->getAddressSpace(); + if (isPointerTy()) + return cast(this)->getAddressSpace(); + if (isVectorTy()) + return getSequentialElementType()->getPointerAddressSpace(); + llvm_unreachable("Should never reach here!"); + return 0; } -- cgit v1.2.3