[PATCH] D20653: LICM: Do not sink or hoist assume intrinsic calls.

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Wed May 25 17:35:47 PDT 2016


hfinkel added a comment.

In http://reviews.llvm.org/D20653#440307, @sanjoy wrote:

> In http://reviews.llvm.org/D20653#440289, @hfinkel wrote:
>
> > In http://reviews.llvm.org/D20653#440288, @sanjoy wrote:
> >
> > > In http://reviews.llvm.org/D20653#440282, @hfinkel wrote:
> > >
> > > > In http://reviews.llvm.org/D20653#440276, @sanjoy wrote:
> > > >
> > > > > Never mind, I was mistaken;  you can't hoist out a readnone nounwind function out of control flow anyway, and the same logic should hold for assumes.
> > > >
> > > >
> > > > Ah. Because of potential UB?
> > >
> > >
> > > Yes, an implementation of assume could be `void assume(bool cond) { if (!cond) 1/0; }`.
> >
> >
> > Yes, but don't we normally assume that this UB concern does not apply to intrinsics?
>
>
> I wasn't aware of such a restriction -- can you spell it out explicitly?  We do have intrinsics like patchpoint and statepoint that can execute arbitrary code, so stating that intrinsics have no UB at all is probably not okay.


Good point, although those aren't marked as readnone. I'm quite possibly mistaken on this point, although it seems like we should have some kind of distinction on this front since most readnone intrinsics don't have value-dependent UB. We might need a safe-to-speculate attribute or something like that, however.


http://reviews.llvm.org/D20653





More information about the llvm-commits mailing list