summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorAnastasia Stulova <anastasia.stulova@arm.com>2014-11-26 15:36:41 +0000
committerAnastasia Stulova <anastasia.stulova@arm.com>2014-11-26 15:36:41 +0000
commit5d8ad8a7b8911308a531ad87e8284088ea7f8002 (patch)
treed9a72c7d8fe4ccd9d890d167c6e30539d447d685 /clang/lib/CodeGen
parent9fb411431d4df41f562008fc4580230fc2ee4362 (diff)
downloadbcm5719-llvm-5d8ad8a7b8911308a531ad87e8284088ea7f8002.tar.gz
bcm5719-llvm-5d8ad8a7b8911308a531ad87e8284088ea7f8002.zip
[OpenCL] Implemented restrictions for pointer conversions specified in OpenCL v2.0.
OpenCL v2.0 s6.5.5 restricts conversion of pointers to different address spaces: - the named address spaces (__global, __local, and __private) => __generic - implicitly converted; - __generic => named - with an explicit cast; - named <=> named - disallowed; - __constant <=> any other - disallowed. llvm-svn: 222834
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGExprScalar.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp
index 19d453d3caa..a9e63dc7f76 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -1351,8 +1351,8 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
llvm::Type *DstTy = ConvertType(DestTy);
if (SrcTy->isPtrOrPtrVectorTy() && DstTy->isPtrOrPtrVectorTy() &&
SrcTy->getPointerAddressSpace() != DstTy->getPointerAddressSpace()) {
- llvm::Type *MidTy = CGF.CGM.getDataLayout().getIntPtrType(SrcTy);
- return Builder.CreateIntToPtr(Builder.CreatePtrToInt(Src, MidTy), DstTy);
+ llvm_unreachable("wrong cast for pointers in different address spaces"
+ "(must be an address space cast)!");
}
return Builder.CreateBitCast(Src, DstTy);
}
OpenPOWER on IntegriCloud