From 8ab7d796d82889397ac6b74477be99fc5ee76831 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 14 Jun 2010 17:19:04 +0200 Subject: re PR tree-optimization/44508 (libgomp.fortran/vla1.f90 ICE on s390) PR tree-optimization/44508 * tree-ssa-propagate.h (substitute_and_fold): Add DO_DCE argument. * tree-ssa-propagate.c (substitute_and_fold): If !DO_DCE, don't eliminate trivially dead stmts. * tree-vrp.c (vrp_finalize): Pass false as last argument to substitute_and_fold. * tree-ssa-copy.c (fini_copy_prop): Pass true as last argument to substitute_and_fold. * tree-ssa-ccp.c (ccp_finalize): Likewise. * gcc.dg/tree-ssa/pr21086.c: Adjust. From-SVN: r160749 --- gcc/tree-ssa-propagate.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'gcc/tree-ssa-propagate.c') diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c index 879e0db..5f2ecce 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) -- cgit v1.1