[PATCH] D48239: [LangRef] Clarify meaning of "dereferencable" attribute/metadata.

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 6 20:19:49 PDT 2018


chandlerc added a comment.

In https://reviews.llvm.org/D48239#1155025, @hfinkel wrote:

> In https://reviews.llvm.org/D48239#1135631, @efriedma wrote:
>
> > It's straightforward to define the alternative semantics where it only applies at the point of the call/load.  And it would still be useful to the optimizer.  But the optimizer code would have to be written from scratch; the existing getPointerDereferenceableBytes API isn't usable with an attribute like that.  It's probably worth doing at some point, though: we could prove other interesting things with the context-sensitive analysis, though.  For example, we could prove that a pointer is dereferenceable using a previous load or store operation.)
>
>
> You're correct about getPointerDereferenceableBytes, but all uses go though isDereferenceableAndAlignedPointer (isDereferenceableAndAlignedPointer is really the only caller of getPointerDereferenceableBytes, as far as I know), and hooking this into isDereferenceableAndAlignedPointer should be straightforward because it takes a context instruction (and we should just need to also check for capturing). Please let me know if you agree.


If this is the case, then I wonder whether we should really just change the semantics and add a separate attribute to model the concept of dereferenceable lasting the entire function...


Repository:
  rL LLVM

https://reviews.llvm.org/D48239





More information about the llvm-commits mailing list