[PATCH] D37804: [OpenCL] Handle address space conversion while setting type alignment

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 14 10:38:51 PDT 2017


Anastasia added inline comments.


================
Comment at: lib/CodeGen/CGExpr.cpp:957
 
-        return Builder.CreateBitCast(Addr, ConvertType(E->getType()));
+        return Builder.CreatePointerBitCastOrAddrSpaceCast(
+            Addr, ConvertType(E->getType()));
----------------
yaxunl wrote:
> Better assert that only CK_AddressSpaceConversion allows different addr spaces in target type.
It seems for consistency then we would have to assert for both different ASes in non-`addrspacecast` case and equivalent ASes in the other case.

As condition becomes complicated then, I could as well split into either creating `bitcast` or `addrspacecast` explicitly at a cost of one simple check in the return statement but that would be in release build too. 


https://reviews.llvm.org/D37804





More information about the cfe-commits mailing list