[PATCH] D63525: LangRef: Attempt to formulate some rules for addrspacecast

Nuno Lopes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 26 14:29:31 PDT 2022


nlopes added inline comments.


================
Comment at: llvm/docs/LangRef.rst:3047
+address spaces are target-specific. Memory access through an invalid,
+non-dereferenceable "null" pointer is undefined behavior in any address
+space. Pointers with the bit-value 0 are only assumed to be
----------------
efriedma wrote:
> Given we don't define what it means for a pointer to be "null", or promise that such a pointer exists in every address-space, it isn't really meaningful to say that dereferencing null is undefined.  We can just drop that whole sentence, I think.
agreed


================
Comment at: llvm/docs/LangRef.rst:3049
+space. Pointers with the bit-value 0 are only assumed to be
+non-dereferenceable in address space 0.
+
----------------
unless the function is marked with the `null_pointer_is_valid` attribute


================
Comment at: llvm/docs/LangRef.rst:3051
+
+If an object can be proven accessible through a pointer with a
+different address space, the access may be modified to use that
----------------
uhm, do we want this?
This precludes using two address spaces with different memory protections. I understand why this assumption may be useful for optimization, but not sure we want it.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63525/new/

https://reviews.llvm.org/D63525



More information about the llvm-commits mailing list