Commit d5c1a5f1 by Richard Biener Committed by Richard Biener

re PR tree-optimization/68017 (ICE on valid code at -O3 with -g enabled on…

re PR tree-optimization/68017 (ICE on valid code at -O3 with -g enabled on x86_64-linux-gnu: cannot update SSA form)

2015-10-20  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/68017
	* tree-tailcall.c (eliminate_tail_call): Remove stmts backwards.

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

From-SVN: r229073
parent 744c73a5
2015-10-20 Richard Biener <rguenther@suse.de>
PR tree-optimization/68017
* tree-tailcall.c (eliminate_tail_call): Remove stmts backwards.
2015-10-20 Martin Liska <mliska@suse.cz> 2015-10-20 Martin Liska <mliska@suse.cz>
* cgraphclones.c (cgraph_node::create_virtual_clone): * cgraphclones.c (cgraph_node::create_virtual_clone):
2015-10-20 Richard Biener <rguenther@suse.de>
PR tree-optimization/68017
* gcc.dg/torture/pr68017.c: New testcase.
2015-10-20 Szabolcs Nagy <szabolcs.nagy@arm.com> 2015-10-20 Szabolcs Nagy <szabolcs.nagy@arm.com>
PR target/66912 PR target/66912
......
/* { dg-do compile } */
/* { dg-options "-g" } */
long long a;
short
fn1 (short p1, unsigned short p2)
{
return p1 + p2;
}
short
fn2 ()
{
int b = a ? fn1 (fn2 (), a) : 0;
return b;
}
...@@ -847,17 +847,21 @@ eliminate_tail_call (struct tailcall *t) ...@@ -847,17 +847,21 @@ eliminate_tail_call (struct tailcall *t)
possibly unreachable code in other blocks is removed later in possibly unreachable code in other blocks is removed later in
cfg cleanup. */ cfg cleanup. */
gsi = t->call_gsi; gsi = t->call_gsi;
gsi_next (&gsi); gimple_stmt_iterator gsi2 = gsi_last_bb (gimple_bb (gsi_stmt (gsi)));
while (!gsi_end_p (gsi)) while (gsi_stmt (gsi2) != gsi_stmt (gsi))
{ {
gimple *t = gsi_stmt (gsi); gimple *t = gsi_stmt (gsi2);
/* Do not remove the return statement, so that redirect_edge_and_branch /* Do not remove the return statement, so that redirect_edge_and_branch
sees how the block ends. */ sees how the block ends. */
if (gimple_code (t) == GIMPLE_RETURN) if (gimple_code (t) != GIMPLE_RETURN)
break; {
gimple_stmt_iterator gsi3 = gsi2;
gsi_remove (&gsi, true); gsi_prev (&gsi2);
release_defs (t); gsi_remove (&gsi3, true);
release_defs (t);
}
else
gsi_prev (&gsi2);
} }
/* Number of executions of function has reduced by the tailcall. */ /* Number of executions of function has reduced by the tailcall. */
......
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