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]

Re: Stack use optimizations.



  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


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