summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dom.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-ssa-dom.c')
-rw-r--r--gcc/tree-ssa-dom.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 8bf5b3c9ffe..b007388f3ea 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -1923,12 +1923,11 @@ optimize_stmt (basic_block bb, gimple_stmt_iterator si,
{
tree val = NULL;
- update_stmt_if_modified (stmt);
-
if (gimple_code (stmt) == GIMPLE_COND)
val = fold_binary_loc (gimple_location (stmt),
- gimple_cond_code (stmt), boolean_type_node,
- gimple_cond_lhs (stmt), gimple_cond_rhs (stmt));
+ gimple_cond_code (stmt), boolean_type_node,
+ gimple_cond_lhs (stmt),
+ gimple_cond_rhs (stmt));
else if (gswitch *swtch_stmt = dyn_cast <gswitch *> (stmt))
val = gimple_switch_index (swtch_stmt);
@@ -1946,6 +1945,8 @@ optimize_stmt (basic_block bb, gimple_stmt_iterator si,
gimple_cond_make_true (as_a <gcond *> (stmt));
else
gcc_unreachable ();
+
+ gimple_set_modified (stmt, true);
}
/* Further simplifications may be possible. */
@@ -1953,6 +1954,8 @@ optimize_stmt (basic_block bb, gimple_stmt_iterator si,
}
}
+ update_stmt_if_modified (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_or_replace_eh_stmt (old_stmt, stmt))