[PATCH] D20116: Add speculatable function attribute

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 26 14:19:30 PDT 2017


mehdi_amini added a comment.

In https://reviews.llvm.org/D20116#710866, @nlopes wrote:

> Then we have an orthogonal concern which is what's the precondition that is sufficient to justify an optimization. For example, whether a function call can be executed speculatively is one of such preconditions. It can be derived by looking at the function attributes.  For example, for speculative execution we probably need to know that the function doesn't write to memory and that it terminates.


It is not enough (for example division by zero).

> So I feel that this speculatable attribute is not the right answer. It should be a helper function that derives its result from a set of function attributes, but shouldn't be an attribute on its own.

Feel free to propose an alternative solution, right now there is no combination of attributes that is enough.

> The only reason I could see to have it as an attribute would be to carry cost information.

I'm not convinced that attributes should carry "cost" information, is there a precedent for this?


https://reviews.llvm.org/D20116





More information about the llvm-commits mailing list