Index: docs/LangRef.rst =================================================================== --- docs/LangRef.rst +++ docs/LangRef.rst @@ -1127,7 +1127,10 @@ is non-null. ``dereferenceable()`` - This indicates that the parameter or return pointer is dereferenceable. This + On a parameter, this indicates the parameter is dereferenceable for + the duration of the function. On a return value, this indicates the + returned value is dereferenceable for the duration of the program. + If the pointer cannot be dereferenced, the behavior is undefined. This attribute may only be applied to pointer typed parameters. A pointer that is dereferenceable can be loaded from speculatively without a risk of trapping. The number of bytes known to be dereferenceable must be provided @@ -7954,7 +7957,9 @@ The optional ``!dereferenceable`` metadata must reference a single metadata name ```` corresponding to a metadata node with one ``i64`` entry. The existence of the ``!dereferenceable`` metadata on the instruction -tells the optimizer that the value loaded is known to be dereferenceable. +tells the optimizer that the value loaded is known to be dereferenceable +at any later point in the program. If the pointer cannot be dereferenced, +the behavior is undefined. The number of bytes known to be dereferenceable is specified by the integer value in the metadata node. This is analogous to the ''dereferenceable'' attribute on parameters and return values. This metadata can only be applied @@ -7964,7 +7969,8 @@ metadata name ```` corresponding to a metadata node with one ``i64`` entry. The existence of the ``!dereferenceable_or_null`` metadata on the instruction tells the optimizer that the value loaded is known to be either -dereferenceable or null. +dereferenceable or null at any later point in the program. If the pointer +cannot be dereferenced and is not null, the behavior is undefined. The number of bytes known to be dereferenceable is specified by the integer value in the metadata node. This is analogous to the ''dereferenceable_or_null'' attribute on parameters and return values. This metadata can only be applied