[PATCH] D71177: [ValueTracking] Use the assumption that if the pointer was loaded/stored, then it is nonnull.

Danila Kutenin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 8 12:16:39 PST 2019


danlark created this revision.
Herald added subscribers: llvm-commits, steven.zhang, jsji, jfb, hiraditya, nemanjai.
Herald added a project: LLVM.
Herald added a subscriber: wuzish.

If the pointer was loaded/stored before the null check, the check is redundant and can be removed. For now the optimizers do not remove the nullptr check, see https://gcc.godbolt.org/z/-gBeJm. The patch allows to use more nonnull constraints on the pointers. Also, it found one more optimization in some PowerPC test. This is my first llvm review, I am free to any comments.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71177

Files:
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/test/Analysis/ValueTracking/known-nonnull-at.ll
  llvm/test/CodeGen/PowerPC/pr39815.ll
  llvm/test/Transforms/Coroutines/coro-swifterror.ll
  llvm/test/Transforms/InstCombine/element-atomic-memintrins.ll
  llvm/test/Transforms/InstCombine/memcpy-addrspace.ll
  llvm/test/Transforms/InstCombine/phi-equal-incoming-pointers.ll
  llvm/test/Transforms/InstCombine/sink-alloca.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71177.232740.patch
Type: text/x-patch
Size: 20937 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191208/ef404303/attachment.bin>


More information about the llvm-commits mailing list