[PATCH] D37804: [OpenCL] Handle address space conversion while setting type alignment
Yaxun Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 20 12:12:18 PDT 2017
yaxunl added inline comments.
================
Comment at: lib/CodeGen/CGExpr.cpp:957
- return Builder.CreateBitCast(Addr, ConvertType(E->getType()));
+ return Builder.CreatePointerBitCastOrAddrSpaceCast(
+ Addr, ConvertType(E->getType()));
----------------
Anastasia wrote:
> Anastasia wrote:
> > 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.
> Sam, do you prefer an assert that will check both things or a runtime check that would make sure to build the right IR node here?
splitting into bitcast and addrspacecast seems better.
https://reviews.llvm.org/D37804
More information about the cfe-commits
mailing list