This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Don't remove, but just reset DEBUG_INSNS during lra-spill.c (PR rtl-optimization/70596)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Vladimir Makarov <vmakarov at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 12 Apr 2016 17:14:46 +0200
- Subject: [PATCH] Don't remove, but just reset DEBUG_INSNS during lra-spill.c (PR rtl-optimization/70596)
- Authentication-results: sourceware.org; auth=none
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
Removing DEBUG_INSNs (unless it is removed e.g. together with whole bb
as unreachable code) is always wrong, instead it should be reset,
which indicates we don't know where the var lives (removing it instead
means that the previous DEBUG_INSN for the corresponding var is live
even in the insns where it could have another value).
Also, by deleting the insn, we get a -fcompare-debug issue without DCE,
there can be different number of the NOTE_INSN_DELETED notes.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?
2016-04-12 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/70596
* lra-spills.c (spill_pseudos): Don't delete debug insns, instead
just invalidate LRA data and reset them. Adjust dump wording.
* gcc.target/i386/pr70596.c: New test.
--- gcc/lra-spills.c.jj 2016-01-29 21:32:58.000000000 +0100
+++ gcc/lra-spills.c 2016-04-12 14:11:33.538012692 +0200
@@ -528,11 +528,12 @@ spill_pseudos (void)
if (removed_pseudo_p)
{
lra_assert (DEBUG_INSN_P (insn));
- lra_set_insn_deleted (insn);
+ lra_invalidate_insn_data (insn);
+ INSN_VAR_LOCATION_LOC (insn) = gen_rtx_UNKNOWN_VAR_LOC ();
if (lra_dump_file != NULL)
fprintf (lra_dump_file,
- "Debug insn #%u is deleted as containing removed pseudo\n",
- INSN_UID (insn));
+ "Debug insn #%u is reset because it referenced "
+ "removed pseudo\n", INSN_UID (insn));
}
bitmap_and_compl_into (df_get_live_in (bb), &spilled_pseudos);
bitmap_and_compl_into (df_get_live_out (bb), &spilled_pseudos);
--- gcc/testsuite/gcc.target/i386/pr70596.c.jj 2016-04-12 14:07:26.830428980 +0200
+++ gcc/testsuite/gcc.target/i386/pr70596.c 2016-04-12 14:06:19.000000000 +0200
@@ -0,0 +1,13 @@
+/* PR rtl-optimization/70596 */
+/* { dg-do compile { target avx512f } } */
+/* { dg-options "-O2 -fno-dce -fschedule-insns -fno-tree-coalesce-vars -fno-tree-dce -fno-tree-fre -fno-tree-pre -fcompare-debug -mavx512f" } */
+
+typedef char V __attribute__((vector_size (64)));
+
+int
+foo (V u, V v)
+{
+ v /= u | 1;
+ v[18] = 1 | v[8];
+ return v[1] + v[6] + v[0] + v[1] + v[18] + v[2] + v[7];
+}
Jakub