[PATCH] D20116: Add speculatable function attribute

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 22 16:17:10 PDT 2017


hfinkel added a comment.

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

> In https://reviews.llvm.org/D20116#708109, @hfinkel wrote:
>
> > In https://reviews.llvm.org/D20116#708076, @mehdi_amini wrote:
> >
> > > That troubles (and worries) me as well.
> >
> >
> > Why?
>
>
> Irrational fear? ;-)


;-)

> It seems unusual, and I'm cautious about introducing unusual properties in the compiler in general, it makes it harder to reason about "stuff" when there aren't "simple" rules to guide the logic.
>  Are there existing other cases of UB induced by unreachable/dead code?

Not as far as I know, but this is because we normally need to conservatively assume there might be control dependencies on just about everything we can't completely understand (i.e. a call to a function). This is novel because we're explicitly saying that there aren't such dependencies. This makes validity assertions more "global" (this is how I look at it), meaning that it matters less where in the CFG you put them (even in dead regions). The point is that, in some cases, this is exactly what we want and mean.


https://reviews.llvm.org/D20116





More information about the llvm-commits mailing list