Commit b25508e0 by Richard Biener Committed by Richard Biener

re PR tree-optimization/87280 (ICE in set_ssa_val_to, at tree-ssa-sccvn.c:3647)

2018-09-12  Richard Biener  <rguenther@suse.de>

	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
parent 72ced874
2018-09-12 Richard Biener <rguenther@suse.de> 2018-09-12 Richard Biener <rguenther@suse.de>
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 <rguenther@suse.de>
PR tree-optimization/87266 PR tree-optimization/87266
* tree-ssa-sccvn.c (do_rpo_vn): Always iterate to not yet * tree-ssa-sccvn.c (do_rpo_vn): Always iterate to not yet
visited blocks. visited blocks.
......
2018-09-12 Richard Biener <rguenther@suse.de> 2018-09-12 Richard Biener <rguenther@suse.de>
PR tree-optimization/87280
* gcc.dg/torture/pr87280.c: New testcase.
2018-09-12 Richard Biener <rguenther@suse.de>
PR tree-optimization/87266 PR tree-optimization/87266
* gcc.dg/torture/pr87266-1.c: New testcase. * gcc.dg/torture/pr87266-1.c: New testcase.
* gcc.dg/torture/pr87266-2.c: Likewise. * gcc.dg/torture/pr87266-2.c: Likewise.
......
/* { 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;
}
}
...@@ -5976,15 +5976,24 @@ process_bb (rpo_elim &avail, basic_block bb, ...@@ -5976,15 +5976,24 @@ process_bb (rpo_elim &avail, basic_block bb,
{ {
FOR_EACH_EDGE (e, ei, bb->succs) FOR_EACH_EDGE (e, ei, bb->succs)
{ {
if (e->flags & EDGE_EXECUTABLE) if (!(e->flags & EDGE_EXECUTABLE))
continue; {
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, fprintf (dump_file,
"marking outgoing edge %d -> %d executable\n", "marking outgoing edge %d -> %d executable\n",
e->src->index, e->dest->index); e->src->index, e->dest->index);
gcc_checking_assert (iterate || !(e->flags & EDGE_DFS_BACK)); gcc_checking_assert (iterate || !(e->flags & EDGE_DFS_BACK));
e->flags |= EDGE_EXECUTABLE; e->flags |= EDGE_EXECUTABLE;
e->dest->flags |= BB_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); for (gimple_stmt_iterator gsi = gsi_start_bb (bb);
...@@ -6124,20 +6133,37 @@ process_bb (rpo_elim &avail, basic_block bb, ...@@ -6124,20 +6133,37 @@ process_bb (rpo_elim &avail, basic_block bb,
e->flags |= EDGE_EXECUTABLE; e->flags |= EDGE_EXECUTABLE;
e->dest->flags |= BB_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)) else if (gsi_one_before_end_p (gsi))
{ {
FOR_EACH_EDGE (e, ei, bb->succs) FOR_EACH_EDGE (e, ei, bb->succs)
{ {
if (e->flags & EDGE_EXECUTABLE) if (!(e->flags & EDGE_EXECUTABLE))
continue; {
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, fprintf (dump_file,
"marking outgoing edge %d -> %d executable\n", "marking outgoing edge %d -> %d executable\n",
e->src->index, e->dest->index); e->src->index, e->dest->index);
gcc_checking_assert (iterate || !(e->flags & EDGE_DFS_BACK)); gcc_checking_assert (iterate || !(e->flags & EDGE_DFS_BACK));
e->flags |= EDGE_EXECUTABLE; e->flags |= EDGE_EXECUTABLE;
e->dest->flags |= BB_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, ...@@ -6399,7 +6425,6 @@ do_rpo_vn (function *fn, edge entry, bitmap exit_bbs,
if (e->flags & EDGE_DFS_BACK) if (e->flags & EDGE_DFS_BACK)
{ {
e->flags |= EDGE_EXECUTABLE; e->flags |= EDGE_EXECUTABLE;
e->dest->flags |= BB_EXECUTABLE;
/* There can be a non-latch backedge into the header /* There can be a non-latch backedge into the header
which is part of an outer irreducible region. We which is part of an outer irreducible region. We
cannot avoid iterating this block then. */ cannot avoid iterating this block then. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment