[llvm] [IR] Allow nofree metadata to inttoptr (PR #153149)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 19 00:50:40 PDT 2025


================
@@ -12617,6 +12625,12 @@ metadata name ``<deref_bytes_node>`` corresponding to a metadata node with one
 ``i64`` entry.
 See ``dereferenceable_or_null`` metadata.
 
+The optional ``!nofree`` metadata must reference a single metadata name
+``<empty_node>`` corresponding to a metadata node with no entries.
+The existence of the ``!nofree`` metadata on the instruction tells the optimizer
+that the memory pointed by the pointer will not be freed during the execution of
+the function.
----------------
nikic wrote:

"will not be freed during the execution of the function" seems like a problematic definition to me: Doesn't this mean that this metadata must be dropped during during inlining, otherwise it may extend the scope that "nofree" applies to?

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


More information about the llvm-commits mailing list