diff options
author | Yaxun Liu <Yaxun.Liu@amd.com> | 2016-08-03 20:38:06 +0000 |
---|---|---|
committer | Yaxun Liu <Yaxun.Liu@amd.com> | 2016-08-03 20:38:06 +0000 |
commit | ff7d9d46a510ba90fc4c69dee770b4489b60f3f0 (patch) | |
tree | 237b5a8c63a0af6a47df34499383b913220fb2c2 /lib/CodeGen/CGOpenCLRuntime.cpp | |
parent | 7604798c68651927fb923ec1c0f6cda70122fc07 (diff) |
[OpenCL] Fix size of image type
The size of image type is reported incorrectly as size of a pointer to address space 0, which causes error when casting image type to pointers by __builtin_astype.
The fix is to get image address space from TargetInfo then report the size accordingly.
Differential Revision: https://reviews.llvm.org/D22927
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@277647 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGOpenCLRuntime.cpp')
-rw-r--r-- | lib/CodeGen/CGOpenCLRuntime.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/CodeGen/CGOpenCLRuntime.cpp b/lib/CodeGen/CGOpenCLRuntime.cpp index e4541d59c2..8983fdeafb 100644 --- a/lib/CodeGen/CGOpenCLRuntime.cpp +++ b/lib/CodeGen/CGOpenCLRuntime.cpp @@ -35,8 +35,8 @@ llvm::Type *CGOpenCLRuntime::convertOpenCLSpecificType(const Type *T) { "Not an OpenCL specific type!"); llvm::LLVMContext& Ctx = CGM.getLLVMContext(); - uint32_t ImgAddrSpc = - CGM.getTargetCodeGenInfo().getOpenCLImageAddrSpace(CGM); + uint32_t ImgAddrSpc = CGM.getContext().getTargetAddressSpace( + CGM.getTarget().getOpenCLImageAddrSpace()); switch (cast<BuiltinType>(T)->getKind()) { default: llvm_unreachable("Unexpected opencl builtin type!"); |