Skip to content

Commit 784dc16

Browse files
authored
[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.
1 parent 497382e commit 784dc16

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

llvm/docs/LangRef.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11104,9 +11104,8 @@ Overview:
1110411104

1110511105
The '``alloca``' instruction allocates memory on the stack frame of the
1110611106
currently executing function, to be automatically released when this
11107-
function returns to its caller. If the address space is not explicitly
11108-
specified, the object is allocated in the alloca address space from the
11109-
:ref:`datalayout string<langref_datalayout>`.
11107+
function returns to its caller. If the address space is not explicitly
11108+
specified, the default address space 0 is used.
1111011109

1111111110
Arguments:
1111211111
""""""""""
@@ -11148,7 +11147,10 @@ which way the stack grows) is not specified.
1114811147

1114911148
Note that '``alloca``' outside of the alloca address space from the
1115011149
:ref:`datalayout string<langref_datalayout>` is meaningful only if the
11151-
target has assigned it a semantics.
11150+
target has assigned it a semantics. For targets that specify a non-zero alloca
11151+
address space in the :ref:`datalayout string<langref_datalayout>`, the alloca
11152+
address space needs to be explicitly specified in the instruction if it is to be
11153+
used.
1115211154

1115311155
If the returned pointer is used by :ref:`llvm.lifetime.start <int_lifestart>`,
1115411156
the returned object is initially dead.

0 commit comments

Comments
 (0)