From: Richard Biener Date: Mon, 10 Dec 2018 14:20:18 +0000 (+0000) Subject: tree-affine.c (tree_to_aff_combination): Remove unreachable MEM_REF case. X-Git-Tag: upstream/12.2.0~27469 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e5840e758de4bfdfb2a33d2d24eb025345d355f1;p=platform%2Fupstream%2Fgcc.git tree-affine.c (tree_to_aff_combination): Remove unreachable MEM_REF case. 2018-12-10 Richard Biener * tree-affine.c (tree_to_aff_combination): Remove unreachable MEM_REF case. (aff_combination_expand): Cache on SSA names, not possibly on conversion trees. Avoid expanding cases we do not handle. From-SVN: r266956 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e91b1f9..08354fa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,12 @@ 2018-12-10 Richard Biener + * tree-affine.c (tree_to_aff_combination): Remove unreachable + MEM_REF case. + (aff_combination_expand): Cache on SSA names, not possibly + on conversion trees. Avoid expanding cases we do not handle. + +2018-12-10 Richard Biener + PR tree-optimization/88427 * vr-values.c (vr_values::extract_range_from_phi_node): Handle symbolic ranges conservatively when trying to drop diff --git a/gcc/tree-affine.c b/gcc/tree-affine.c index 96b479d..c10cdd0 100644 --- a/gcc/tree-affine.c +++ b/gcc/tree-affine.c @@ -350,25 +350,6 @@ tree_to_aff_combination (tree expr, tree type, aff_tree *comb) } return; - case MEM_REF: - if (TREE_CODE (TREE_OPERAND (expr, 0)) == ADDR_EXPR) - tree_to_aff_combination (TREE_OPERAND (TREE_OPERAND (expr, 0), 0), - type, comb); - else if (integer_zerop (TREE_OPERAND (expr, 1))) - { - aff_combination_elt (comb, type, expr); - return; - } - else - aff_combination_elt (comb, type, - build2 (MEM_REF, TREE_TYPE (expr), - TREE_OPERAND (expr, 0), - build_int_cst - (TREE_TYPE (TREE_OPERAND (expr, 1)), 0))); - tree_to_aff_combination (TREE_OPERAND (expr, 1), sizetype, &tmp); - aff_combination_add (comb, &tmp); - return; - CASE_CONVERT: { tree otype = TREE_TYPE (expr); @@ -721,21 +702,39 @@ aff_combination_expand (aff_tree *comb ATTRIBUTE_UNUSED, if (TREE_CODE_CLASS (code) == tcc_reference) continue; - if (!*cache) - *cache = new hash_map; - name_expansion **slot = &(*cache)->get_or_insert (e); - exp = *slot; - + name_expansion **slot = NULL; + if (*cache) + slot = (*cache)->get (name); + exp = slot ? *slot : NULL; if (!exp) { + /* Only bother to handle cases tree_to_aff_combination will. */ + switch (code) + { + case POINTER_PLUS_EXPR: + case PLUS_EXPR: + case MINUS_EXPR: + case MULT_EXPR: + case NEGATE_EXPR: + case BIT_NOT_EXPR: + CASE_CONVERT: + rhs = gimple_assign_rhs_to_tree (def); + break; + case ADDR_EXPR: + case INTEGER_CST: + case POLY_INT_CST: + rhs = gimple_assign_rhs1 (def); + break; + default: + continue; + } + tree_to_aff_combination (rhs, TREE_TYPE (name), ¤t); exp = XNEW (struct name_expansion); exp->in_progress = 1; - *slot = exp; - rhs = gimple_assign_rhs_to_tree (def); - if (e != name) - rhs = fold_convert (type, rhs); - - tree_to_aff_combination_expand (rhs, comb->type, ¤t, cache); + if (!*cache) + *cache = new hash_map; + (*cache)->put (name, exp); + aff_combination_expand (¤t, cache); exp->expansion = current; exp->in_progress = 0; } @@ -746,6 +745,8 @@ aff_combination_expand (aff_tree *comb ATTRIBUTE_UNUSED, gcc_assert (!exp->in_progress); current = exp->expansion; } + if (!useless_type_conversion_p (comb->type, current.type)) + aff_combination_convert (¤t, comb->type); /* Accumulate the new terms to TO_ADD, so that we do not modify COMB while traversing it; include the term -coef * E, to remove