re PR tree-optimization/67221 (ICE at -Os and above on x86_64-linux-gnu: Segmentation fault (program cc1))

2015-08-17  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/67221
	* tree-ssa-sccvn.c (visit_phi): Keep all-TOP args TOP.
	(sccvn_dom_walker::before_dom_children): Mark backedges of
	non-executable blocks as not executable.

	* gcc.dg/torture/pr67221.c: New testcase.

From-SVN: r226938
This commit is contained in:
Richard Biener 2015-08-17 14:17:33 +00:00 committed by Richard Biener
parent 6c825cd46b
commit 28251e2ce1
4 changed files with 61 additions and 1 deletions

View file

@ -1,3 +1,10 @@
2015-08-17 Richard Biener <rguenther@suse.de>
PR tree-optimization/67221
* tree-ssa-sccvn.c (visit_phi): Keep all-TOP args TOP.
(sccvn_dom_walker::before_dom_children): Mark backedges of
non-executable blocks as not executable.
2015-08-17 David Sherwood <david.sherwood@arm.com>
* config/arm/arm.c (neon_element_bits): Replace call to

View file

@ -1,3 +1,8 @@
2015-08-17 Richard Biener <rguenther@suse.de>
PR tree-optimization/67221
* gcc.dg/torture/pr67221.c: New testcase.
2015-08-17 Mike Stump <mikestump@comcast.net>
Kyrylo Tkachov <kyrylo.tkachov@arm.com>

View file

@ -0,0 +1,31 @@
/* { dg-do compile } */
int a, b;
int
fn1 (int p)
{
return 0 == 0 ? p : 0;
}
void
fn2 ()
{
int c = 1, d[1] = { 1 };
lbl:
for (;;)
{
int e;
c ? 0 : 0 / c;
c = 0;
if (fn1 (d[0]))
break;
for (e = 0; e < 1; e++)
for (c = 1; b;)
{
if (a)
break;
goto lbl;
}
}
}

View file

@ -3271,6 +3271,11 @@ visit_phi (gimple phi)
break;
}
}
/* If none of the edges was executable or all incoming values are
undefined keep the value-number at VN_TOP. */
if (sameval == VN_TOP)
return set_ssa_val_to (PHI_RESULT (phi), VN_TOP);
/* First see if it is equivalent to a phi node in this block. We prefer
this as it allows IV elimination - see PRs 66502 and 67167. */
@ -4463,7 +4468,7 @@ sccvn_dom_walker::before_dom_children (basic_block bb)
reachable |= (e->flags & EDGE_EXECUTABLE);
/* If the block is not reachable all outgoing edges are not
executable. */
executable. Neither are incoming edges with src dominated by us. */
if (!reachable)
{
if (dump_file && (dump_flags & TDF_DETAILS))
@ -4472,6 +4477,18 @@ sccvn_dom_walker::before_dom_children (basic_block bb)
FOR_EACH_EDGE (e, ei, bb->succs)
e->flags &= ~EDGE_EXECUTABLE;
FOR_EACH_EDGE (e, ei, bb->preds)
{
if (dominated_by_p (CDI_DOMINATORS, e->src, bb))
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Marking backedge from BB %d into "
"unreachable BB %d as not executable\n",
e->src->index, bb->index);
e->flags &= ~EDGE_EXECUTABLE;
}
}
return;
}