[PATCH] D47895: llvm: Add support for "-fno-delete-null-pointer-checks"

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 15 11:54:31 PDT 2018


efriedma added a comment.

> I went through those files but many of these addressSpace() == 0 (and != 0) checks are not for null pointers but for disabling/skipping some memory optimizations. And it is not clear to me if moving all of those checks to the new NullPointerIsDefined function makes sense there.

We should probably add a section to LangRef on address spaces, and what transforms are specifically allowed only in address space 0.

I'm sure we need to handle null-pointer-is-valid in CallSite.h, at least.



================
Comment at: docs/LangRef.rst:1467
+   `nullptr`` or ``NULL`` address is considered to be a valid address. Any
+   analysis or optimization should not treat dereferencing a ``NULL``
+   pointer as undefined behavior in this function.
----------------
Stating the ways to spell null pointer in C isn't helpful; this is the LLVM IR reference.  A null pointer in IR is just "i8* null".  (And the C/C++ notion of a "null pointer" can actually be translated to something which is not `i8* null` in some situations.)


Repository:
  rL LLVM

https://reviews.llvm.org/D47895





More information about the llvm-commits mailing list