[PATCH] D26196: AMDGPU: Translate null pointers in private and local addr space

Anastasia Stulova via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 3 07:42:02 PDT 2016


Anastasia added a comment.

My understanding of NULL constant in IR was that it doesn't assume any specific integer value (i.e. 0). And currently as I can see it is lowered very late in LLVM backend  during the code selection phase.

Looking at the lowering code in LLVM, it seems like it shouldn't be too difficult to special case the NULL value based on the address space: http://llvm.org/docs/doxygen/html/SelectionDAGBuilder_8cpp_source.html#l01039 instead of using hard-coded 0 at it's done now.

My opinion is that we should try to lower the code as late as possible and Clang doesn't seem like an ideal place for this. Also this change adds extra overhead by adding extra addresspacecast instructions and complicates frontend implementation. I don't see immediate benefit in changing this in the frontend compared to changing LLVM code selection phase instead.


https://reviews.llvm.org/D26196





More information about the cfe-commits mailing list