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
This commit is contained in:
Richard Biener 2018-09-12 14:03:21 +00:00 committed by Richard Biener
parent 72ced87475
commit b25508e0cc
4 changed files with 118 additions and 19 deletions

View File

@ -1,3 +1,11 @@
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

View File

@ -1,3 +1,8 @@
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

View File

@ -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;
}
}

View File

@ -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. */