summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Pop <pop@cri.ensmp.fr>2006-04-02 06:27:40 +0200
committerSebastian Pop <spop@gcc.gnu.org>2006-04-02 04:27:40 +0000
commite2157b49e6ebff6aff00a3868aef4c56bb09052c (patch)
tree83a4359437b9ecf688ad5a570bc8501f4db08ebd
parenta84481aacbf798637896bf82b7992872421691e1 (diff)
tree-scalar-evolution.c (add_to_evolution_1): Pass an extra argument at_stmt.
* 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. From-SVN: r112621
-rw-r--r--gcc/ChangeLog28
-rw-r--r--gcc/tree-chrec.c42
-rw-r--r--gcc/tree-chrec.h15
-rw-r--r--gcc/tree-data-ref.c112
-rw-r--r--gcc/tree-scalar-evolution.c59
5 files changed, 167 insertions, 89 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ee49a27d520..e4b1e4caa97 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,33 @@
2006-04-02 Sebastian Pop <pop@cri.ensmp.fr>
+ * 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.
+
+2006-04-02 Sebastian Pop <pop@cri.ensmp.fr>
+
* tree-data-ref.c (compute_all_dependences): Use a pointer to
the dependence_relations vector.
(compute_data_dependences_for_loop): Adjust call to
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))
diff --git a/gcc/tree-chrec.h b/gcc/tree-chrec.h
index 55f6e978545..bc5c7782201 100644
--- a/gcc/tree-chrec.h
+++ b/gcc/tree-chrec.h
@@ -69,7 +69,6 @@ extern tree chrec_fold_minus (tree, tree, tree);
extern tree chrec_fold_multiply (tree, tree, tree);
extern tree chrec_convert (tree, tree, tree);
extern tree chrec_convert_aggressive (tree, tree);
-extern tree chrec_type (tree);
/* Operations. */
extern tree chrec_apply (unsigned, tree, tree);
@@ -106,6 +105,8 @@ build_polynomial_chrec (unsigned loop_num,
|| right == chrec_dont_know)
return chrec_dont_know;
+ gcc_assert (TREE_TYPE (left) == TREE_TYPE (right));
+
return build3 (POLYNOMIAL_CHREC, TREE_TYPE (left),
build_int_cst (NULL_TREE, loop_num), left, right);
}
@@ -208,4 +209,16 @@ no_evolution_in_loop_p (tree chrec, unsigned loop_num, bool *res)
return true;
}
+/* Returns the type of the chrec. */
+
+static inline tree
+chrec_type (tree chrec)
+{
+ if (automatically_generated_chrec_p (chrec))
+ return NULL_TREE;
+
+ return TREE_TYPE (chrec);
+}
+
+
#endif /* GCC_TREE_CHREC_H */
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 8b1c4f1801f..1421e7d3a28 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -1930,8 +1930,8 @@ create_data_ref (tree memref, tree stmt, bool is_read)
constant, type_size);
}
else
- DR_INIT (dr) = init_cond = ssize_int (0);;
-
+ DR_INIT (dr) = init_cond = ssize_int (0);
+
if (invariant)
DR_OFFSET (dr) = invariant;
else
@@ -1957,6 +1957,8 @@ create_data_ref (tree memref, tree stmt, bool is_read)
new_step = size_binop (TRUNC_DIV_EXPR,
fold_convert (ssizetype, step), type_size);
+ init_cond = chrec_convert (chrec_type (access_fn), init_cond, stmt);
+ new_step = chrec_convert (chrec_type (access_fn), new_step, stmt);
access_fn = chrec_replace_initial_condition (access_fn, init_cond);
access_fn = reset_evolution_in_loop (loop->num, access_fn, new_step);
@@ -2011,14 +2013,10 @@ all_chrecs_equal_p (tree chrec)
int j;
for (j = 0; j < TREE_VEC_LENGTH (chrec) - 1; j++)
- {
- tree chrec_j = TREE_VEC_ELT (chrec, j);
- tree chrec_j_1 = TREE_VEC_ELT (chrec, j + 1);
- if (!integer_zerop
- (chrec_fold_minus
- (integer_type_node, chrec_j, chrec_j_1)))
- return false;
- }
+ if (!eq_evolutions_p (TREE_VEC_ELT (chrec, j),
+ TREE_VEC_ELT (chrec, j + 1)))
+ return false;
+
return true;
}
@@ -2063,6 +2061,10 @@ compute_subscript_distance (struct data_dependence_relation *ddr)
conflicts_b = TREE_VEC_ELT (conflicts_b, 0);
}
+ conflicts_b = chrec_convert (integer_type_node, conflicts_b,
+ NULL_TREE);
+ conflicts_a = chrec_convert (integer_type_node, conflicts_a,
+ NULL_TREE);
difference = chrec_fold_minus
(integer_type_node, conflicts_b, conflicts_a);
@@ -2250,6 +2252,8 @@ analyze_ziv_subscript (tree chrec_a,
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "(analyze_ziv_subscript \n");
+ chrec_a = chrec_convert (integer_type_node, chrec_a, NULL_TREE);
+ chrec_b = chrec_convert (integer_type_node, chrec_b, NULL_TREE);
difference = chrec_fold_minus (integer_type_node, chrec_a, chrec_b);
switch (TREE_CODE (difference))
@@ -2323,7 +2327,11 @@ analyze_siv_subscript_cst_affine (tree chrec_a,
tree *last_conflicts)
{
bool value0, value1, value2;
- tree difference = chrec_fold_minus
+ tree difference;
+
+ chrec_a = chrec_convert (integer_type_node, chrec_a, NULL_TREE);
+ chrec_b = chrec_convert (integer_type_node, chrec_b, NULL_TREE);
+ difference = chrec_fold_minus
(integer_type_node, CHREC_LEFT (chrec_b), chrec_a);
if (!chrec_is_positive (initial_condition (difference), &value0))
@@ -2641,32 +2649,52 @@ compute_overlap_steps_for_affine_1_2 (tree chrec_a, tree chrec_b,
*overlaps_b = integer_zero_node;
if (xz_p)
{
- TREE_VEC_ELT (*overlaps_a, 0) =
- chrec_fold_plus (integer_type_node, TREE_VEC_ELT (*overlaps_a, 0),
- overlaps_a_xz);
- *overlaps_b =
- chrec_fold_plus (integer_type_node, *overlaps_b, overlaps_b_xz);
+ tree t0 = chrec_convert (integer_type_node,
+ TREE_VEC_ELT (*overlaps_a, 0), NULL_TREE);
+ tree t1 = chrec_convert (integer_type_node, overlaps_a_xz,
+ NULL_TREE);
+ tree t2 = chrec_convert (integer_type_node, *overlaps_b,
+ NULL_TREE);
+ tree t3 = chrec_convert (integer_type_node, overlaps_b_xz,
+ NULL_TREE);
+
+ TREE_VEC_ELT (*overlaps_a, 0) = chrec_fold_plus (integer_type_node,
+ t0, t1);
+ *overlaps_b = chrec_fold_plus (integer_type_node, t2, t3);
*last_conflicts = last_conflicts_xz;
}
if (yz_p)
{
- TREE_VEC_ELT (*overlaps_a, 1) =
- chrec_fold_plus (integer_type_node, TREE_VEC_ELT (*overlaps_a, 1),
- overlaps_a_yz);
- *overlaps_b =
- chrec_fold_plus (integer_type_node, *overlaps_b, overlaps_b_yz);
+ tree t0 = chrec_convert (integer_type_node,
+ TREE_VEC_ELT (*overlaps_a, 1), NULL_TREE);
+ tree t1 = chrec_convert (integer_type_node, overlaps_a_yz, NULL_TREE);
+ tree t2 = chrec_convert (integer_type_node, *overlaps_b, NULL_TREE);
+ tree t3 = chrec_convert (integer_type_node, overlaps_b_yz, NULL_TREE);
+
+ TREE_VEC_ELT (*overlaps_a, 1) = chrec_fold_plus (integer_type_node,
+ t0, t1);
+ *overlaps_b = chrec_fold_plus (integer_type_node, t2, t3);
*last_conflicts = last_conflicts_yz;
}
if (xyz_p)
{
- TREE_VEC_ELT (*overlaps_a, 0) =
- chrec_fold_plus (integer_type_node, TREE_VEC_ELT (*overlaps_a, 0),
- overlaps_a_xyz);
- TREE_VEC_ELT (*overlaps_a, 1) =
- chrec_fold_plus (integer_type_node, TREE_VEC_ELT (*overlaps_a, 1),
- overlaps_a_xyz);
- *overlaps_b =
- chrec_fold_plus (integer_type_node, *overlaps_b, overlaps_b_xyz);
+ tree t0 = chrec_convert (integer_type_node,
+ TREE_VEC_ELT (*overlaps_a, 0), NULL_TREE);
+ tree t1 = chrec_convert (integer_type_node, overlaps_a_xyz,
+ NULL_TREE);
+ tree t2 = chrec_convert (integer_type_node,
+ TREE_VEC_ELT (*overlaps_a, 1), NULL_TREE);
+ tree t3 = chrec_convert (integer_type_node, overlaps_a_xyz,
+ NULL_TREE);
+ tree t4 = chrec_convert (integer_type_node, *overlaps_b, NULL_TREE);
+ tree t5 = chrec_convert (integer_type_node, overlaps_b_xyz,
+ NULL_TREE);
+
+ TREE_VEC_ELT (*overlaps_a, 0) = chrec_fold_plus (integer_type_node,
+ t0, t1);
+ TREE_VEC_ELT (*overlaps_a, 1) = chrec_fold_plus (integer_type_node,
+ t2, t3);
+ *overlaps_b = chrec_fold_plus (integer_type_node, t4, t5);
*last_conflicts = last_conflicts_xyz;
}
}
@@ -2694,12 +2722,11 @@ analyze_subscript_affine_affine (tree chrec_a,
int init_a, init_b, gamma, gcd_alpha_beta;
int tau1, tau2;
lambda_matrix A, U, S;
- tree difference = chrec_fold_minus (integer_type_node, chrec_a, chrec_b);
- if (integer_zerop (difference))
+ if (eq_evolutions_p (chrec_a, chrec_b))
{
- /* The difference is equal to zero: the accessed index
- overlaps for each iteration in the loop. */
+ /* The accessed index overlaps for each iteration in the
+ loop. */
*overlaps_a = integer_zero_node;
*overlaps_b = integer_zero_node;
*last_conflicts = chrec_dont_know;
@@ -2719,7 +2746,6 @@ analyze_subscript_affine_affine (tree chrec_a,
there is no dependence. This function outputs a description of
the iterations that hold the intersections. */
-
nb_vars_a = nb_vars_in_chrec (chrec_a);
nb_vars_b = nb_vars_in_chrec (chrec_b);
@@ -3177,10 +3203,12 @@ analyze_miv_subscript (tree chrec_a,
dependence_stats.num_miv++;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "(analyze_miv_subscript \n");
-
+
+ chrec_a = chrec_convert (integer_type_node, chrec_a, NULL_TREE);
+ chrec_b = chrec_convert (integer_type_node, chrec_b, NULL_TREE);
difference = chrec_fold_minus (integer_type_node, chrec_a, chrec_b);
- if (chrec_zerop (difference))
+ if (eq_evolutions_p (chrec_a, chrec_b))
{
/* Access functions are the same: all the elements are accessed
in the same order. */
@@ -3502,15 +3530,9 @@ same_access_functions (struct data_dependence_relation *ddr)
unsigned i;
for (i = 0; i < DDR_NUM_SUBSCRIPTS (ddr); i++)
- {
- tree access_fun_a = DR_ACCESS_FN (DDR_A (ddr), i);
- tree access_fun_b = DR_ACCESS_FN (DDR_B (ddr), i);
- tree difference = chrec_fold_minus (integer_type_node, access_fun_a,
- access_fun_b);
- if (TREE_CODE (difference) != INTEGER_CST
- || !integer_zerop (difference))
- return false;
- }
+ if (!eq_evolutions_p (DR_ACCESS_FN (DDR_A (ddr), i),
+ DR_ACCESS_FN (DDR_B (ddr), i)))
+ return false;
return true;
}
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index a346aa5d9e2..09fd5e9155e 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -659,18 +659,19 @@ get_scalar_evolution (tree scalar)
part for this loop. */
static tree
-add_to_evolution_1 (unsigned loop_nb,
- tree chrec_before,
- tree to_add)
+add_to_evolution_1 (unsigned loop_nb, tree chrec_before, tree to_add,
+ tree at_stmt)
{
+ tree type, left, right;
+
switch (TREE_CODE (chrec_before))
{
case POLYNOMIAL_CHREC:
if (CHREC_VARIABLE (chrec_before) <= loop_nb)
{
unsigned var;
- tree left, right;
- tree type = chrec_type (chrec_before);
+
+ type = chrec_type (chrec_before);
/* When there is no evolution part in this loop, build it. */
if (CHREC_VARIABLE (chrec_before) < loop_nb)
@@ -688,21 +689,30 @@ add_to_evolution_1 (unsigned loop_nb,
right = CHREC_RIGHT (chrec_before);
}
- return build_polynomial_chrec
- (var, left, chrec_fold_plus (type, right, to_add));
+ to_add = chrec_convert (type, to_add, at_stmt);
+ right = chrec_convert (type, right, at_stmt);
+ right = chrec_fold_plus (type, right, to_add);
+ return build_polynomial_chrec (var, left, right);
}
else
- /* Search the evolution in LOOP_NB. */
- return build_polynomial_chrec
- (CHREC_VARIABLE (chrec_before),
- add_to_evolution_1 (loop_nb, CHREC_LEFT (chrec_before), to_add),
- CHREC_RIGHT (chrec_before));
+ {
+ /* Search the evolution in LOOP_NB. */
+ left = add_to_evolution_1 (loop_nb, CHREC_LEFT (chrec_before),
+ to_add, at_stmt);
+ right = CHREC_RIGHT (chrec_before);
+ right = chrec_convert (chrec_type (left), right, at_stmt);
+ return build_polynomial_chrec (CHREC_VARIABLE (chrec_before),
+ left, right);
+ }
default:
/* These nodes do not depend on a loop. */
if (chrec_before == chrec_dont_know)
return chrec_dont_know;
- return build_polynomial_chrec (loop_nb, chrec_before, to_add);
+
+ left = chrec_before;
+ right = chrec_convert (chrec_type (left), to_add, at_stmt);
+ return build_polynomial_chrec (loop_nb, left, right);
}
}
@@ -841,10 +851,8 @@ add_to_evolution_1 (unsigned loop_nb,
*/
static tree
-add_to_evolution (unsigned loop_nb,
- tree chrec_before,
- enum tree_code code,
- tree to_add)
+add_to_evolution (unsigned loop_nb, tree chrec_before, enum tree_code code,
+ tree to_add, tree at_stmt)
{
tree type = chrec_type (to_add);
tree res = NULL_TREE;
@@ -874,7 +882,7 @@ add_to_evolution (unsigned loop_nb,
? build_real (type, dconstm1)
: build_int_cst_type (type, -1));
- res = add_to_evolution_1 (loop_nb, chrec_before, to_add);
+ res = add_to_evolution_1 (loop_nb, chrec_before, to_add, at_stmt);
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -1094,7 +1102,7 @@ follow_ssa_edge_in_rhs (struct loop *loop, tree at_stmt, tree rhs,
*evolution_of_loop = add_to_evolution
(loop->num,
chrec_convert (type_rhs, evol, at_stmt),
- PLUS_EXPR, rhs1);
+ PLUS_EXPR, rhs1, at_stmt);
else if (res == t_false)
{
@@ -1106,7 +1114,7 @@ follow_ssa_edge_in_rhs (struct loop *loop, tree at_stmt, tree rhs,
*evolution_of_loop = add_to_evolution
(loop->num,
chrec_convert (type_rhs, *evolution_of_loop, at_stmt),
- PLUS_EXPR, rhs0);
+ PLUS_EXPR, rhs0, at_stmt);
else if (res == t_dont_know)
*evolution_of_loop = chrec_dont_know;
@@ -1127,7 +1135,7 @@ follow_ssa_edge_in_rhs (struct loop *loop, tree at_stmt, tree rhs,
*evolution_of_loop = add_to_evolution
(loop->num, chrec_convert (type_rhs, *evolution_of_loop,
at_stmt),
- PLUS_EXPR, rhs1);
+ PLUS_EXPR, rhs1, at_stmt);
else if (res == t_dont_know)
*evolution_of_loop = chrec_dont_know;
@@ -1145,7 +1153,7 @@ follow_ssa_edge_in_rhs (struct loop *loop, tree at_stmt, tree rhs,
*evolution_of_loop = add_to_evolution
(loop->num, chrec_convert (type_rhs, *evolution_of_loop,
at_stmt),
- PLUS_EXPR, rhs0);
+ PLUS_EXPR, rhs0, at_stmt);
else if (res == t_dont_know)
*evolution_of_loop = chrec_dont_know;
@@ -1175,7 +1183,7 @@ follow_ssa_edge_in_rhs (struct loop *loop, tree at_stmt, tree rhs,
if (res == t_true)
*evolution_of_loop = add_to_evolution
(loop->num, chrec_convert (type_rhs, *evolution_of_loop, at_stmt),
- MINUS_EXPR, rhs1);
+ MINUS_EXPR, rhs1, at_stmt);
else if (res == t_dont_know)
*evolution_of_loop = chrec_dont_know;
@@ -2043,7 +2051,10 @@ instantiate_parameters_1 (struct loop *loop, tree chrec, int flags, htab_t cache
if (CHREC_LEFT (chrec) != op0
|| CHREC_RIGHT (chrec) != op1)
- chrec = build_polynomial_chrec (CHREC_VARIABLE (chrec), op0, op1);
+ {
+ op1 = chrec_convert (chrec_type (op0), op1, NULL_TREE);
+ chrec = build_polynomial_chrec (CHREC_VARIABLE (chrec), op0, op1);
+ }
return chrec;
case PLUS_EXPR: