This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Rerun df_analyze if delete_trivially_dead_insns deleted something during IRA (PR debug/47881)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Vladimir Makarov <vmakarov at redhat dot com>, Jeff Law <law at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 8 Mar 2011 16:33:04 +0100
- Subject: [PATCH] Rerun df_analyze if delete_trivially_dead_insns deleted something during IRA (PR debug/47881)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
If delete_trivially_dead_insns deletes some insn, DF state might be
out of date, and, what's worse, if there are pseudos set multiple times
referenced in debug_insns, where the debug_insn references were ok
before the deletions, but the deletions shortened lifetime of such a pseudo
in certain location, nothing resets the debug insns afterwards and we end up
with -fcompare-debug failures because the lifetime of the pseudos is
different between -g0 and -g.
Fixed by rerunning df_analyze () if delete_trivially_dead_insns removed
anything, bootstrapped/regtested on x86_64-linux and i686-linux.
Ok for trunk?
2011-03-07 Jakub Jelinek <jakub@redhat.com>
PR debug/47881
* ira.c (ira): Call df_analyze again if delete_trivially_dead_insns
removed anything.
* gcc.dg/pr47881.c: New test.
--- gcc/ira.c.jj 2011-02-21 15:37:42.000000000 +0100
+++ gcc/ira.c 2011-03-07 12:33:59.000000000 +0100
@@ -3232,7 +3232,8 @@ ira (FILE *f)
check_allocation ();
#endif
- delete_trivially_dead_insns (get_insns (), max_reg_num ());
+ if (delete_trivially_dead_insns (get_insns (), max_reg_num ()))
+ df_analyze ();
init_reg_equiv_memory_loc ();
--- gcc/testsuite/gcc.dg/pr47881.c.jj 2011-03-08 14:12:04.000000000 +0100
+++ gcc/testsuite/gcc.dg/pr47881.c 2011-03-08 14:11:46.000000000 +0100
@@ -0,0 +1,24 @@
+/* PR debug/47881 */
+/* { dg-do compile } */
+/* { dg-options "-O -fcompare-debug -fno-dce -funroll-loops -fno-web" } */
+
+extern int data[];
+
+int
+foo (int *t, int *f, int n)
+{
+ int i = 0, a, b, c, d;
+ while (data[*f] && n)
+ n--;
+ for (; i < n; i += 4)
+ {
+ a = data[*(f++) & 0x7f];
+ c = data[*(f++) & 0x7f];
+ c = data[*(f++) & 0x7f];
+ d = data[*(f++) & 0x7f];
+ if ((a & 0x80) || (b & 0x80) || (c & 0x80) || (d & 0x80))
+ return 1;
+ *(t++) = 16;
+ }
+ return 0;
+}
Jakub