[PATCH] D61652: [Attr] Introduce dereferenceable_globally

Ralf via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 21 00:56:54 PST 2019


RalfJung added inline comments.


================
Comment at: llvm/docs/LangRef.rst:1170
+    ``dereferenceable(<n>)`` property *at any program point*, starting from the
+    definition of the value to the termination of the program. Thus, unlike
+    pointer values annotated with ``dereferenceable(<n>)``,
----------------
In Rust, we are using the existing  `dereferenceable` attribute on function parameters, and we are generally happy with its semantics, which we interpreted to be "this pointer is dereferenceable for the entire duration of this function call". We automatically set this attribute for all references passed to a function, which in Rust (unlike in C++) are guaranteed to not be deallocated while the function is ongoing.

However, the new `dereferenceable_globally` that is being proposed here is useless for us: even memory pointed to by references *does* eventually get deallocated. We hence cannot set that attribute. So, the patch as proposed constitutes a big regression in terms of the kind of information that the Rust frontend can provide to LLVM.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61652/new/

https://reviews.llvm.org/D61652





More information about the llvm-commits mailing list