[Bug target/43884] [4.4/4.5/4.6 Regression] Performance degradation for simple fibonacci numbers calculation due to extra stack alignment

hjl dot tools at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Apr 26 14:48:00 GMT 2010



------- Comment #13 from hjl dot tools at gmail dot com  2010-04-26 14:47 -------
(In reply to comment #12)
> Subject: Re:  [4.4/4.5/4.6 Regression] Performance
>         degradation for simple fibonacci numbers calculation due to extra
>         stack alignment
> 
> > That is true. For tail call, we only need to align outgoing stack to
> > minimum of maximum local stack alignment and incoming stack alignment.
> 
> Well, the tail call gets the same stack alignment as the function itself,
> so I guess when expanding a tail call, we need to bump up the incomming
> stack alignment to one needed by the call.
> 
> We should special case the self recursion and do nothing in case of tail
> calls and in case of normal calls.  In normal self recursive calls we need
> to remember the fact that function is self recursive and when finalizing
> be sure that outgoing stack alignment is at least as good as incomming.

The outgoing stack alignment should be the minimum of incoming and
local.  If incoming stack is 16byte aligned and local variable only
needs 4byte alignment, there is no difference in stack realignment
when incoming stack is 4byte, 8byte and 16byte aligned.

> This can not be decided at expansion time since we do not know yet what
> alignment function has.
> 
> Old preferred alignment code had this logic, I guess somehow this got
> broken during the merge of stack alignment branch?
> 

I will investigate.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43884



More information about the Gcc-bugs mailing list