[llvm] Add 'initialized' attribute langref (PR #84803)

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 13 14:02:11 PDT 2024


================
@@ -1621,6 +1621,31 @@ Currently, only the following parameter attributes are defined:
     ``readonly`` or a ``memory`` attribute that does not contain
     ``argmem: write``.
 
+``initialized((Lo1,Hi1),...)``
+    This attribute indicates that the function initializes the ranges of the
+    pointer parameter's memory, [%p+LoN, %p+HiN): there are no reads, and no
+    special accesses (such as volatile access or untrackable capture) before
+    the initialization write in the function.
+
+    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.
+
+    Note that this attribute does not apply to the unwind edge: the
+    initializing function does not read the pointer before writing to it
+    regardless of unwinding or not, but the memory may not actually be
+    written to when unwinding happens.
+
+    The ``writable`` or ``dereferenceable`` attribute does not imply the
+    ``initialized`` attribute, and ``initialized`` does not imply ``writeonly``
+    since ``initialized`` allows reading from the pointer after writing.
+
+    This attribute is a list of const ranges in ascending order with no
+    overlapping or adjoining list elements. LoN/HiN are 64-bit ints, and
----------------
aeubanks wrote:

put `LoN`/`HiN` in double backticks

https://github.com/llvm/llvm-project/pull/84803


More information about the llvm-commits mailing list