[llvm] [IR] Add `dead_on_return` attribute (PR #143271)
Ralf Jung via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 10 05:56:13 PDT 2025
================
@@ -1741,6 +1741,23 @@ Currently, only the following parameter attributes are defined:
This attribute cannot be applied to return values.
+``dead_on_return``
+ This attribute indicates that the memory pointed to by the argument is dead
+ upon normal function return, meaning that the caller will not depend on its
+ contents. Stores that would only be observable on the normal return path may
+ be elided.
+
+ Specifically, the behavior is as-if any memory written through the pointer
+ during the execution of the function is overwritten with a poison value
+ upon normal function return. The caller may access the memory, but any load
+ not preceded by a store will return poison.
----------------
RalfJung wrote:
Ah, I did not realize that there's already docs that talk about storing poison for dead_on_unwind.
https://github.com/llvm/llvm-project/pull/143271
More information about the llvm-commits
mailing list