[llvm] [IR] LangRef: document behavior of double-lifetime.start (PR #184296)

Ralf Jung via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 07:23:48 PST 2026


https://github.com/RalfJung updated https://github.com/llvm/llvm-project/pull/184296

>From b5d103d23ed5ec220d544ae19815169acc1c2788 Mon Sep 17 00:00:00 2001
From: Ralf Jung <post at ralfj.de>
Date: Tue, 3 Mar 2026 08:43:53 +0100
Subject: [PATCH 1/2] [IR] LangRef: document behavior of double-lifetime.start

---
 llvm/docs/LangRef.rst | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index a1835436ae359..b4a10c0befaa9 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -27731,10 +27731,12 @@ If ``ptr`` is a ``poison`` value, the intrinsic has no effect.
 Otherwise, the stack-allocated object that ``ptr`` points to is initially
 marked as dead. After '``llvm.lifetime.start``', the stack object is marked as
 alive and has an uninitialized value.
-The stack object is marked as dead when either
+Calling ``llvm.lifetime.start`` when the stack object is already alive just
+resets its contents to be uninitialized.
+
+The stack object is marked as dead again when either
 :ref:`llvm.lifetime.end <int_lifeend>` to the alloca is executed or the
 function returns.
-
 After :ref:`llvm.lifetime.end <int_lifeend>` is called,
 '``llvm.lifetime.start``' on the stack object can be called again.
 The second '``llvm.lifetime.start``' call marks the object as alive, but it

>From ca2a1317b6031fbf1f821421a1ceedc8dc6619b5 Mon Sep 17 00:00:00 2001
From: Ralf Jung <post at ralfj.de>
Date: Tue, 3 Mar 2026 13:59:23 +0100
Subject: [PATCH 2/2] clarify well-formedness requirements for lifetime
 intrinsics

---
 llvm/docs/LangRef.rst | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index b4a10c0befaa9..a42d8b3e8be0a 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -27720,8 +27720,8 @@ object's lifetime.
 Arguments:
 """"""""""
 
-The argument is either a pointer to an ``alloca`` instruction or a ``poison``
-value.
+The argument is either a ``poison`` value or an SSA variable whose defining
+instruction is ``alloca``. Otherwise, the IR is considered ill-formed.
 
 Semantics:
 """"""""""
@@ -27763,8 +27763,8 @@ The '``llvm.lifetime.end``' intrinsic specifies the end of a
 Arguments:
 """"""""""
 
-The argument is either a pointer to an ``alloca`` instruction or a ``poison``
-value.
+The argument is either a ``poison`` value or an SSA variable whose defining
+instruction is ``alloca``. Otherwise, the IR is considered ill-formed.
 
 Semantics:
 """"""""""



More information about the llvm-commits mailing list