re PR tree-optimization/21399 (libstdc++ 12077.cc ICE)

PR tree-opt/21399
        * tree-eh.c (maybe_clean_or_replace_eh_stmt): Rename from
        maybe_clean_eh_stmt; take old stmt parameter.  Update EH
        region data structure to match replacement.
        * tree-flow.h: Update to match.
        * tree-ssa-ccp.c (execute_fold_all_builtins): Likewise.
        * tree-ssa-dom.c (optimize_stmt): Likewise.
        * tree-ssa-pre.c (eliminate): Likewise.
        * tree-ssa-propagate.c (substitute_and_fold): Likewise.

Co-Authored-By: Steven Bosscher <stevenb@suse.de>

From-SVN: r99801
This commit is contained in:
Richard Henderson 2005-05-16 16:14:02 -07:00 committed by Richard Henderson
parent f59d2aade3
commit af47810aed
7 changed files with 48 additions and 13 deletions

View File

@ -1,3 +1,16 @@
2005-05-16 Richard Henderson <rth@redhat.com>
Steven Bosscher <stevenb@suse.de>
PR tree-opt/21399
* tree-eh.c (maybe_clean_or_replace_eh_stmt): Rename from
maybe_clean_eh_stmt; take old stmt parameter. Update EH
region data structure to match replacement.
* tree-flow.h: Update to match.
* tree-ssa-ccp.c (execute_fold_all_builtins): Likewise.
* tree-ssa-dom.c (optimize_stmt): Likewise.
* tree-ssa-pre.c (eliminate): Likewise.
* tree-ssa-propagate.c (substitute_and_fold): Likewise.
2005-05-16 Caroline Tice <ctice@apple.com>
* bb-reorder.c (verify_hot_cold_block_grouping): Replace

View File

@ -2034,12 +2034,32 @@ tree_can_throw_external (tree stmt)
return can_throw_external_1 (region_nr);
}
bool
maybe_clean_eh_stmt (tree stmt)
/* Given a statement OLD_STMT and a new statement NEW_STMT that has replaced
OLD_STMT in the function, remove OLD_STMT from the EH table and put NEW_STMT
in the table if it should be in there. Return TRUE if a replacement was
done that my require an EH edge purge. */
bool
maybe_clean_or_replace_eh_stmt (tree old_stmt, tree new_stmt)
{
if (!tree_could_throw_p (stmt))
if (remove_stmt_from_eh_region (stmt))
return true;
int region_nr = lookup_stmt_eh_region (old_stmt);
if (region_nr >= 0)
{
bool new_stmt_could_throw = tree_could_throw_p (new_stmt);
if (new_stmt == old_stmt && new_stmt_could_throw)
return false;
remove_stmt_from_eh_region (old_stmt);
if (new_stmt_could_throw)
{
add_stmt_to_eh_region (new_stmt, region_nr);
return false;
}
else
return true;
}
return false;
}

View File

@ -751,7 +751,7 @@ extern bool tree_can_throw_external (tree);
extern int lookup_stmt_eh_region (tree);
extern void add_stmt_to_eh_region (tree, int);
extern bool remove_stmt_from_eh_region (tree);
extern bool maybe_clean_eh_stmt (tree);
extern bool maybe_clean_or_replace_eh_stmt (tree, tree);
/* In tree-ssa-pre.c */
void add_to_value (tree, tree);

View File

@ -2355,6 +2355,7 @@ execute_fold_all_builtins (void)
for (i = bsi_start (bb); !bsi_end_p (i); bsi_next (&i))
{
tree *stmtp = bsi_stmt_ptr (i);
tree old_stmt = *stmtp;
tree call = get_rhs (*stmtp);
tree callee, result;
@ -2396,7 +2397,7 @@ execute_fold_all_builtins (void)
}
}
update_stmt (*stmtp);
if (maybe_clean_eh_stmt (*stmtp)
if (maybe_clean_or_replace_eh_stmt (old_stmt, *stmtp)
&& tree_purge_dead_eh_edges (bb))
cfg_changed = true;

View File

@ -2946,11 +2946,11 @@ optimize_stmt (struct dom_walk_data *walk_data, basic_block bb,
block_stmt_iterator si)
{
stmt_ann_t ann;
tree stmt;
tree stmt, old_stmt;
bool may_optimize_p;
bool may_have_exposed_new_symbols = false;
stmt = bsi_stmt (si);
old_stmt = stmt = bsi_stmt (si);
update_stmt_if_modified (stmt);
ann = stmt_ann (stmt);
@ -3055,7 +3055,7 @@ optimize_stmt (struct dom_walk_data *walk_data, basic_block bb,
/* If we simplified a statement in such a way as to be shown that it
cannot trap, update the eh information and the cfg to match. */
if (maybe_clean_eh_stmt (stmt))
if (maybe_clean_or_replace_eh_stmt (old_stmt, stmt))
{
bitmap_set_bit (need_eh_cleanup, bb->index);
if (dump_file && (dump_flags & TDF_DETAILS))

View File

@ -2321,7 +2321,7 @@ eliminate (void)
/* If we removed EH side effects from the statement, clean
its EH information. */
if (maybe_clean_eh_stmt (stmt))
if (maybe_clean_or_replace_eh_stmt (stmt, stmt))
{
bitmap_set_bit (need_eh_cleanup,
bb_for_stmt (stmt)->index);

View File

@ -1051,6 +1051,7 @@ substitute_and_fold (prop_value_t *prop_value)
did_replace |= replace_vuses_in (stmt, &replaced_address, prop_value);
if (did_replace)
{
tree old_stmt = stmt;
fold_stmt (bsi_stmt_ptr (i));
stmt = bsi_stmt(i);
@ -1060,7 +1061,7 @@ substitute_and_fold (prop_value_t *prop_value)
/* If we cleaned up EH information from the statement,
remove EH edges. */
if (maybe_clean_eh_stmt (stmt))
if (maybe_clean_or_replace_eh_stmt (old_stmt, stmt))
tree_purge_dead_eh_edges (bb);
}