This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC][PATCH][PR63586] Convert x+x+x+x into 4*x
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: kugan <kugan dot vivekanandarajah at linaro dot org>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 26 Feb 2016 12:07:36 +0100
- Subject: Re: [RFC][PATCH][PR63586] Convert x+x+x+x into 4*x
- Authentication-results: sourceware.org; auth=none
- References: <56CFC059 dot 40108 at linaro dot org>
On Fri, Feb 26, 2016 at 4:02 AM, kugan
<kugan.vivekanandarajah@linaro.org> wrote:
>
>
> Hi,
>
> This is an attempt to fix missed optimization: x+x+x+x -> 4*x as reported in
> PR63586.
>
> Regression tested and bootstrapped on x86-64-linux-gnu with no new
> regressions.
>
> Is this OK for next stage1?
That looks better, but I think the unordered_remove will break operand sorting
and thus you probably don't handle x + x + x + x + y + y + y + y + y +
y + z + z + z + z
optimally.
I'd say you simply want to avoid the recursion and collect a vector of
[start, end] pairs
before doing any modification to the ops vector.
Richard.
> Thanks,
> Kugan
>
>
> gcc/testsuite/ChangeLog:
>
> 2016-02-26 Kugan Vivekanandarajah <kuganv@linaro.org>
>
> PR middle-end/63586
> * gcc.dg/tree-ssa/reassoc-14.c: Fix multiply count.
>
> gcc/ChangeLog:
>
> 2016-02-26 Kugan Vivekanandarajah <kuganv@linaro.org>
>
> PR middle-end/63586
> * tree-ssa-reassoc.c (transform_add_to_multiply): New.
> (reassociate_bb): Call transform_add_to_multiply.
>
>