This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Use fixed_nonglobal_reg_set to deduce ok_regs (PR rtl-optimization/79728)
- From: Xi Ruoyao <ryxi at stu dot xidian dot edu dot cn>
- To: David Binderman <dcb314 at hotmail dot com>, Martin Liška <marxin at gcc dot gnu dot org>, Bernd Schmidt <bernds at gcc dot gnu dot org>
- Cc: Xi Ruoyao <ryxi at stu dot xidian dot edu dot cn>, gcc-patches at gcc dot gnu dot org
- Date: Mon, 06 Mar 2017 16:27:37 +0800
- Subject: [PATCH] Use fixed_nonglobal_reg_set to deduce ok_regs (PR rtl-optimization/79728)
- Authentication-results: sourceware.org; auth=none
Hi,
After Bernd fixed PR44281 (r235809), the registers fixed only because
they are global can be selected by IRA. However, since they are not
in ok_regs, the move cost estimation about them are wrong. Then an
assertion in ira.c failed and then ICE.
To fix this, add these registers into ok_regs.
Bootstrapped/regtested on x86_64-linux-gnu. Is this ok for trunk?
2017-03-06 Xi Ruoyao <ryxi@stu.xidian.edu.cn>
PR rtl-optimization/79728
* reginfo.c (init_reg_sets_1): Use fixed_nonglobal_reg_set
(instead of fixed_regs) to deduce ok_regs.
* gcc.target/i386/pr79728.c: New test.
diff --git a/gcc/reginfo.c b/gcc/reginfo.c
index a2e0b68..85e2695 100644
--- a/gcc/reginfo.c
+++ b/gcc/reginfo.c
@@ -471,7 +471,8 @@ init_reg_sets_1 (void)
HARD_REG_SET ok_regs;
CLEAR_HARD_REG_SET (ok_regs);
for (j = 0; j < FIRST_PSEUDO_REGISTER; j++)
- if (!fixed_regs [j] && HARD_REGNO_MODE_OK (j, (machine_mode) m))
+ if (!TEST_HARD_REG_BIT (fixed_nonglobal_reg_set, j) &&
+ HARD_REGNO_MODE_OK (j, (machine_mode) m))
SET_HARD_REG_BIT (ok_regs, j);
for (i = 0; i < N_REG_CLASSES; i++)
diff --git a/gcc/testsuite/gcc.target/i386/pr79728.c b/gcc/testsuite/gcc.target/i386/pr79728.c
new file mode 100644
index 0000000..2f3dede
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr79728.c
@@ -0,0 +1,11 @@
+/* Test for ICE with global register variable assigned to
+ xmm0. PR79728. */
+/* { dg-do compile } */
+/* { dg-options "-w -msse" } */
+
+register int a __asm__ ("xmm0");
+
+int foo ()
+{
+ return 0;
+}
--
Xi Ruoyao <ryxi@stu.xidian.edu.cn>
School of Aerospace Science and Technology, Xidian University