This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PTR-PLUS merge into the mainline
- From: Roman Zippel <zippel at linux-m68k dot org>
- To: Andrew Pinski <pinskia at gmail dot com>
- Cc: rguenther at suse dot de, Andrew_Pinski at playstation dot sony dot com, gcc at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Thu, 5 Jul 2007 01:24:52 +0200 (CEST)
- Subject: Re: PTR-PLUS merge into the mainline
- References: <OFC6AC01DD.DCB69225-ON88257309.0010816F-88257309.0010FB88@playstation.sony.com> <Pine.LNX.4.64.0706291545310.1820@scrub.home> <de8d50360706291427y6a7ec112n17367f6b42ab2e2b@mail.gmail.com>
Hi,
On Fri, 29 Jun 2007, Andrew Pinski wrote:
> > I'm not sure that's related, what's happening in my example is that the
> > call to fold_plusminus_mult_expr() defeats the optimization attempted in
> > pointer_int_sum(). If I use the patch below to restrict the condition, my
> > problem is fixed, but PR32120 is unchanged.
> > Actually if I compare the final_cleanup dump of PR32120 with the output
> > from gcc 4.1, they are basically identical.
>
> The code to fold_binary was added by:
> r107218 | rguenth | 2005-11-19 03:29:10 -0800 (Sat, 19 Nov 2005) | 9 lines
>
> 2005-11-19 Richard Guenther <rguenther@suse.de>
>
> PR middle-end/23294
> * fold-const.c (fold_plusminus_mult_expr): New function.
> (fold_binary): Use to canonicalize PLUS_EXPR and MINUS_EXPR
> cases, remove now unnecessary code.
>
> * gcc.dg/tree-ssa/pr23294.c: New testcase.
>
> And it looks like it was doing this transformation this way on purpose.
> Now as I mentioned before the way this should be done is using PRE/FRE
> to catch the redudent multiplication.
I have to agree, IMHO it looks this optimization is done to early.
Richard, it would be great if you comment on this.
Thanks.
bye, Roman