Patch: Code Bloat g++

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Tue Feb 29 03:13:00 GMT 2000


Hi Mark,

> I tried adding just the LBRAC/RBRAC elimination portion of your patch,
> which, if I read it correctly, is designed to avoid outputting stabs
> for blocks with no BLOCK_VARs.

This is correct.

> I only saw about a 0.5% improvement over the patch I installed
> recently that eliminates blocks with no code.  I guess it's still
> worth it, but it's less compelling with those numbers.  Would you try
> the test-case with which you obtained your original numbers, and just
> the LBRAC/RBRAC part of your patch, and compare with current CVS?

Below are the numbers. This is my full patch; I haven't measure the
compilation time, only the sizes of the files

     20000218  20000229  20000229   reduction
                          +patch
.s   31867379  19562565  13288847         32%
.o    4692128   3621432   3543096          2%

Also, I haven't disabled the part operating on function start
symbols. They only affect the assembler file size, so the numbers on
the object file size are those originating from the LBRAC/RBRAC code.

I made a shallow analysis of what blocks my code now
drops. Apparently, if functions get inlined, their parameters become
variables in a block. If all those variables are optimized-away
(i.e. if they don't live in hard registers), dbxout does not provide
debugging information for them, but it still dumps the blocks - e.g.
in

void print(int);

inline
int foo(int k)
{
  if(k>0)
    return 2*k;
  print(k);
  return k-2;
}

int main()
{
  int i;
  for(i=0;i<100;i++){
    i=foo(i);
  }
}


Here, with -O2, 'k' isn't seen in the debugging output, but some of
the blocks stay alive.

Regards,
Martin


More information about the Gcc-patches mailing list