[llvm] 784dc16 - [LangRef][IR] Fix default AS documentation for allocas without explicit AS (#135942)

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 21 23:32:06 PDT 2025


Author: Fabian Ritter
Date: 2025-04-22T08:32:03+02:00
New Revision: 784dc16088885ebb28437ae2dbb90dcfd5df0457

URL: https://github.com/llvm/llvm-project/commit/784dc16088885ebb28437ae2dbb90dcfd5df0457
DIFF: https://github.com/llvm/llvm-project/commit/784dc16088885ebb28437ae2dbb90dcfd5df0457.diff

LOG: [LangRef][IR] Fix default AS documentation for allocas without explicit AS (#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.

Added: 
    

Modified: 
    llvm/docs/LangRef.rst

Removed: 
    


################################################################################
diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index a5df82895d839..9e78f317bd9ea 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -11104,9 +11104,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:
 """"""""""
@@ -11148,7 +11147,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