This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: stack height reduction in tree-SSA
Rakesh Kumar, Noida wrote:
> I feel that this problem could have been fixed in tree-SSA, but
> exactly opposite is done. [...]
> Is it that good to forget the scope of variable and allocate each
> one a new stack slot? I'm unable to get any reasons why the stack
> slots can't be shared. Please make me aware of the issues involved.
Yes. tree-ssa behaves very bad wrt stack allocation. There is at least an open
regression filed by me about it (http://gcc.gnu.org/PR16987). The bug that
tracks this problem is http://gcc.gnu.org/PR9997. Notice that, from what I
heard, the correct solution would be to share stack slots using the live ranges
of the variables, rather than the mere lexical scopes. For instance:
void foo(void)
{
int a, b;
a = get();
use_it(&a);
b = get();
use_it(&b);
}
could be optimized to use only one variable on the stack. I have the secret
hope that someone will eventually take care of this before 3.5 is release, but
it's just a hope. Surely, this bug alone regresses GCC badly for all embedded
systems.
Giovanni Bajo