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: Optimization question


Piotr Wyderski wrote:
Why does it generate the instructions pointed to by (<=== HERE)?
The most mysterious one is at 46fa2: the value is never used.
If it were eliminated, the stack frame management code would be
useless too. Where's the source of such artifacts and how can
I avoid them?

You didn't provide a compilable testcase. Without a testcase, we can't say with any certainty what happened.


It appears that the iterator i got allocated to a stack slot. Once we have writes to the stack, it is very difficult to eliminate them, as that requires a fully general alias analysis pass, which is a hard problem to solve.

There is a good chance that this is already fixed in gcc mainline. gcc has always had a tendency to allocate variables to regs or stack before performing optimizations, which caused optimization problems for everything that got allocated to a stack slot. Current mainline will do some optimizations before putting variables into stack slots, thus sometimes avoiding problems like this.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



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