Commit 0fdb0d27 by Richard Guenther Committed by Richard Biener

re PR tree-optimization/47280 (ICE: verify_stmts failed: statement marked for…

re PR tree-optimization/47280 (ICE: verify_stmts failed: statement marked for throw, but doesn't with -fnon-call-exceptions -ftrapv)

2011-01-14  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/47280
	* tree-ssa-forwprop.c (associate_plusminus): Cleanup EH and
	return CFG changes.
	(tree_ssa_forward_propagate_single_use_vars): Deal with
	CFG changes from associate_plusminus.

	* g++.dg/opt/pr47280.C: New testcase.

From-SVN: r168784
parent 35385f99
2011-01-14 Richard Guenther <rguenther@suse.de> 2011-01-14 Richard Guenther <rguenther@suse.de>
PR tree-optimization/47280
* tree-ssa-forwprop.c (associate_plusminus): Cleanup EH and
return CFG changes.
(tree_ssa_forward_propagate_single_use_vars): Deal with
CFG changes from associate_plusminus.
2011-01-14 Richard Guenther <rguenther@suse.de>
PR middle-end/47281 PR middle-end/47281
Revert Revert
2011-01-11 Richard Guenther <rguenther@suse.de> 2011-01-11 Richard Guenther <rguenther@suse.de>
......
2011-01-14 Richard Guenther <rguenther@suse.de>
PR tree-optimization/47280
* g++.dg/opt/pr47280.C: New testcase.
2011-01-14 Jason Merrill <jason@redhat.com> 2011-01-14 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/constexpr-regress1.C: New. * g++.dg/cpp0x/constexpr-regress1.C: New.
......
// { dg-do compile }
// { dg-options "-O -fnon-call-exceptions -ftrapv" }
void bar (int n, char *p)
{
try
{
n++;
for (int i = 0; i < n - 1; i++)
p[i];
}
catch (...)
{}
}
...@@ -1658,9 +1658,9 @@ simplify_bitwise_and (gimple_stmt_iterator *gsi, gimple stmt) ...@@ -1658,9 +1658,9 @@ simplify_bitwise_and (gimple_stmt_iterator *gsi, gimple stmt)
/* Perform re-associations of the plus or minus statement STMT that are /* Perform re-associations of the plus or minus statement STMT that are
always permitted. */ always permitted. Returns true if the CFG was changed. */
static void static bool
associate_plusminus (gimple stmt) associate_plusminus (gimple stmt)
{ {
tree rhs1 = gimple_assign_rhs1 (stmt); tree rhs1 = gimple_assign_rhs1 (stmt);
...@@ -1671,7 +1671,7 @@ associate_plusminus (gimple stmt) ...@@ -1671,7 +1671,7 @@ associate_plusminus (gimple stmt)
/* We can't reassociate at all for saturating types. */ /* We can't reassociate at all for saturating types. */
if (TYPE_SATURATING (TREE_TYPE (rhs1))) if (TYPE_SATURATING (TREE_TYPE (rhs1)))
return; return false;
/* First contract negates. */ /* First contract negates. */
do do
...@@ -1934,7 +1934,12 @@ out: ...@@ -1934,7 +1934,12 @@ out:
{ {
fold_stmt_inplace (stmt); fold_stmt_inplace (stmt);
update_stmt (stmt); update_stmt (stmt);
if (maybe_clean_or_replace_eh_stmt (stmt, stmt)
&& gimple_purge_dead_eh_edges (gimple_bb (stmt)))
return true;
} }
return false;
} }
/* Main entry point for the forward propagation optimizer. */ /* Main entry point for the forward propagation optimizer. */
...@@ -2062,7 +2067,7 @@ tree_ssa_forward_propagate_single_use_vars (void) ...@@ -2062,7 +2067,7 @@ tree_ssa_forward_propagate_single_use_vars (void)
else if (gimple_assign_rhs_code (stmt) == PLUS_EXPR else if (gimple_assign_rhs_code (stmt) == PLUS_EXPR
|| gimple_assign_rhs_code (stmt) == MINUS_EXPR) || gimple_assign_rhs_code (stmt) == MINUS_EXPR)
{ {
associate_plusminus (stmt); cfg_changed |= associate_plusminus (stmt);
gsi_next (&gsi); gsi_next (&gsi);
} }
else else
......
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