aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTom de Vries <tom@codesourcery.com>2014-10-17 06:36:45 +0000
committerTom de Vries <vries@gcc.gnu.org>2014-10-17 06:36:45 +0000
commit8d696651ab2212b79adb86abd2bdde4b88d56a8f (patch)
tree12ea390a5209af9b33f61090776f5ef97a5c1394 /gcc
parent8c8fe66309a90e2fffd1515650321ca934857357 (diff)
downloadgcc-8d696651ab2212b79adb86abd2bdde4b88d56a8f.zip
gcc-8d696651ab2212b79adb86abd2bdde4b88d56a8f.tar.gz
gcc-8d696651ab2212b79adb86abd2bdde4b88d56a8f.tar.bz2
Use fuse-caller-save info in cprop-hardreg
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/regcprop.c6
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.target/i386/fuse-caller-save.c12
4 files changed, 27 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index af30205..22c440b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,6 +1,12 @@
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
* regcprop.c (copyprop_hardreg_forward_1): Add copy_p and noop_p. Don't
notice stores for noops. Don't regard noops as copies.
diff --git a/gcc/regcprop.c b/gcc/regcprop.c
index 015366b..262de1b 100644
--- a/gcc/regcprop.c
+++ b/gcc/regcprop.c
@@ -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);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e24b295..218cb56 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
diff --git a/gcc/testsuite/gcc.target/i386/fuse-caller-save.c b/gcc/testsuite/gcc.target/i386/fuse-caller-save.c
index 7e2b11d..a6e8f1c 100644
--- a/gcc/testsuite/gcc.target/i386/fuse-caller-save.c
+++ b/gcc/testsuite/gcc.target/i386/fuse-caller-save.c
@@ -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 } } */