[PATCH] "speculatable" function attribute

Tobias Grosser tobias at grosser.es
Sun Jul 28 09:27:46 PDT 2013


On 07/28/2013 03:26 AM, Kuperstein, Michael M wrote:
> (Moving this to the mailing list where it belongs)
>
> Fixed CallInst, merged with Tobias' patch, and added a description to LangRef.
> Can someone check the LangRef description makes sense to anyone but me?

Hi,

thanks for adding the attributes.ll tests.

I think the LangRef entry looks good, but I don't have been involved 
enough in the previous discussions to OK this commit.

Cheers,
Tobi

P.S.: Some tiny formatting problems:

> Index: docs/LangRef.rst
> ===================================================================
> --- docs/LangRef.rst	(revision 187322)
> +++ docs/LangRef.rst	(working copy)

I get warnings about windows line endings in the patch parts of this file.

> @@ -919,6 +919,13 @@
>   ``sanitize_thread``
>       This attribute indicates that ThreadSanitizer checks
>       (dynamic thread safety analysis) are enabled for this function.
> +``speculatable``
> +    This attribute indicates that this function is safe to execute.
> +    speculatively. This implies the function may not:
> +

You have trailing white spaces here.

> +++ include/llvm/IR/Instructions.h	(working copy)
> @@ -1347,6 +1347,14 @@
>       addAttribute(AttributeSet::FunctionIndex, Attribute::NoDuplicate);
>     }
>
> +  /// \brief Determine if it is safe to speculatively execute this call
> +  bool isSafeToSpeculativelyExecute() const {
> +    return hasFnAttr(Attribute::Speculatable);
> +  }

Trailing white spaces here (and maybe an empty line between the two 
functions.

> @@ -615,13 +618,16 @@
>
>       ModRefKind modRef = getModRefKind(intrinsic);
>
> -    if (!intrinsic.canThrow || modRef || intrinsic.isNoReturn) {
> +    if (!intrinsic.canThrow || modRef || intrinsic.isNoReturn ||
> +                               intrinsic.isSafeToSpeculativelyExecute) {

The indentation seems to be off here.





More information about the llvm-commits mailing list