[PATCH] D26196: Add support for non-zero null pointer for C and OpenCL

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 12 19:57:24 PST 2016


yaxunl added a comment.

>> It seems the casting from a pointer to different address space is not affected by this change. When a null pointer is casted to different address space, it is casted the same way as an ordinary pointer, e.g. by addrspacecast.
> 
> You mean, the code-generation for that knows about your special null pointer representation?  That is confusing.

The null pointer is represented in a new way, but the new representation has the same type as before. For example, a null pointer in addr space 0 used to be `i8 *null`, now it becomes `addrspacecast i8 addrspace(4)* null to i8*`. It is still of type i8*, so nothing is changed about casting a pointer to a different address space.


https://reviews.llvm.org/D26196





More information about the cfe-commits mailing list