diff options
Diffstat (limited to 'gcc/tree-ssa-propagate.c')
-rw-r--r-- | gcc/tree-ssa-propagate.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c index 879e0db10ea..5f2ecce08b6 100644 --- a/gcc/tree-ssa-propagate.c +++ b/gcc/tree-ssa-propagate.c @@ -964,10 +964,13 @@ replace_phi_args_in (gimple phi, prop_value_t *prop_value) If FOLD_FN is non-NULL the function will be invoked on all statements before propagating values for pass specific simplification. + DO_DCE is true if trivially dead stmts can be removed. + Return TRUE when something changed. */ bool -substitute_and_fold (prop_value_t *prop_value, ssa_prop_fold_stmt_fn fold_fn) +substitute_and_fold (prop_value_t *prop_value, ssa_prop_fold_stmt_fn fold_fn, + bool do_dce) { basic_block bb; bool something_changed = false; @@ -1012,8 +1015,12 @@ substitute_and_fold (prop_value_t *prop_value, ssa_prop_fold_stmt_fn fold_fn) continue; /* No point propagating into a stmt whose result is not used, - but instead we might be able to remove a trivially dead stmt. */ - if (gimple_get_lhs (stmt) + but instead we might be able to remove a trivially dead stmt. + Don't do this when called from VRP, since the SSA_NAME which + is going to be released could be still referenced in VRP + ranges. */ + if (do_dce + && gimple_get_lhs (stmt) && TREE_CODE (gimple_get_lhs (stmt)) == SSA_NAME && has_zero_uses (gimple_get_lhs (stmt)) && !stmt_could_throw_p (stmt) |