[llvm-commits] [llvm] r164173 - in /llvm/trunk: include/llvm/Transforms/Utils/IntegerDivision.h lib/Transforms/Utils/CMakeLists.txt lib/Transforms/Utils/IntegerDivision.cpp
Joerg Sonnenberger
joerg at britannica.bec.de
Wed Sep 19 14:14:55 PDT 2012
On Tue, Sep 18, 2012 at 06:48:38PM -0700, Eli Friedman wrote:
> On Tue, Sep 18, 2012 at 5:42 PM, Evan Cheng <evan.cheng at apple.com> wrote:
> >> There are a lot of missed optimization opportunities here, e.g.
> >> dividing by a constant; have you considered anything in this area?
> >
> > Instcombine etc. should have optimized a lot of cases. This is intended to expand the cases that survived optimization.
>
> Instcombine won't touch, e.g. x/3, and there are substantially faster
> ways to perform that operation.
One interesting consideration would be turning something like:
a /= d;
b /= d;
c /= d;
into code that computes the inverse factor and shift for d to turn this
into the corresponding multiplications. For which number of divisions
this is a net win depends a lot on the platform, I expect it to be a win
for all platforms involving external division code though.
Joerg
More information about the llvm-commits
mailing list