[PATCH] Don't flush all call_used_reg_set regs on call in var-tracking, just regs_invalidated_by_call (PR debug/43593)
Jakub Jelinek
jakub@redhat.com
Tue Mar 30 20:16:00 GMT 2010
Hi!
E.g. stack pointer and a bunch of other regs don't need to be
flushed in dataflow_set_clear_at_call and as the attached testcase
shows it helps debug info quality on both i?86 and x86-64 (also
hit several times on cc1/cc1plus itself). SP etc. are in call_used_regs
just because it must include all fixed regs, aren't really call used
and we have a special regset for what we really want -
regs_invalidated_by_call.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2010-03-30 Jakub Jelinek <jakub@redhat.com>
PR debug/43593
* var-tracking.c (dataflow_set_clear_at_call): Invalidate
just regs_invalidated_by_call instead all call_used_reg_set
registers.
* gcc.dg/guality/pr43593.c: New test.
--- gcc/var-tracking.c.jj 2010-03-30 10:23:29.000000000 +0200
+++ gcc/var-tracking.c 2010-03-30 12:09:37.000000000 +0200
@@ -4255,7 +4255,7 @@ dataflow_set_clear_at_call (dataflow_set
int r;
for (r = 0; r < FIRST_PSEUDO_REGISTER; r++)
- if (TEST_HARD_REG_BIT (call_used_reg_set, r))
+ if (TEST_HARD_REG_BIT (regs_invalidated_by_call, r))
var_regno_delete (set, r);
if (MAY_HAVE_DEBUG_INSNS)
--- gcc/testsuite/gcc.dg/guality/pr43593.c.jj 2010-03-30 22:02:14.000000000 +0200
+++ gcc/testsuite/gcc.dg/guality/pr43593.c 2010-03-30 22:08:21.000000000 +0200
@@ -0,0 +1,24 @@
+/* PR debug/43593 */
+/* { dg-do run } */
+/* { dg-options "-g" } */
+
+void __attribute__((noinline))
+bar (int *p)
+{
+ asm volatile ("" : : "r" (p) : "memory");
+}
+
+int __attribute__((noinline))
+foo (void)
+{
+ int i, *j = &i;
+ bar (j);
+ return 6 + i; /* { dg-final { gdb-test 16 "j" "&i" } } */
+}
+
+int
+main (void)
+{
+ foo ();
+ return 0;
+}
Jakub
More information about the Gcc-patches
mailing list