about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-08-13 04:18:43 +0000
committerbors <bors@rust-lang.org>2025-08-13 04:18:43 +0000
commitb1b26b834d85e84b46aa8f8f3ce210a1627aa85f (patch)
tree1d09c4145bbd2d30c533336c84f14fdaf04f0e75 /library/std/src
parent1553adfe6884a8f6c28f5a673d3e605535ee0113 (diff)
parentebef9d7f6387fb0541a0dab48d1cd1f86556df04 (diff)
downloadrust-b1b26b834d85e84b46aa8f8f3ce210a1627aa85f.tar.gz
rust-b1b26b834d85e84b46aa8f8f3ce210a1627aa85f.zip
Auto merge of #145093 - nikic:dead-on-return, r=nnethercote
Set dead_on_return attribute for indirect arguments

Set the dead_on_return attribute (added in LLVM 21) for arguments that are passed indirectly, but not byval.

This indicates that the value of the argument on return does not matter, enabling additional dead store elimination.

From LangRef:

> This attribute indicates that the memory pointed to by the argument is dead upon function return, both upon normal return and if the calls unwinds, meaning that the caller will not depend on its contents. Stores that would be observable either on the return path or on the unwind 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 function return. The caller may access the memory, but any load not preceded by a store will return poison.
>
> This attribute does not imply aliasing properties. For pointer arguments that do not alias other memory locations, noalias attribute may be used in conjunction. Conversely, this attribute always implies dead_on_unwind.
>
> This attribute cannot be applied to return values.

This fixes parts of https://github.com/rust-lang/rust/issues/96497.
Diffstat (limited to 'library/std/src')
0 files changed, 0 insertions, 0 deletions