[PATCH] D64258: [InferFuncAttributes] extend 'dereferenceable' attribute based on loads

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 5 11:23:21 PDT 2019


spatel created this revision.
spatel added reviewers: reames, hfinkel, RKSimon.
Herald added subscribers: hiraditya, mcrosier.
Herald added a project: LLVM.

This is similar to a 'nonnull' patch:
D27855 <https://reviews.llvm.org/D27855>
...that is still off by default because of C problems.

For this patch, the motivating case is shown in PR21780:
https://bugs.llvm.org/show_bug.cgi?id=21780

We are trying to preserve the ability of SLP (D64142 <https://reviews.llvm.org/D64142>) and/or the backend (D64205 <https://reviews.llvm.org/D64205>) to create a vector load even after some other pass like InstCombine has deleted scalar instructions by using demanded elements analysis. We do that by collecting all guaranteed accesses from a given pointer argument and creating a known dereferenceable byte range from those.

There's an alternate proposal to do something similar but more involved in:
D37579 <https://reviews.llvm.org/D37579>
...but that seems to have stalled.

And if I'm interpreting the comments there correctly, this is an implementation of a suggestion from @reames :
"...we can prove that the loads post dominate the entry to the function and could update the argument with the existing dereferenceability attribute. This might be an alternate approach and separately worth implementation."


https://reviews.llvm.org/D64258

Files:
  llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp
  llvm/test/Transforms/InferFunctionAttrs/dereferenceable.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64258.208213.patch
Type: text/x-patch
Size: 11431 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190705/9f6d045a/attachment.bin>


More information about the llvm-commits mailing list