[PATCH] D20116: Add speculatable function attribute

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 22 15:23:43 PDT 2017


hfinkel added a comment.

In https://reviews.llvm.org/D20116#708076, @mehdi_amini wrote:

> In https://reviews.llvm.org/D20116#707954, @sanjoy wrote:
>
> > If we go with (2), then we've admitted that "dead code" (that is, code that is not run) can influence program behavior, which I find troubling.
>
>
> That troubles (and worries) me as well.


Why? That's part of the promise we make when we tag the code as speculatable. We promise that doing the operation early, even in cases where it might otherwise have been performed, is fine. Furthermore, we're promising that any properties the call has (e.g. promising that a certain argument is nonnull) must not be control dependent. As a result, looking at it as dead code affecting live code is suboptimal; any other properties are just a kind of global assertion.


https://reviews.llvm.org/D20116





More information about the llvm-commits mailing list