[llvm-commits] [llvm] r155616 - in /llvm/trunk: lib/Transforms/Scalar/Reassociate.cpp test/Transforms/Reassociate/mulfactor.ll

Chris Lattner clattner at apple.com
Sun Sep 30 09:54:57 PDT 2012

<catching up on old patches>

On Apr 25, 2012, at 10:30 PM, Chandler Carruth <chandlerc at gmail.com> wrote:
> Author: chandlerc
> Date: Thu Apr 26 00:30:30 2012
> New Revision: 155616
> URL: http://llvm.org/viewvc/llvm-project?rev=155616&view=rev
> Log:
> Teach the reassociate pass to fold chains of multiplies with repeated
> elements to minimize the number of multiplies required to compute the
> final result. This uses a heuristic to attempt to form near-optimal
> binary exponentiation-style multiply chains. While there are some cases
> it misses, it seems to at least a decent job on a very diverse range of
> inputs.
> Initial benchmarks show no interesting regressions, and an 8%
> improvement on SPASS. Let me know if any other interesting results (in
> either direction) crop up!

Very cool.  Did you guys consider extending llvm.powi to work on integers?  It seems cleaner for reassociate to fold repeated multiplication changes into a powi, and then have codegen do the optimal expansion for both floats and integers.


More information about the llvm-commits mailing list