diff options
author | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-04-02 04:27:40 +0000 |
---|---|---|
committer | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-04-02 04:27:40 +0000 |
commit | f84a688a6b56c057f6fea740c87d9618880e4c2d (patch) | |
tree | 83a4359437b9ecf688ad5a570bc8501f4db08ebd /gcc/tree-chrec.c | |
parent | 2af73e54863b22653f079af0f2e75ef47dcd0685 (diff) | |
download | gcc-f84a688a6b56c057f6fea740c87d9618880e4c2d.tar.gz |
* tree-scalar-evolution.c (add_to_evolution_1): Pass an extra argument
at_stmt. Convert the type of operands before calling
build_polynomial_chrec.
(add_to_evolution): Pass an extra argument at_stmt. Adjust the call to
add_to_evolution_1.
(follow_ssa_edge_in_rhs): Adjust call to add_to_evolution.
(instantiate_parameters_1): Convert the type of operands before calling
build_polynomial_chrec.
* tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly,
chrec_fold_multiply_poly_poly, chrec_replace_initial_condition,
reset_evolution_in_loop): Insert asserts to check the types of the
operands.
(chrec_type): Moved...
(eq_evolutions_p): Use operand_equal_p.
* tree-chrec.h (build_polynomial_chrec): Insert an assert to check
the types of the operands.
(chrec_type): ...here.
* tree-data-ref.c (create_data_ref): Convert the operands before
calling chrec_replace_initial_condition.
(same_access_functions, analyze_subscript_affine_affine,
analyze_miv_subscript, all_chrecs_equal_p): Use eq_evolutions_p.
(compute_subscript_distance, analyze_ziv_subscript,
analyze_siv_subscript_cst_affine, compute_overlap_steps_for_affine_1_2,
analyze_miv_subscript): Convert the operands before calling
chrec_fold_minus or chrec_fold_plus.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112621 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-chrec.c')
-rw-r--r-- | gcc/tree-chrec.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c index 3863e087029..5eb9037598b 100644 --- a/gcc/tree-chrec.c +++ b/gcc/tree-chrec.c @@ -63,7 +63,8 @@ chrec_fold_poly_cst (enum tree_code code, gcc_assert (cst); gcc_assert (TREE_CODE (poly) == POLYNOMIAL_CHREC); gcc_assert (!is_not_constant_evolution (cst)); - + gcc_assert (type == chrec_type (poly)); + switch (code) { case PLUS_EXPR: @@ -103,6 +104,8 @@ chrec_fold_plus_poly_poly (enum tree_code code, gcc_assert (poly1); gcc_assert (TREE_CODE (poly0) == POLYNOMIAL_CHREC); gcc_assert (TREE_CODE (poly1) == POLYNOMIAL_CHREC); + gcc_assert (chrec_type (poly0) == chrec_type (poly1)); + gcc_assert (type == chrec_type (poly0)); /* {a, +, b}_1 + {c, +, d}_2 -> {{a, +, b}_1 + c, +, d}_2, @@ -177,6 +180,8 @@ chrec_fold_multiply_poly_poly (tree type, gcc_assert (poly1); gcc_assert (TREE_CODE (poly0) == POLYNOMIAL_CHREC); gcc_assert (TREE_CODE (poly1) == POLYNOMIAL_CHREC); + gcc_assert (chrec_type (poly0) == chrec_type (poly1)); + gcc_assert (type == chrec_type (poly0)); /* {a, +, b}_1 * {c, +, d}_2 -> {c*{a, +, b}_1, +, d}_2, {a, +, b}_2 * {c, +, d}_1 -> {a*{c, +, d}_1, +, b}_2, @@ -246,10 +251,8 @@ chrec_fold_automatically_generated_operands (tree op0, /* Fold the addition of two chrecs. */ static tree -chrec_fold_plus_1 (enum tree_code code, - tree type, - tree op0, - tree op1) +chrec_fold_plus_1 (enum tree_code code, tree type, + tree op0, tree op1) { if (automatically_generated_chrec_p (op0) || automatically_generated_chrec_p (op1)) @@ -319,6 +322,10 @@ chrec_fold_plus (tree type, tree op0, tree op1) { + if (automatically_generated_chrec_p (op0) + || automatically_generated_chrec_p (op1)) + return chrec_fold_automatically_generated_operands (op0, op1); + if (integer_zerop (op0)) return op1; if (integer_zerop (op1)) @@ -334,6 +341,10 @@ chrec_fold_minus (tree type, tree op0, tree op1) { + if (automatically_generated_chrec_p (op0) + || automatically_generated_chrec_p (op1)) + return chrec_fold_automatically_generated_operands (op0, op1); + if (integer_zerop (op1)) return op0; @@ -583,7 +594,9 @@ chrec_replace_initial_condition (tree chrec, { if (automatically_generated_chrec_p (chrec)) return chrec; - + + gcc_assert (chrec_type (chrec) == chrec_type (init_cond)); + switch (TREE_CODE (chrec)) { case POLYNOMIAL_CHREC: @@ -729,6 +742,8 @@ reset_evolution_in_loop (unsigned loop_num, tree chrec, tree new_evol) { + gcc_assert (chrec_type (chrec) == chrec_type (new_evol)); + if (TREE_CODE (chrec) == POLYNOMIAL_CHREC && CHREC_VARIABLE (chrec) > loop_num) { @@ -1241,17 +1256,6 @@ chrec_convert_aggressive (tree type, tree chrec) return build_polynomial_chrec (CHREC_VARIABLE (chrec), lc, rc); } -/* Returns the type of the chrec. */ - -tree -chrec_type (tree chrec) -{ - if (automatically_generated_chrec_p (chrec)) - return NULL_TREE; - - return TREE_TYPE (chrec); -} - /* Returns true when CHREC0 == CHREC1. */ bool @@ -1269,8 +1273,8 @@ eq_evolutions_p (tree chrec0, switch (TREE_CODE (chrec0)) { case INTEGER_CST: - return integer_zerop (fold (build2 (MINUS_EXPR, TREE_TYPE (chrec0), - chrec0, chrec1))); + return operand_equal_p (chrec0, chrec1, 0); + case POLYNOMIAL_CHREC: return (CHREC_VARIABLE (chrec0) == CHREC_VARIABLE (chrec1) && eq_evolutions_p (CHREC_LEFT (chrec0), CHREC_LEFT (chrec1)) |