From 5d721887efa6c7d49ab98344c3faf1d17ce2eb25 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 17 Sep 2018 13:28:04 +0000 Subject: [PATCH] re PR tree-optimization/87328 (ICE in do_rpo_vn, at tree-ssa-sccvn.c:6566) 2018-09-17 Richard Biener PR tree-optimization/87328 * tree-ssa-sccvn.c (process_bb): Remove assertion about not visiting unexecutable backedges when not iterating. (do_rpo_vn): Mark all edges not executable even when not iterating. * gcc.dg/torture/pr87328.c: New testcase. From-SVN: r264369 --- gcc/ChangeLog | 8 ++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr87328.c | 25 +++++++++++++++++++++++++ gcc/tree-ssa-sccvn.c | 8 +------- 4 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr87328.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f653d66f288..585056e5db8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2018-09-17 Richard Biener + + PR tree-optimization/87328 + * tree-ssa-sccvn.c (process_bb): Remove assertion about not + visiting unexecutable backedges when not iterating. + (do_rpo_vn): Mark all edges not executable even when not + iterating. + 2018-09-17 Martin Jambor PR c/63886 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4fd1ff928ab..5cce863e58a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-09-17 Richard Biener + + PR tree-optimization/87328 + * gcc.dg/torture/pr87328.c: New testcase. + 2018-09-17 Martin Jambor PR c/63886 diff --git a/gcc/testsuite/gcc.dg/torture/pr87328.c b/gcc/testsuite/gcc.dg/torture/pr87328.c new file mode 100644 index 00000000000..50e1cdfbb56 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr87328.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-fno-tree-ccp -fno-tree-forwprop" } */ + +void +tp (void) +{ + int qt; + + qt = 0; + if (qt != 0) + { + if (0) + { +h5: + qt = 0; + while (qt < 1) + { + } + } + + ++qt; + } + + goto h5; +} diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index a9e4d34e31f..a49e7f67451 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -5978,7 +5978,6 @@ process_bb (rpo_elim &avail, basic_block bb, fprintf (dump_file, "marking outgoing edge %d -> %d executable\n", e->src->index, e->dest->index); - gcc_checking_assert (iterate || !(e->flags & EDGE_DFS_BACK)); e->flags |= EDGE_EXECUTABLE; e->dest->flags |= BB_EXECUTABLE; } @@ -6125,7 +6124,6 @@ process_bb (rpo_elim &avail, basic_block bb, "marking known outgoing %sedge %d -> %d executable\n", e->flags & EDGE_DFS_BACK ? "back-" : "", e->src->index, e->dest->index); - gcc_checking_assert (iterate || !(e->flags & EDGE_DFS_BACK)); e->flags |= EDGE_EXECUTABLE; e->dest->flags |= BB_EXECUTABLE; } @@ -6148,7 +6146,6 @@ process_bb (rpo_elim &avail, basic_block bb, fprintf (dump_file, "marking outgoing edge %d -> %d executable\n", e->src->index, e->dest->index); - gcc_checking_assert (iterate || !(e->flags & EDGE_DFS_BACK)); e->flags |= EDGE_EXECUTABLE; e->dest->flags |= BB_EXECUTABLE; } @@ -6390,10 +6387,7 @@ do_rpo_vn (function *fn, edge entry, bitmap exit_bbs, { if (e->flags & EDGE_DFS_BACK) has_backedges = true; - if (! iterate && (e->flags & EDGE_DFS_BACK)) - e->flags |= EDGE_EXECUTABLE; - else - e->flags &= ~EDGE_EXECUTABLE; + e->flags &= ~EDGE_EXECUTABLE; if (e == entry) continue; if (bb_to_rpo[e->src->index] > i) -- 2.30.2