This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Simple reassoc transforms in match.pd
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Marc Glisse <marc dot glisse at inria dot fr>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 26 Jun 2017 12:16:40 +0200
- Subject: Re: Simple reassoc transforms in match.pd
- Authentication-results: sourceware.org; auth=none
- References: <alpine.DEB.2.02.1706231505540.20818@stedding.saclay.inria.fr>
On Fri, Jun 23, 2017 at 3:12 PM, Marc Glisse <marc.glisse@inria.fr> wrote:
> Hello,
>
> here are a few simple transformations, mostly useful for types with
> undefined overflow where we do not have reassoc.
>
> I did not name the testcase reassoc-* to leave that namespace to the realloc
> pass, and -fno-tree-reassoc is just in case someone ever enhances that
> pass...
You probably saw
/* (T)(P + A) - (T)(P + B) -> (T)A - (T)B */
(for add (plus pointer_plus)
(simplify
(minus (convert (add @@0 @1))
(convert (add @0 @2)))
as you didn't duplicate its functionality. It misses a :c in one of
the adds for the
PLUS_EXPR case though so it might be worth splitting that out near to your
added cases? Which then raises the question of handling conversions around
the inner ops in your patterns?
I think the patch is ok as-is but we could improve this as a followup maybe?
Thanks,
Richard.
> Bootstrap + testsuite on powerpc64le-unknown-linux-gnu.
>
> 2017-06-23 Marc Glisse <marc.glisse@inria.fr>
>
> gcc/
> * match.pd ((A+-B)+(C-A), (A+B)-(A-C)): New transformations.
>
> gcc/testsuite/
> * gcc.dg/tree-ssa/assoc-1.c: New file.
>
> --
> Marc Glisse