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]

[PATCH] Use fixed_nonglobal_reg_set to deduce ok_regs (PR rtl-optimization/79728)


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


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