This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
reinit regs upon global reg variable (IRA regression)
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: vmakarov at redhat dot com, jakub at redhat dot com, gcosta at redhat dot com
- Date: Wed, 18 Mar 2009 21:46:22 -0300
- Subject: reinit regs upon global reg variable (IRA regression)
QEMU for x86 declares a global variable with register asm("%ebp"). GCC
trunk will miscompile it, using %ebp for normal register allocation
(rather than frame pointer; it compiles with -O2 -fomit-frame-pointer),
which ends up clobbering the variable.
There's a testcase at
https://bugzilla.redhat.com/show_bug.cgi?id=490509
compute_all_subb is one of the functions that displays the problem.
Turns out the new register allocation is using outdated information:
available (rather than fixed) register information in each register
class is computed before compilation starts, but it wasn't updated when
new registers became global, and IRA needs this information to be
updated.
This patch fixes it.
Bootstrapped and regression tested on i686-linux-gnu and
x86_64-linux-gnu. Ok to install?
Jakub, would you please check this in if it's approved; I'm leaving on a
trip tomorrow morning, and I don't expect to have much
Internet-connected computer time before Monday, at the earliest.
Thanks,
for gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* reginfo.c (globalize_reg): Recompute derived reg sets.
Index: gcc/reginfo.c
===================================================================
--- gcc/reginfo.c.orig 2009-03-01 02:16:18.000000000 -0300
+++ gcc/reginfo.c 2009-03-17 00:34:49.000000000 -0300
@@ -875,6 +875,8 @@ globalize_reg (int i)
SET_HARD_REG_BIT (fixed_reg_set, i);
SET_HARD_REG_BIT (call_used_reg_set, i);
SET_HARD_REG_BIT (call_fixed_reg_set, i);
+
+ reinit_regs ();
}
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/ FSF Latin America board member
Free Software Evangelist Red Hat Brazil Compiler Engineer