@@ -1160,22 +1160,40 @@ The return type and each parameter of a function type may have a set of
11601160used to communicate additional information about the result or
11611161parameters of a function. Parameter attributes are considered to be part
11621162of the function, not of the function type, so functions with different
1163- parameter attributes can have the same function type.
1163+ parameter attributes can have the same function type. Parameter attributes can
1164+ be placed both on function declarations/definitions, and at call-sites.
11641165
11651166Parameter attributes are either simple keywords or strings that follow the
11661167specified type. Multiple parameter attributes, when required, are separated by
11671168spaces. For example:
11681169
11691170.. code-block:: llvm
11701171
1172+ ; On function declarations/definitions:
11711173 declare i32 @printf(ptr noalias nocapture, ...)
11721174 declare i32 @atoi(i8 zeroext)
11731175 declare signext i8 @returns_signed_char()
11741176 define void @baz(i32 "amdgpu-flat-work-group-size"="1,256" %x)
11751177
1178+ ; On call-sites:
1179+ call i32 @atoi(i8 zeroext %x)
1180+ call signext i8 @returns_signed_char()
1181+
11761182Note that any attributes for the function result (``nonnull``,
11771183``signext``) come before the result type.
11781184
1185+ Parameter attributes can be broadly separated into two kinds: ABI attributes
1186+ that affect how values are passed to/from functions, like ``zeroext``,
1187+ ``inreg``, ``byval``, or ``sret``. And optimization attributes, which provide
1188+ additional optimization guarantees, like ``noalias``, ``nonnull`` and
1189+ ``dereferenceable``.
1190+
1191+ ABI attributes must be specified *both* at the function declaration/definition
1192+ and call-site, otherwise the behavior may be undefined. ABI attributes cannot
1193+ be safely dropped. Optimization attributes do not have to match between
1194+ call-site and function: The intersection of their implied semantics applies.
1195+ Optimization attributes can also be freely dropped.
1196+
11791197If an integer argument to a function is not marked signext/zeroext/noext, the
11801198kind of extension used is target-specific. Some targets depend for
11811199correctness on the kind of extension to be explicitly specified.
@@ -1500,6 +1518,9 @@ Currently, only the following parameter attributes are defined:
15001518 undefined. Note that this does not refer to padding introduced by the
15011519 type's storage representation.
15021520
1521+ If memory sanitizer is enabled, ``noundef`` becomes an ABI attribute and
1522+ must match between the call-site and the function definition.
1523+
15031524.. _nofpclass:
15041525
15051526``nofpclass(<test mask>)``
0 commit comments