This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] extra copy
- From: Joe Buck <jbuck at synopsys dot com>
- To: Dan Nicolaescu <dann at ics dot uci dot edu>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 13 Nov 2003 12:08:20 -0800
- Subject: Re: [tree-ssa] extra copy
- References: <200311131948.hADJmQLE005986@gremlin.ics.uci.edu>
On Thu, Nov 13, 2003 at 11:46:38AM -0800, Dan Nicolaescu wrote:
>
> When compiled with -DEXTRA the snippet below generates worse
> code than when not using -DEXTRA
>
> struct Complex_i
> {
> int re;
> int im;
> };
>
> struct Complex_i Zi;
>
> void bar()
> {
> struct Complex_i * factorpointer;
> struct Complex_i factor;
> factor.re = 123;
> factor.im = 428;
> #ifdef EXTRA
> factorpointer = &factor; /* factorpointer is never used! */
> #endif
> Zi = factor;
> }
>
>
> Looking at the .generic dump when using -DEXTRA:
>
> bar ()
> {
> struct Complex_i factor.1;
> struct Complex_i * factorpointer;
> struct Complex_i factor;
>
> factor.re = 123;
> factor.im = 428;
> factorpointer = &factor;
> factor.1 = factor; <- extra copy created here
> Zi = factor.1;
> }
>
> and extra var "factor.1" and a copy statement are created.
>
> The copyprop pass (or any other pass) does not get rid of the extra
> copy, and the RTL optimizers don't do it either.
Solve this one and C++ will suddenly get much better.