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

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 6 20:06:12 PDT 2018


hfinkel added a comment.

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.


Repository:
  rL LLVM

https://reviews.llvm.org/D48239





More information about the llvm-commits mailing list