[PATCH] D20116: Add speculatable function attribute

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 14 16:30:07 PDT 2016


hfinkel added a comment.

In https://reviews.llvm.org/D20116#483719, @tstellarAMD wrote:

> Rename the attribute to speculatable.  This simplifies the patch a lot since 
>  we are no longer trying to solve the problem  where specifying one of
>  the memory properties for intrinsics implies that it has no side effects
>  (this should probably still be addressed in another patch).
>
> I wasn't sure exactly how to define the speculatable attribute
>  in the language ref, so I copied the definition from the
>  isSafeToSpeculativelyExecute() function.


Makes sense to me. Is the idea to have isSafeToSpeculativelyExecute() return true on functions with this attribute? I'd find it strange if this were not the plan. Do we plan to have FuncAttrs infer the attribute? I'm wondering if we should say something about cost and how that will be handled. We don't want to speculate expensive-to-execute functions even if it is legal.


================
Comment at: docs/LangRef.rst:1518
@@ -1516,1 +1517,3 @@
+    This function attribute indicates that the function does not have any
+    effects besides calculating the result and does not have undefined behavior.
 ``ssp``
----------------
Saying "its result", instead of "the result", reads better to me.


https://reviews.llvm.org/D20116





More information about the llvm-commits mailing list