This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa] extra copy


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]