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

Manoj Gupta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 7 11:17:25 PDT 2018


manojgupta created this revision.
manojgupta added reviewers: t.p.northover, efriedma, jyknight, chandlerc, rnk, srhines, void.

Support for this option is needed for building Linux kernel.
This is a very frequently requested feature by kernel developers.

More details : https://lkml.org/lkml/2018/4/4/601

GCC option description for -fdelete-null-pointer-checks:
This Assume that programs cannot safely dereference null pointers,
and that no code or data element resides at address zero.

-fno-delete-null-pointer-checks is the inverse of this implying that
null pointer dereferencing is not undefined.

This feature is implemented in LLVM IR in this CL as the function attribute
"null-pointer-is-valid"="true" in IR (Under review at https://reviews.llvm.org/D47894).
The CL updates several passes that assumed null pointer dereferencing is
undefined to not optimize when the "null-pointer-is-valid"="true"
attribute is present.


Repository:
  rL LLVM

https://reviews.llvm.org/D47895

Files:
  include/llvm/Analysis/Utils/Local.h
  lib/Transforms/InstCombine/InstCombineCalls.cpp
  lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
  lib/Transforms/Scalar/SCCP.cpp
  lib/Transforms/Utils/Local.cpp
  lib/Transforms/Utils/SimplifyCFG.cpp
  test/Transforms/IPConstantProp/PR26044.ll
  test/Transforms/InstCombine/load.ll
  test/Transforms/InstCombine/select.ll
  test/Transforms/InstCombine/store.ll
  test/Transforms/SimplifyCFG/UnreachableEliminate.ll
  test/Transforms/SimplifyCFG/phi-undef-loadstore.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47895.150367.patch
Type: text/x-patch
Size: 17097 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180607/3c702790/attachment.bin>


More information about the llvm-commits mailing list