This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Reload inheritance bug with eliminated frame pointer
- From: "Ulrich Weigand" <Ulrich dot Weigand at de dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 10 Apr 2002 13:34:04 +0200
- Subject: [PATCH] Reload inheritance bug with eliminated frame pointer
- Sensitivity:
Hello,
as pointed out in
http://gcc.gnu.org/ml/gcc/2002-04/msg00293.html
there's a bug in reload inheritance when frame pointer elimination
is done.
This patch tries to fix the problem (at least my test case is fixed)
by removing the special cases for HARD_FRAME_POINTER_REGNUM in
choose_reload_regs *if frame_pointer_needed is false*, because
in that case, the register is just used as regular spill register.
Bootstrapped/regtested on s390-ibm-linux and s390x-ibm-linux,
both on the branch and on the trunk.
OK for branch / trunk?
ChangeLog:
* reload1.c (choose_reload_regs): HARD_FRAME_POINTER_REGNUM
is only used as frame pointer when frame_pointer_needed is true.
Index: gcc/reload1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload1.c,v
retrieving revision 1.325.2.4
diff -c -p -r1.325.2.4 reload1.c
*** gcc/reload1.c 29 Mar 2002 06:16:58 -0000 1.325.2.4
--- gcc/reload1.c 9 Apr 2002 15:49:26 -0000
*************** choose_reload_regs (chain)
*** 5565,5570 ****
--- 5565,5571 ----
&& ! TEST_HARD_REG_BIT (reg_reloaded_dead, i))
/* Don't clobber the frame pointer. */
|| (i == HARD_FRAME_POINTER_REGNUM
+ && frame_pointer_needed
&& rld[r].out)
/* Don't really use the inherited spill reg
if we need it wider than we've got it. */
*************** choose_reload_regs (chain)
*** 5735,5741 ****
/* If we found an equivalent reg, say no code need be generated
to load it, and use it as our reload reg. */
! if (equiv != 0 && regno != HARD_FRAME_POINTER_REGNUM)
{
int nr = HARD_REGNO_NREGS (regno, rld[r].mode);
int k;
--- 5736,5744 ----
/* If we found an equivalent reg, say no code need be generated
to load it, and use it as our reload reg. */
! if (equiv != 0
! && (regno != HARD_FRAME_POINTER_REGNUM
! || !frame_pointer_needed))
{
int nr = HARD_REGNO_NREGS (regno, rld[r].mode);
int k;
Mit freundlichen Gruessen / Best Regards
Ulrich Weigand
--
Dr. Ulrich Weigand
Linux for S/390 Design & Development
IBM Deutschland Entwicklung GmbH, Schoenaicher Str. 220, 71032 Boeblingen
Phone: +49-7031/16-3727 --- Email: Ulrich.Weigand@de.ibm.com