[llvm] Add 'initialized' attribute langref (PR #84803)
Jan Voung via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 12 08:43:12 PDT 2024
================
@@ -1621,6 +1621,28 @@ Currently, only the following parameter attributes are defined:
``readonly`` or a ``memory`` attribute that does not contain
``argmem: write``.
+``initialized((Lo1,Hi1),...)``
+ This attribute is a list of const ranges in ascending order with no
+ overlapping or continuous. It indicates that the function initializes the
+ memory through the pointer argument, [%p+LoN, %p+HiN): there are no reads,
+ and no special accesses (such as volatile access or untrackable capture)
+ before the initialization in the function. LoN/HiN are 64-bit ints;
+ negative values are allowed in case a pointer to partway through the
+ allocation is passed to.
+
+ This attribute implies that the function initializes and does not read
+ before initialization through this pointer argument, even though it may
+ read the memory before initialization that the pointer points to, such
+ as through other arguments.
+
+ The ``writable`` or ``dereferenceable`` attribute does not imply
+ ``initialized`` attribute, and ``initialized`` does not imply ``writeonly``
----------------
jvoung wrote:
nit: "does not imply [the] ``initialized`` attribute, and ... ``writeonly``, since ``initialized`` allows reading from the pointer after writing." ?
https://github.com/llvm/llvm-project/pull/84803
More information about the llvm-commits
mailing list