[clang] [Cuda] Handle -fcuda-short-ptr even with -nocudalib (PR #111682)

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 10 10:57:45 PDT 2024


Artem-B wrote:

> I'm not sure why the option isn't enabled by default, personally

While it does indeed help with generating better code, using this option while compiling CUDA code may be problematic.
Front-end is not aware of address spaces and all pointers are generic, so `sizeof(any pointer) == 8`. If we enable short pointers, then, after inferring AS some pointers become 32-bit and this discrepancy may lead to interesting bugs.

IMO short pointers are currently are only safe to use on IR level. You *may* get by using them from CUDA, but I do not think that enabling them by default is a good idea.

https://github.com/llvm/llvm-project/pull/111682


More information about the cfe-commits mailing list