This is the mail archive of the gcc-patches@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: ARM patch: Fix an if statement in arm_rtx_costs_1


On Tue, 2010-07-27 at 18:08 +0200, Bernd Schmidt wrote:
> In the ARM rtx_costs code, there's an if statement which consists of a
> logical or of two conditions, the second of which always implies the
> first.  This is nonsensical.  The if statement is intended to increase
> the cost of operations involving frame pointer or stack pointer, except
> for those where the second operand is constant.  This exception is
> broken by the presumably incorrect code, and even (plus (sp) (const)) is
> given a high cost.  This prevents some transformations in the new
> postreload optimization I added a while ago.  Interestingly it's a
> really old bug, the code was added in 1994.
> 
> The following patch fixes it; typical effects from postreload:
> -       add     r4, sp, #32
> -       subs    r6, r4, #4
> +       add     r6, sp, #28
> 
> It also seems to be beneficial in other ways; I've seen stack frames
> shrink for some functions.  Ok if it tests cleanly?
> 

OK.

R.


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