Commit 56494762 by Jan Hubicka Committed by Jan Hubicka

re PR rtl-optimization/49710 (segfault)

	PR middle-end/49710
	* cfgloopmanip.c (remove_path): Walk loop hiearchy upwards when
	unlooping loops.

From-SVN: r182919
parent 10d12a3e
2012-01-05 Jan Hubicka <jh@suse.cz>
PR middle-end/49710
* cfgloopmanip.c (remove_path): Walk loop hiearchy upwards when
unlooping loops.
2012-01-05 Richard Guenther <rguenther@suse.de> 2012-01-05 Richard Guenther <rguenther@suse.de>
PR lto/50490 PR lto/50490
...@@ -291,6 +291,7 @@ remove_path (edge e) ...@@ -291,6 +291,7 @@ remove_path (edge e)
sbitmap seen; sbitmap seen;
bool irred_invalidated = false; bool irred_invalidated = false;
edge_iterator ei; edge_iterator ei;
struct loop *l, *f;
if (!can_remove_branch_p (e)) if (!can_remove_branch_p (e))
return false; return false;
...@@ -314,10 +315,12 @@ remove_path (edge e) ...@@ -314,10 +315,12 @@ remove_path (edge e)
we belong to. In this case first unloop the loops, then proceed we belong to. In this case first unloop the loops, then proceed
normally. We may assume that e->dest is not a header of any loop, normally. We may assume that e->dest is not a header of any loop,
as it now has exactly one predecessor. */ as it now has exactly one predecessor. */
while (loop_outer (e->src->loop_father) for (l = e->src->loop_father; loop_outer (l); l = f)
&& dominated_by_p (CDI_DOMINATORS, {
e->src->loop_father->latch, e->dest)) f = loop_outer (l);
unloop (e->src->loop_father, &irred_invalidated); if (dominated_by_p (CDI_DOMINATORS, l->latch, e->dest))
unloop (l, &irred_invalidated);
}
/* Identify the path. */ /* Identify the path. */
nrem = find_path (e, &rem_bbs); nrem = find_path (e, &rem_bbs);
......
2012-01-05 Jan Hubicka <jh@suse.cz>
PR middle-end/49710
* gcc.c-torture/compile/pr49710.c: New file.
2012-01-05 Richard Guenther <rguenther@suse.de> 2012-01-05 Richard Guenther <rguenther@suse.de>
* g++.dg/torture/pr49309.C: Skip for -flto. * g++.dg/torture/pr49309.C: Skip for -flto.
......
int a, b, c, d;
static void
foo (int *x)
{
c = 0;
while (1)
{
if (*x)
break;
while (b)
for (; c; c = 0);
for (d = 18; d != 18; d++)
if (c)
{
foo (x);
return;
}
}
}
static void
bar ()
{
foo (0);
foo (0);
for (;;)
;
}
baz ()
{
for (; a;)
bar ();
}
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