re PR middle-end/37456 (ICE: verify_flow_info failed: control flow in the middle of basic block)

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

	PR tree-optimization/37456
	* tree-ssa-reassoc.c (build_and_add_sum): If the stmt we
	want to insert after ends a BB insert on the single fallthru
	outgoing edge.

	* testsuite/g++.dg/torture/pr37456.C: New testcase.

From-SVN: r140449
This commit is contained in:
Richard Guenther 2008-09-18 11:28:18 +00:00 committed by Richard Biener
parent 59a1bff3e2
commit e7089ecf1c
4 changed files with 54 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2008-09-18 Richard Guenther <rguenther@suse.de>
PR tree-optimization/37456
* tree-ssa-reassoc.c (build_and_add_sum): If the stmt we
want to insert after ends a BB insert on the single fallthru
outgoing edge.
2008-09-18 Andreas Krebbel <krebbel1@de.ibm.com> 2008-09-18 Andreas Krebbel <krebbel1@de.ibm.com>
* doc/invoke.texi: Document -mhard-dfp, -mno-hard-dfp. * doc/invoke.texi: Document -mhard-dfp, -mno-hard-dfp.

View File

@ -1,3 +1,8 @@
2008-09-18 Richard Guenther <rguenther@suse.de>
PR tree-optimization/37456
* testsuite/g++.dg/torture/pr37456.C: New testcase.
2008-09-18 Uros Bizjak <ubizjak@gmail.com> 2008-09-18 Uros Bizjak <ubizjak@gmail.com>
PR rtl-optimization/37544 PR rtl-optimization/37544

View File

@ -0,0 +1,14 @@
/* { dg-do compile } */
int zot(int);
struct bar {
~bar() { }
};
int x;
void doit(int a, int b, int c)
{
bar pn;
int b1 = zot(a) * c;
int b2 = zot(b) * c;
x = b1 + b2;
}

View File

@ -859,8 +859,20 @@ build_and_add_sum (tree tmpvar, tree op1, tree op2, enum tree_code opcode)
} }
else else
{ {
gsi = gsi_for_stmt (op2def); if (!stmt_ends_bb_p (op2def))
gsi_insert_after (&gsi, sum, GSI_NEW_STMT); {
gsi = gsi_for_stmt (op2def);
gsi_insert_after (&gsi, sum, GSI_NEW_STMT);
}
else
{
edge e;
edge_iterator ei;
FOR_EACH_EDGE (e, ei, gimple_bb (op2def)->succs)
if (e->flags & EDGE_FALLTHRU)
gsi_insert_on_edge_immediate (e, sum);
}
} }
} }
else else
@ -872,8 +884,20 @@ build_and_add_sum (tree tmpvar, tree op1, tree op2, enum tree_code opcode)
} }
else else
{ {
gsi = gsi_for_stmt (op1def); if (!stmt_ends_bb_p (op1def))
gsi_insert_after (&gsi, sum, GSI_NEW_STMT); {
gsi = gsi_for_stmt (op1def);
gsi_insert_after (&gsi, sum, GSI_NEW_STMT);
}
else
{
edge e;
edge_iterator ei;
FOR_EACH_EDGE (e, ei, gimple_bb (op1def)->succs)
if (e->flags & EDGE_FALLTHRU)
gsi_insert_on_edge_immediate (e, sum);
}
} }
} }
update_stmt (sum); update_stmt (sum);