From 99d887de6caa8e13b938317c2835aecc65b31b6f Mon Sep 17 00:00:00 2001 From: jakub Date: Tue, 13 Sep 2016 19:19:33 +0000 Subject: PR tree-optimization/77454 * tree-ssa-dom.c (optimize_stmt): Set modified flag on stmt after changing GIMPLE_COND. Move update_stmt_if_modified call after this. Formatting fix. * gcc.dg/pr77454.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240120 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-dom.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'gcc/tree-ssa-dom.c') 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 (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 (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)) -- cgit v1.2.1