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

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 9 15:36:44 PDT 2018


efriedma added a comment.

> 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

Well, not all the users pass in the context parameter, since it's optional, but otherwise, that's all we need in theory.  That said, it would be too expensive without some sort of cache.  Dereferenceable doesn't imply noalias, so any call could free the pointer.  So we have to iterate over every instruction between the use and the function's entry point to find calls which might alias.  Given we need a cache, we need an analysis pass to store the cache, and that cache has to be preserved by every loop pass so we can use it from LICM.


Repository:
  rL LLVM

https://reviews.llvm.org/D48239





More information about the llvm-commits mailing list