[PATCH] D20116: Add speculatable function attribute

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 14 19:34:27 PDT 2016


hfinkel added inline comments.

================
Comment at: docs/LangRef.rst:1516-1518
@@ -1515,2 +1515,5 @@
     (dynamic thread safety analysis) are enabled for this function.
+``speculatable``
+    This function attribute indicates that the function does not have any
+    effects besides calculating the result and does not have undefined behavior.
 ``ssp``
----------------
majnemer wrote:
> We should say something to indicate that speculatable does not imply CSE-able.  Unless I am mistaken, it is possible for a function to be speculatable but return different results given the same parameters.
> We should say something to indicate that speculatable does not imply CSE-able. Unless I am mistaken, it is possible for a function to be speculatable but return different results given the same parameters.

True; only a readnone speculatable function can be CSE'd. It might be readonly, but then you can't CSE it unless you know more about the memory it might access.


https://reviews.llvm.org/D20116





More information about the llvm-commits mailing list