aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Pop <pop@cri.ensmp.fr>2006-04-03 11:59:38 +0200
committerSebastian Pop <spop@gcc.gnu.org>2006-04-03 09:59:38 +0000
commit16a2acea0aca10ade467f2e15bde2bc956d6528e (patch)
treeab5d9744d365b3c1b20dc31edbcd78f31b409562
parente15e9be3a89ff6ca1efba612f9732d568e1ef3fc (diff)
downloadgcc-16a2acea0aca10ade467f2e15bde2bc956d6528e.zip
gcc-16a2acea0aca10ade467f2e15bde2bc956d6528e.tar.gz
gcc-16a2acea0aca10ade467f2e15bde2bc956d6528e.tar.bz2
re PR tree-optimization/26992 (Internal Compiler Error in dwarf2out.c:7607 build_polynomial_chrec)
PR bootstrap/26992 * tree-scalar-evolution.c (compute_overall_effect_of_inner_loop, chrec_is_positive, set_nb_iterations_in_loop): Use a variable for the type of nb_iter. (instantiate_parameters_1): Convert the operands before calling chrec_fold_minus, chrec_fold_plus, or chrec_fold_multiply. * tree-data-ref.c (can_use_analyze_subscript_affine_affine): Same. From-SVN: r112635
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/tree-data-ref.c14
-rw-r--r--gcc/tree-scalar-evolution.c45
3 files changed, 46 insertions, 23 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index dbe991a..97507f1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2006-04-02 Sebastian Pop <pop@cri.ensmp.fr>
+
+ PR bootstrap/26992
+ * tree-scalar-evolution.c (compute_overall_effect_of_inner_loop,
+ chrec_is_positive, set_nb_iterations_in_loop): Use a variable for
+ the type of nb_iter.
+ (instantiate_parameters_1): Convert the operands before calling
+ chrec_fold_minus, chrec_fold_plus, or chrec_fold_multiply.
+ * tree-data-ref.c (can_use_analyze_subscript_affine_affine): Same.
+
2006-04-02 Roger Sayle <roger@eyesopen.com>
* builtins.c (dummy_object): Use build_int_cst instead of convert.
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 1421e7d..30b491b 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -3035,15 +3035,18 @@ end_analyze_subs_aa:
static bool
can_use_analyze_subscript_affine_affine (tree *chrec_a, tree *chrec_b)
{
- tree diff;
+ tree diff, type, left_a, left_b, right_b;
if (chrec_contains_symbols (CHREC_RIGHT (*chrec_a))
|| chrec_contains_symbols (CHREC_RIGHT (*chrec_b)))
/* FIXME: For the moment not handled. Might be refined later. */
return false;
- diff = chrec_fold_minus (chrec_type (*chrec_a), CHREC_LEFT (*chrec_a),
- CHREC_LEFT (*chrec_b));
+ type = chrec_type (*chrec_a);
+ left_a = CHREC_LEFT (*chrec_a);
+ left_b = chrec_convert (type, CHREC_LEFT (*chrec_b), NULL_TREE);
+ diff = chrec_fold_minus (type, left_a, left_b);
+
if (!evolution_function_is_constant_p (diff))
return false;
@@ -3052,9 +3055,10 @@ can_use_analyze_subscript_affine_affine (tree *chrec_a, tree *chrec_b)
*chrec_a = build_polynomial_chrec (CHREC_VARIABLE (*chrec_a),
diff, CHREC_RIGHT (*chrec_a));
+ right_b = chrec_convert (type, CHREC_RIGHT (*chrec_b), NULL_TREE);
*chrec_b = build_polynomial_chrec (CHREC_VARIABLE (*chrec_b),
- integer_zero_node,
- CHREC_RIGHT (*chrec_b));
+ convert (type, integer_zero_node),
+ right_b);
return true;
}
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index 09fd5e9..f1a2efa 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -476,12 +476,12 @@ compute_overall_effect_of_inner_loop (struct loop *loop, tree evolution_fn)
else
{
tree res;
+ tree type = chrec_type (nb_iter);
/* Number of iterations is off by one (the ssa name we
analyze must be defined before the exit). */
- nb_iter = chrec_fold_minus (chrec_type (nb_iter),
- nb_iter,
- build_int_cst_type (chrec_type (nb_iter), 1));
+ nb_iter = chrec_fold_minus (type, nb_iter,
+ build_int_cst_type (type, 1));
/* evolution_fn is the evolution function in LOOP. Get
its value in the nb_iter-th iteration. */
@@ -510,10 +510,8 @@ compute_overall_effect_of_inner_loop (struct loop *loop, tree evolution_fn)
bool
chrec_is_positive (tree chrec, bool *value)
{
- bool value0, value1;
- bool value2;
- tree end_value;
- tree nb_iter;
+ bool value0, value1, value2;
+ tree type, end_value, nb_iter;
switch (TREE_CODE (chrec))
{
@@ -542,17 +540,14 @@ chrec_is_positive (tree chrec, bool *value)
if (chrec_contains_undetermined (nb_iter))
return false;
- nb_iter = chrec_fold_minus
- (chrec_type (nb_iter), nb_iter,
- build_int_cst (chrec_type (nb_iter), 1));
+ type = chrec_type (nb_iter);
+ nb_iter = chrec_fold_minus (type, nb_iter, build_int_cst (type, 1));
#if 0
/* TODO -- If the test is after the exit, we may decrease the number of
iterations by one. */
if (after_exit)
- nb_iter = chrec_fold_minus
- (chrec_type (nb_iter), nb_iter,
- build_int_cst (chrec_type (nb_iter), 1));
+ nb_iter = chrec_fold_minus (type, nb_iter, build_int_cst (type, 1));
#endif
end_value = chrec_apply (CHREC_VARIABLE (chrec), chrec, nb_iter);
@@ -900,8 +895,9 @@ static inline tree
set_nb_iterations_in_loop (struct loop *loop,
tree res)
{
- res = chrec_fold_plus (chrec_type (res), res,
- build_int_cst_type (chrec_type (res), 1));
+ tree type = chrec_type (res);
+
+ res = chrec_fold_plus (type, res, build_int_cst_type (type, 1));
/* FIXME HWI: However we want to store one iteration less than the
count of the loop in order to be compatible with the other
@@ -1958,6 +1954,7 @@ instantiate_parameters_1 (struct loop *loop, tree chrec, int flags, htab_t cache
tree res, op0, op1, op2;
basic_block def_bb;
struct loop *def_loop;
+ tree type = chrec_type (chrec);
/* Give up if the expression is larger than the MAX that we allow. */
if (size_expr++ > PARAM_VALUE (PARAM_SCEV_MAX_EXPR_SIZE))
@@ -2070,7 +2067,11 @@ instantiate_parameters_1 (struct loop *loop, tree chrec, int flags, htab_t cache
if (TREE_OPERAND (chrec, 0) != op0
|| TREE_OPERAND (chrec, 1) != op1)
- chrec = chrec_fold_plus (TREE_TYPE (chrec), op0, op1);
+ {
+ op0 = chrec_convert (type, op0, NULL_TREE);
+ op1 = chrec_convert (type, op1, NULL_TREE);
+ chrec = chrec_fold_plus (type, op0, op1);
+ }
return chrec;
case MINUS_EXPR:
@@ -2086,7 +2087,11 @@ instantiate_parameters_1 (struct loop *loop, tree chrec, int flags, htab_t cache
if (TREE_OPERAND (chrec, 0) != op0
|| TREE_OPERAND (chrec, 1) != op1)
- chrec = chrec_fold_minus (TREE_TYPE (chrec), op0, op1);
+ {
+ op0 = chrec_convert (type, op0, NULL_TREE);
+ op1 = chrec_convert (type, op1, NULL_TREE);
+ chrec = chrec_fold_minus (type, op0, op1);
+ }
return chrec;
case MULT_EXPR:
@@ -2102,7 +2107,11 @@ instantiate_parameters_1 (struct loop *loop, tree chrec, int flags, htab_t cache
if (TREE_OPERAND (chrec, 0) != op0
|| TREE_OPERAND (chrec, 1) != op1)
- chrec = chrec_fold_multiply (TREE_TYPE (chrec), op0, op1);
+ {
+ op0 = chrec_convert (type, op0, NULL_TREE);
+ op1 = chrec_convert (type, op1, NULL_TREE);
+ chrec = chrec_fold_multiply (type, op0, op1);
+ }
return chrec;
case NOP_EXPR: