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]

ARM patch: Fix an if statement in arm_rtx_costs_1


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?


Bernd

Attachment: arm-framecost.diff
Description: Text document


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