Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions llvm/docs/LangRef.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1616,12 +1616,12 @@ Currently, only the following parameter attributes are defined:

``alignstack(<n>)``
This indicates the alignment that should be considered by the backend when
assigning this parameter to a stack slot during calling convention
lowering. The enforcement of the specified alignment is target-dependent,
as target-specific calling convention rules may override this value. This
attribute serves the purpose of carrying language specific alignment
information that is not mapped to base types in the backend (for example,
over-alignment specification through language attributes).
assigning this parameter or return value to a stack slot during calling
convention lowering. The enforcement of the specified alignment is
target-dependent, as target-specific calling convention rules may override
this value. This attribute serves the purpose of carrying language specific
alignment information that is not mapped to base types in the backend (for
example, over-alignment specification through language attributes).

``allocalign``
The function parameter marked with this attribute is the alignment in bytes of the
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/IR/Attributes.td
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def SExt : EnumAttr<"signext", IntersectPreserve, [ParamAttr, RetAttr]>;

/// Alignment of stack for function (3 bits) stored as log2 of alignment with
/// +1 bias 0 means unaligned (different from alignstack=(1)).
def StackAlignment : IntAttr<"alignstack", IntersectPreserve, [FnAttr, ParamAttr]>;
def StackAlignment : IntAttr<"alignstack", IntersectPreserve, [FnAttr, ParamAttr, RetAttr]>;

/// Function can be speculated.
def Speculatable : EnumAttr<"speculatable", IntersectAnd, [FnAttr]>;
Expand Down
11 changes: 8 additions & 3 deletions llvm/test/CodeGen/NVPTX/param-overalign.ll
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ define float @caller_md(float %a, float %b) {
ret float %r
}

define float @callee_md(%struct.float2 %a) {
define float @callee_md(%struct.float2 alignstack(8) %a) {
; CHECK-LABEL: .visible .func (.param .b32 func_retval0) callee_md(
; CHECK-NEXT: .param .align 8 .b8 callee_md_param_0[8]
; CHECK-NEXT: )
Expand Down Expand Up @@ -105,5 +105,10 @@ define float @callee(%struct.float2 alignstack(8) %a ) {
ret float %2
}

!nvvm.annotations = !{!0}
!0 = !{ptr @callee_md, !"align", i32 u0x00010008}
define alignstack(8) %struct.float2 @aligned_return(%struct.float2 %a ) {
; CHECK-LABEL: .visible .func (.param .align 8 .b8 func_retval0[8]) aligned_return(
; CHECK-NEXT: .param .align 4 .b8 aligned_return_param_0[8]
; CHECK-NEXT: )
; CHECK-NEXT: {
ret %struct.float2 %a
}
Loading