Use fuse-caller-save info in cprop-hardreg
authorTom de Vries <tom@codesourcery.com>
Fri, 17 Oct 2014 06:36:45 +0000 (06:36 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Fri, 17 Oct 2014 06:36:45 +0000 (06:36 +0000)
2014-10-17  Tom de Vries  <tom@codesourcery.com>

PR rtl-optimization/61605
* regcprop.c (copyprop_hardreg_forward_1): Use
regs_invalidated_by_this_call instead of regs_invalidated_by_call.

* gcc.target/i386/fuse-caller-save.c: Update addition check.  Add movl
absence check.

From-SVN: r216365

gcc/ChangeLog
gcc/regcprop.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/fuse-caller-save.c

index af302053b98699d09b1d6b40cb52a85573e86a4b..22c440bc8c0d15d513048946fd76f56a8d306f12 100644 (file)
@@ -1,3 +1,9 @@
+2014-10-17  Tom de Vries  <tom@codesourcery.com>
+
+       PR rtl-optimization/61605
+       * regcprop.c (copyprop_hardreg_forward_1): Use
+       regs_invalidated_by_this_call instead of regs_invalidated_by_call.
+
 2014-10-17  Tom de Vries  <tom@codesourcery.com>
 
        PR rtl-optimization/61605
index 015366b34d55e4cbacb0554d8fc9ceb7626b49d7..262de1be046ff971f892941d2d533cb279f99a43 100644 (file)
@@ -1005,6 +1005,7 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
          unsigned int set_nregs = 0;
          unsigned int regno;
          rtx exp;
+         HARD_REG_SET regs_invalidated_by_this_call;
 
          for (exp = CALL_INSN_FUNCTION_USAGE (insn); exp; exp = XEXP (exp, 1))
            {
@@ -1023,8 +1024,11 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
                }
            }
 
+         get_call_reg_set_usage (insn,
+                                 &regs_invalidated_by_this_call,
+                                 regs_invalidated_by_call);
          for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
-           if ((TEST_HARD_REG_BIT (regs_invalidated_by_call, regno)
+           if ((TEST_HARD_REG_BIT (regs_invalidated_by_this_call, regno)
                 || HARD_REGNO_CALL_PART_CLOBBERED (regno, vd->e[regno].mode))
                && (regno < set_regno || regno >= set_regno + set_nregs))
              kill_value_regno (regno, 1, vd);
index e24b295a826b97752ca30f04f707990bb527fd73..218cb5628cfa0385faf2768ced0817d5192f39f0 100644 (file)
@@ -1,3 +1,9 @@
+2014-10-17  Tom de Vries  <tom@codesourcery.com>
+
+       PR rtl-optimization/61605
+       * gcc.target/i386/fuse-caller-save.c: Update addition check.  Add movl
+       absence check.
+
 2014-10-17  Markus Trippelsdorf  <markus@trippelsdorf.de>
 
        PR middle-end/61848
index 7e2b11d6d57ea7b1d697a56dd916f4ae9114589e..a6e8f1c17b396def90480f6fc0c8227059621539 100644 (file)
@@ -20,5 +20,13 @@ foo (int y)
 /* { dg-final { scan-assembler-not "push"  } } */
 /* { dg-final { scan-assembler-not "pop"  } } */
 
-/* Check that addition uses dx. */
-/* { dg-final { scan-assembler-times "addl\t%\[re\]?dx, %\[re\]?ax" 1 } } */
+/* PR61605.  If the first argument register and the return register differ, then
+   bar leaves the first argument register intact.  That means in foo that the
+   first argument register still contains y after bar has been called, and
+   there's no need to copy y to a different register before the call, to be able
+   to use it after the call.
+   Check that the copy is absent.  */
+/* { dg-final { scan-assembler-not "movl" { target { ! ia32 } } } } */
+
+/* Check that addition uses di (in case of no copy) or dx (in case of copy). */
+/* { dg-final { scan-assembler-times "addl\t%\[re\]?d\[ix\], %\[re\]?ax" 1 } } */