[PATCH] D33774: [CodeGen] Make __attribute__(const) calls speculatable

Michael Kruse via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 1 06:01:59 PDT 2017


Meinersbur added a comment.

Definition of `__attibute__((const))` from https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes

> Many functions do not examine any values except their arguments, and have no effects except the return value. Basically this is just slightly more strict class than the pure attribute below, since function is not allowed to read global memory.
>  Note that a function that has pointer arguments and examines the data pointed to must not be declared const. Likewise, a function that calls a non-const function usually must not be const. It does not make sense for a const function to return void.

Definition of `speculatable` from http://llvm.org/docs/LangRef.html#function-attributes

> This function attribute indicates that the function does not have any effects besides calculating its result and does not have undefined behavior.


https://reviews.llvm.org/D33774





More information about the cfe-commits mailing list