* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@99801
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
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;
}
-
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);
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;
}
}
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;
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);
/* 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))
/* 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);
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);
/* 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);
}