stack height reduction in tree-SSA

Mike Stump mrs@apple.com
Wed Sep 1 17:57:00 GMT 2004


On Tuesday, August 31, 2004, at 10:41  PM, Rakesh Kumar, Noida wrote:
> Apparantly, 'a' and 'b' can share same stack slot. I feel
> that this problem could have been fixed in tree-SSA, but
> exactly opposite is done.

> I'm unable to get any reasons why the stack
> slots can't be shared.

Historically, gcc did better, then, aliasing was improved, but then it 
didn't track lifetimes of the independent variables and it would let 
the optimizer move code based upon the alias analysis and generate 
incorrect code.  To fix this, either, they had to mark them as can 
alias anything, or not reuse the space, they choose to not reuse the 
space...  and that decision is preserved in the top of the tree.

char buf[100] would be a bad testcase, try:

float f[20];
double d[10];

...

If we used a new alias set that was defined to conflict with the two 
original sets involved for each of the large variables, I think we 
could fix the original problem... not that others would not exist.  For 
small variables, I think not reusing may be best, though, that's really 
up to the scheduler in general.



More information about the Gcc mailing list