+2011-12-13 Jakub Jelinek <jakub@redhat.com>
+
+ Revert
+ 2011-12-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/51481
+ * gimple-fold.c (gimple_fold_call): Call
+ maybe_clean_or_replace_eh_stmt. Avoid optimization if stmt has EH
+ edges, but gimple_fold_builtin result can't throw.
+
2011-12-13 Jakub Jelinek <jakub@redhat.com>
Michael Matz <matz@suse.de>
if (callee && DECL_BUILT_IN (callee))
{
tree result = gimple_fold_builtin (stmt);
- if (result
- /* Disallow EH edge removal here. We can't call
- gimple_purge_dead_eh_edges here. */
- && (lookup_stmt_eh_lp (stmt) == 0
- || tree_could_throw_p (result)))
+ if (result)
{
if (!update_call_from_tree (gsi, result))
gimplify_and_update_call_from_tree (gsi, result);
- if (!gsi_end_p (*gsi))
- {
- gimple new_stmt = gsi_stmt (*gsi);
- bool update_eh ATTRIBUTE_UNUSED
- = maybe_clean_or_replace_eh_stmt (stmt, new_stmt);
- gcc_assert (!update_eh);
- }
changed = true;
}
}