[llvm] [IR] Add nofreeobj parameter/return attribute (PR #206445)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 03:49:53 PDT 2026


================
@@ -1574,6 +1574,17 @@ Currently, only the following parameter attributes are defined:
 
     This is not a valid attribute for return values.
 
+``nofreeobj``
+    On arguments, this indicates that the underlying object of the argument
+    cannot be freed during the execution of the function (where "during" is in
+    the same sense as for ``nofree``).
+
+    On return values, this indicates that the underlying object of the return
+    value cannot be freed at all after this point.
+
+    Unlike ``nofree``, it is not possible to free the underlying object through
+    a different pointer either.
----------------
antoniofrighetto wrote:

Following up on https://github.com/llvm/llvm-project/pull/195658#issuecomment-4386465882, should we be explicit and mention the interaction with noalias (nofreeobj being primarily useful in cases noalias does not apply)?

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


More information about the llvm-commits mailing list