[PATCH] D47895: llvm: Add support for "-fno-delete-null-pointer-checks"
Sanjoy Das via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 21 13:15:37 PDT 2018
sanjoy added a comment.
Drive by comments
You also need to change the inliner to not inline `null-pointer-is-dereferenceable` into functions that don't have that attribute.
================
Comment at: docs/LangRef.rst:1464
as SEH, will still provide their implementation defined semantics.
+``"null-pointer-is-defined"``
+ If ``"null-pointer-is-defined"`` is set to ``"true"``, then ``null`` address
----------------
This should be called `null-pointer-is-dereferenceable` or something like that.
================
Comment at: docs/LangRef.rst:1466
+ If ``"null-pointer-is-defined"`` is set to ``"true"``, then ``null`` address
+ is considered to be a valid address for memory accesses. Any analysis or
+ optimization should not treat dereferencing a pointer to ``null`` as
----------------
Might be worth clarifying if this is just loads or both loads and stores.
================
Comment at: docs/LangRef.rst:1468
+ optimization should not treat dereferencing a pointer to ``null`` as
+ ``undefined`` behavior in this function.
``optforfuzzing``
----------------
efriedma wrote:
> undefined isn't a keyword.
What about functions called from this function?
================
Comment at: lib/Transforms/Utils/Local.cpp:1813
Value *Callee = CI->getCalledValue();
- if (isa<ConstantPointerNull>(Callee) || isa<UndefValue>(Callee)) {
+ if ((isa<ConstantPointerNull>(Callee) &&
+ !NullPointerIsDefined(CI->getFunction())) ||
----------------
I don't think we can fold calls to `undef` either -- the only reason why we can normally do this is because `Callee` could be `null`.
Repository:
rL LLVM
https://reviews.llvm.org/D47895
More information about the llvm-commits
mailing list