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



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

Reply via email to