Skip to content

Commit f17861d

Browse files
committed
[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.
1 parent 11857be commit f17861d

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
@@ -11102,9 +11102,8 @@ Overview:
1110211102

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

1110911108
Arguments:
1111011109
""""""""""
@@ -11146,7 +11145,10 @@ which way the stack grows) is not specified.
1114611145

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

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

0 commit comments

Comments
 (0)