public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/redhat/heads/gcc-8-branch)] if-conv: Delete dead stmts backwards in ifcvt_local_dce [PR94283]
@ 2020-09-17 17:20 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2020-09-17 17:20 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:e0f892394dbd59b411ba72113166e2396a77f563
commit e0f892394dbd59b411ba72113166e2396a77f563
Author: Jakub Jelinek <jakub@redhat.com>
Date: Wed Mar 25 08:08:04 2020 +0100
if-conv: Delete dead stmts backwards in ifcvt_local_dce [PR94283]
> > This patch caused:
> >
> > gcc /home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/compile/990625-2.c -O3 -g -fno-tree-dce -c
> > during GIMPLE pass: ifcvt
> > /home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/compile/990625-2.c: In function ‘broken030599’:
> > /home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/compile/990625-2.c:2:1: internal compiler error: Segmentation fault
>
> Likely
>
> /* Delete dead statements. */
> gsi = gsi_start_bb (bb);
> while (!gsi_end_p (gsi))
> {
>
> needs to instead work back-to-front for debug stmt adjustment to work
Indeed, that seems to work.
2020-03-25 Richard Biener <rguenther@suse.de>
Jakub Jelinek <jakub@redhat.com>
PR debug/94283
* tree-if-conv.c (ifcvt_local_dce): Delete dead statements backwards.
* gcc.dg/pr94283.c: New test.
Co-authored-by: Richard Biener <rguenther@suse.de>
(cherry picked from commit 8ea7970c4968517fb73f42bcca40d316adacf215)
Diff:
---
gcc/testsuite/gcc.dg/pr94283.c | 16 ++++++++++++++++
gcc/tree-if-conv.c | 7 +++++--
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/gcc/testsuite/gcc.dg/pr94283.c b/gcc/testsuite/gcc.dg/pr94283.c
new file mode 100644
index 00000000000..ac162d6ac7b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr94283.c
@@ -0,0 +1,16 @@
+/* PR debug/94283 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-tree-dce -fcompare-debug" } */
+
+void
+foo (int *n)
+{
+ for (int i = 0; i < 32; i++)
+ {
+ int x = 0;
+ x++;
+ if (i & 4)
+ x++;
+ x++;
+ }
+}
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index dd9bf469730..db38b1328ff 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -2811,13 +2811,15 @@ ifcvt_local_dce (basic_block bb)
}
}
/* Delete dead statements. */
- gsi = gsi_start_bb (bb);
+ gsi = gsi_last_bb (bb);
while (!gsi_end_p (gsi))
{
+ gimple_stmt_iterator gsiprev = gsi;
+ gsi_prev (&gsiprev);
stmt = gsi_stmt (gsi);
if (gimple_plf (stmt, GF_PLF_2))
{
- gsi_next (&gsi);
+ gsi = gsiprev;
continue;
}
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -2827,6 +2829,7 @@ ifcvt_local_dce (basic_block bb)
}
gsi_remove (&gsi, true);
release_defs (stmt);
+ gsi = gsiprev;
}
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-09-17 17:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-17 17:20 [gcc(refs/vendors/redhat/heads/gcc-8-branch)] if-conv: Delete dead stmts backwards in ifcvt_local_dce [PR94283] Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).