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()));
----------------
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?


https://reviews.llvm.org/D37804



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to