[llvm] [LangRef][IR] Fix default AS documentation for allocas without explicit AS (PR #135942)
Fabian Ritter via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 16 02:20:52 PDT 2025
https://github.com/ritter-x2a created https://github.com/llvm/llvm-project/pull/135942
So far, the Language Reference said that the alloca address space from the datalayout is used if no explicit address space is provided, which is not what the LLParser and the AsmWriter implement. This patch adjusts the documentation to match the implementation: The default AS 0 is used if none is explicitly specified.
This is an alternative to PR #135786, which would change the parser's behavior to match the Language Reference instead.
>From f17861da1d11152c4195b86bff6c656ba64fd87d Mon Sep 17 00:00:00 2001
From: Fabian Ritter <fabian.ritter at amd.com>
Date: Wed, 16 Apr 2025 05:06:30 -0400
Subject: [PATCH] [LangRef][IR] Fix default AS documentation for allocas
without explicit AS
So far, the Language Reference said that the alloca address space from
the datalayout is used if no explicit address space is provided, which
is not what the LLParser and the AsmWriter implement. This patch adjusts
the documentation to match the implementation: The default AS 0 is used
if none is explicitly specified.
This is an alternative to PR #135786, which would change the parser's
behavior to match the Language Reference instead.
---
llvm/docs/LangRef.rst | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 769003a90f959..ba2c4467703cf 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -11102,9 +11102,8 @@ Overview:
The '``alloca``' instruction allocates memory on the stack frame of the
currently executing function, to be automatically released when this
-function returns to its caller. If the address space is not explicitly
-specified, the object is allocated in the alloca address space from the
-:ref:`datalayout string<langref_datalayout>`.
+function returns to its caller. If the address space is not explicitly
+specified, the default address space 0 is used.
Arguments:
""""""""""
@@ -11146,7 +11145,10 @@ which way the stack grows) is not specified.
Note that '``alloca``' outside of the alloca address space from the
:ref:`datalayout string<langref_datalayout>` is meaningful only if the
-target has assigned it a semantics.
+target has assigned it a semantics. For targets that specify a non-zero alloca
+address space in the :ref:`datalayout string<langref_datalayout>`, the alloca
+address space needs to be explicitly specified in the instruction if it is to be
+used.
If the returned pointer is used by :ref:`llvm.lifetime.start <int_lifestart>`,
the returned object is initially dead.
More information about the llvm-commits
mailing list