re PR tree-optimization/45709 (internal compiler error: in add_phi_arg, at tree-phinodes.c:395)

2010-09-18  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/45709
	* tree-inline.c (copy_phis_for_bb): Fixup new_edge when
	we splitted it.

	* g++.dg/torture/pr45709.C: New testcase.

From-SVN: r164390
This commit is contained in:
Richard Guenther 2010-09-18 11:38:25 +00:00 committed by Richard Biener
parent 5d3b14bd9a
commit a9db10d4aa
3 changed files with 29 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2010-09-18 Richard Guenther <rguenther@suse.de>
PR tree-optimization/45709
* tree-inline.c (copy_phis_for_bb): Fixup new_edge when
we splitted it.
2010-09-17 Sebastian Pop <sebastian.pop@amd.com>
* graphite-dependences.c (dot_deps): Add DEBUG_FUNCTION.

View File

@ -0,0 +1,19 @@
// { dg-do compile }
struct Region {
int storage[4];
int count;
};
static inline Region subtract(int lhs)
{
Region reg;
int* storage = reg.storage;
if (lhs > 0)
storage++;
reg.count = storage - reg.storage;
return reg;
}
void bar(int a)
{
const Region copyBack(subtract(a));
}

View File

@ -2021,8 +2021,11 @@ copy_phis_for_bb (basic_block bb, copy_body_data *id)
&& !is_gimple_val (new_arg))
{
gimple_seq stmts = NULL;
basic_block tem;
new_arg = force_gimple_operand (new_arg, &stmts, true, NULL);
gsi_insert_seq_on_edge_immediate (new_edge, stmts);
tem = gsi_insert_seq_on_edge_immediate (new_edge, stmts);
if (tem)
new_edge = single_succ_edge (tem);
}
add_phi_arg (new_phi, new_arg, new_edge,
gimple_phi_arg_location_from_edge (phi, old_edge));