[llvm] [LangRef] Do not allow free via synchronization in nofree (PR #195658)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 04:09:52 PDT 2026


================
@@ -2326,22 +2338,21 @@ For example:
     internal linkage and only has one call site, so the original
     call is dead after inlining.
 ``nofree``
-    This function attribute indicates that the function does not, directly or
-    transitively, call a memory-deallocation function (``free``, for example)
-    on a memory allocation which existed before the call.
-
-    As a result, uncaptured pointers that are known to be dereferenceable
-    prior to a call to a function with the ``nofree`` attribute are still
-    known to be dereferenceable after the call. The capturing condition is
-    necessary in environments where the function might communicate the
-    pointer to another thread which then deallocates the memory.  Alternatively,
-    ``nosync`` would ensure such communication cannot happen and even captured
-    pointers cannot be freed by the function.
+    This function attribute indicates that the function does not free any memory
+    allocation which existed before the call, either through direct calls to
+    a memory-deallocation function like ``free``, or through synchronization.
+    Freeing through synchronization here means that a deallocation
+    happens-before the function exit but does not happens-before the function
----------------
antoniofrighetto wrote:

Oh, agree the hyphenated form shouldn't change.

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


More information about the llvm-commits mailing list