From: Richard Biener Date: Wed, 12 Sep 2018 14:03:21 +0000 (+0000) Subject: re PR tree-optimization/87280 (ICE in set_ssa_val_to, at tree-ssa-sccvn.c:3647) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b25508e0ccf79f4c7ebd5a80e6ed3fd4a13eec51;p=gcc.git re PR tree-optimization/87280 (ICE in set_ssa_val_to, at tree-ssa-sccvn.c:3647) 2018-09-12 Richard Biener PR tree-optimization/87280 * tree-ssa-sccvn.c (process_bb): Handle the case of executable edge but unreachable target. (do_rpo_vn): For conservatively handling a PHI only mark the backedge executable but not the block reachable. * gcc.dg/torture/pr87280.c: New testcase. From-SVN: r264241 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c96b5eb5480..1da8d18c294 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2018-09-12 Richard Biener + + PR tree-optimization/87280 + * tree-ssa-sccvn.c (process_bb): Handle the case of executable + edge but unreachable target. + (do_rpo_vn): For conservatively handling a PHI only mark + the backedge executable but not the block reachable. + 2018-09-12 Richard Biener PR tree-optimization/87266 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5f73cd8fe2a..f1b9fe231db 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-09-12 Richard Biener + + PR tree-optimization/87280 + * gcc.dg/torture/pr87280.c: New testcase. + 2018-09-12 Richard Biener PR tree-optimization/87266 diff --git a/gcc/testsuite/gcc.dg/torture/pr87280.c b/gcc/testsuite/gcc.dg/torture/pr87280.c new file mode 100644 index 00000000000..c62e8be0c4d --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr87280.c @@ -0,0 +1,61 @@ +/* { dg-do compile } */ +/* { dg-additional-options "--param rpo-vn-max-loop-depth=5" } */ + +int uc; + +void +j8 (int *xv, int f3) +{ + uc = 0; + while (uc < 1) + { + } + + if (*xv == 0) + { + int *o8 = xv; + + if (0) + { +n3: + *o8 = 0; + while (*o8 < 1) + { +h5: + *o8 = 0; + } + } + + while (*xv < 1) + if (*xv == 0) + goto h5; + +g5: + ; + } + + *xv = 0; + for (;;) + { + while (uc < 1) + { + } + + while (f3 < 1) + { + if (*xv == 0) + goto n3; + + while (f3 < 1) + while (*xv < 1) + while (*xv < 1) + while (*xv < 1) + while (*xv < 1) + { + } + } + + if (*xv == 0) + goto g5; + } +} diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 8bf724e793a..2a837c26821 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -5976,15 +5976,24 @@ process_bb (rpo_elim &avail, basic_block bb, { FOR_EACH_EDGE (e, ei, bb->succs) { - if (e->flags & EDGE_EXECUTABLE) - continue; - if (dump_file && (dump_flags & TDF_DETAILS)) - 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; + if (!(e->flags & EDGE_EXECUTABLE)) + { + if (dump_file && (dump_flags & TDF_DETAILS)) + 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; + } + else if (!(e->dest->flags & BB_EXECUTABLE)) + { + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, + "marking destination block %d reachable\n", + e->dest->index); + e->dest->flags |= BB_EXECUTABLE; + } } } for (gimple_stmt_iterator gsi = gsi_start_bb (bb); @@ -6124,20 +6133,37 @@ process_bb (rpo_elim &avail, basic_block bb, e->flags |= EDGE_EXECUTABLE; e->dest->flags |= BB_EXECUTABLE; } + else if (!(e->dest->flags & BB_EXECUTABLE)) + { + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, + "marking destination block %d reachable\n", + e->dest->index); + e->dest->flags |= BB_EXECUTABLE; + } } else if (gsi_one_before_end_p (gsi)) { FOR_EACH_EDGE (e, ei, bb->succs) { - if (e->flags & EDGE_EXECUTABLE) - continue; - if (dump_file && (dump_flags & TDF_DETAILS)) - 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; + if (!(e->flags & EDGE_EXECUTABLE)) + { + if (dump_file && (dump_flags & TDF_DETAILS)) + 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; + } + else if (!(e->dest->flags & BB_EXECUTABLE)) + { + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, + "marking destination block %d reachable\n", + e->dest->index); + e->dest->flags |= BB_EXECUTABLE; + } } } @@ -6399,7 +6425,6 @@ do_rpo_vn (function *fn, edge entry, bitmap exit_bbs, if (e->flags & EDGE_DFS_BACK) { e->flags |= EDGE_EXECUTABLE; - e->dest->flags |= BB_EXECUTABLE; /* There can be a non-latch backedge into the header which is part of an outer irreducible region. We cannot avoid iterating this block then. */