This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Stack use optimizations.
- To: Pal Engstad <engstad at hunt dot inmet dot com>
- Subject: Re: Stack use optimizations.
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Mon, 21 Dec 1998 19:53:20 -0700
- cc: egcs at cygnus dot com
- Reply-To: law at cygnus dot com
In message <347A7013.8C2226D0@hunt.inmet.com>you write:
> I've noticed some obvious optimizations not taking place in the later
> egcs versions. The most obvious one is this:
>
> struct bigstruct {
> double x;
> double y;
> double z;
> };
>
> double stackuse_2()
> {
> struct bigstruct x = { 1.0, 1.0, 0.0 };
> return 1.0;
> }
>
> First of all, the compiler does warn about a variable not being used,
egcs will warn about the unused variable now.
> but the compiler still tries to write variables onto the stack.
Yes. GCC does not currently have a dead store elimination pass.
> There has to be a way to tell if a value that is pushed onto the stack
> is never referred to.
Yes. Conceptually it is an easy problem. The implementation is nontrivial
though. Particularly for real code which has aliasing issues.
jeff