From d7f336f846f4333c3e55cc222fba21b4bc154119 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 7 Oct 2016 13:47:40 +0000 Subject: tree-ssa-propagate.c (replace_phi_args_in): Remove no longer required hack. 2016-10-07 Richard Biener * tree-ssa-propagate.c (replace_phi_args_in): Remove no longer required hack. (substitute_and_fold_dom_walker::before_dom_children): Substitute and fold before pass specific folding to avoid feeding that with SSA names that will be later released. * tree-ssa-ccp.c (get_value_for_expr): Guard for new SSA names introduced by folding and visited by evaluate_stmt called during ccp_fold_stmt. (likely_value): Likewise. (evaluate_stmt): Likewise. * tree-vrp.c (simplify_truth_ops_using_ranges): Fold modified stmt. (simplify_div_or_mod_using_ranges): Likewise. (simplify_min_or_max_using_ranges): Likewise. (simplify_abs_using_ranges): Likewise. (simplify_conversion_using_ranges): Likewise. (simplify_float_conversion_using_ranges): Likewise. (simplify_stmt_using_ranges): Likewise. * gcc.dg/tree-ssa/vrp01.c: Adjust. * gcc.dg/tree-ssa/vrp34.c: Likewise. From-SVN: r240865 --- gcc/tree-ssa-ccp.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'gcc/tree-ssa-ccp.c') diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 3dc9ffa..fe9a313 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -591,7 +591,15 @@ get_value_for_expr (tree expr, bool for_bits_p) if (TREE_CODE (expr) == SSA_NAME) { - val = *get_value (expr); + ccp_prop_value_t *val_ = get_value (expr); + if (val_) + val = *val_; + else + { + val.lattice_val = VARYING; + val.value = NULL_TREE; + val.mask = -1; + } if (for_bits_p && val.lattice_val == CONSTANT && TREE_CODE (val.value) == ADDR_EXPR) @@ -673,12 +681,12 @@ likely_value (gimple *stmt) { ccp_prop_value_t *val = get_value (use); - if (val->lattice_val == UNDEFINED) + if (val && val->lattice_val == UNDEFINED) has_undefined_operand = true; else all_undefined_operands = false; - if (val->lattice_val == CONSTANT) + if (val && val->lattice_val == CONSTANT) has_constant_operand = true; if (SSA_NAME_IS_DEFAULT_DEF (use) @@ -1739,11 +1747,11 @@ evaluate_stmt (gimple *stmt) simplified = ccp_fold (stmt); if (simplified && TREE_CODE (simplified) == SSA_NAME) { - val = *get_value (simplified); - if (val.lattice_val != VARYING) + ccp_prop_value_t *val = get_value (simplified); + if (val && val->lattice_val != VARYING) { fold_undefer_overflow_warnings (true, stmt, 0); - return val; + return *val; } } is_constant = simplified && is_gimple_min_invariant (simplified); -- cgit v1.1