diff options
Diffstat (limited to 'lib/VMCore/Type.cpp')
-rw-r--r-- | lib/VMCore/Type.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
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<PointerType>(this)->getAddressSpace(); + if (isPointerTy()) + return cast<PointerType>(this)->getAddressSpace(); + if (isVectorTy()) + return getSequentialElementType()->getPointerAddressSpace(); + llvm_unreachable("Should never reach here!"); + return 0; } |