As already discussed with Loic, CodeSourcery have a GCC patch that 
implements a new optimization: -fremove-local-statics.

Essentially, it transforms code like this:

     int foo (void) { static int a = 1; return a; }

into this:

     int foo (void) { int a = 1; return a; }

Admittedly, if the code is written like that you might argue that the 
auther gets what they deserve, but apparently at least one of the EEMBC 
benchmarks does have these, so now we all care about it.

This patch was originally submitted, by RedHat, to gcc-patches here:
   http://gcc.gnu.org/ml/gcc-patches/2008-07/subjects.html#00982

Some discussion later, they decided it would be better to implement the 
optimization using inter-procedural dead store analysis:
   http://gcc.gnu.org/ml/gcc-patches/2008-07/msg01602.html

This doesn't seem to have actually been done. Not yet, anyway.

So basically we're left with this patch that does something we want, but 
not in a way that can go upstream. :(

The question is, should I merge this to Linaro, or not? Loic and I 
agreed to hold off until I'd done a bit more research and/or tried to 
upstream it again, but now I think we need to think again.

Andrew

_______________________________________________
linaro-toolchain mailing list
linaro-toolchain@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-toolchain

Reply via email to