[PATCH] D41944: [LLVM][IR][LIT] support of 'no-overflow' flag for sdiv\udiv instructions

Nuno Lopes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 17 09:40:54 PST 2018


nlopes added a comment.

In https://reviews.llvm.org/D41944#978753, @magabari wrote:

> In https://reviews.llvm.org/D41944#978691, @nlopes wrote:
>
> > Before accepting this patch, we really need to see benchmark results. I'm not going to change clang to start emitting non-UB divs if the perf is going to be horrible. We need data.
> >  Otherwise I don't see the need for this poison version of division. Could you elaborate if your plan is to expose this somehow to the application developer?
> >
> > I'm sorry if this questions have been properly answered in the past. If so, could you please link them here?
>
>
> In general the proposed feature allows compiler to start speculating div without worrying too much of div-by-zero etc. so for example you can do instruction hoisting or vectorizing predicated sdiv.
>  We are currently focused on vectorizing predicated div instruction and our implementation shows around 20-30% improvements on several tests of coremark-pro and denbench.


I believe that in micro benchmarks that can be vectorized you can get nice speedups. The question is what happens end-to-end to regular applications?  Do I have a slowdown? Code size increase because now all my divisions are guarded?
Also, you could also guard those vectorizations around checks to ensure sdiv doesn't trap. This increases code size.


https://reviews.llvm.org/D41944





More information about the llvm-commits mailing list