Commit 16a2acea by Sebastian Pop Committed by Sebastian Pop

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
parent e15e9be3
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> 2006-04-02 Roger Sayle <roger@eyesopen.com>
* builtins.c (dummy_object): Use build_int_cst instead of convert. * builtins.c (dummy_object): Use build_int_cst instead of convert.
......
...@@ -3035,15 +3035,18 @@ end_analyze_subs_aa: ...@@ -3035,15 +3035,18 @@ end_analyze_subs_aa:
static bool static bool
can_use_analyze_subscript_affine_affine (tree *chrec_a, tree *chrec_b) 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)) if (chrec_contains_symbols (CHREC_RIGHT (*chrec_a))
|| chrec_contains_symbols (CHREC_RIGHT (*chrec_b))) || chrec_contains_symbols (CHREC_RIGHT (*chrec_b)))
/* FIXME: For the moment not handled. Might be refined later. */ /* FIXME: For the moment not handled. Might be refined later. */
return false; return false;
diff = chrec_fold_minus (chrec_type (*chrec_a), CHREC_LEFT (*chrec_a), type = chrec_type (*chrec_a);
CHREC_LEFT (*chrec_b)); 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)) if (!evolution_function_is_constant_p (diff))
return false; return false;
...@@ -3052,9 +3055,10 @@ can_use_analyze_subscript_affine_affine (tree *chrec_a, tree *chrec_b) ...@@ -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), *chrec_a = build_polynomial_chrec (CHREC_VARIABLE (*chrec_a),
diff, CHREC_RIGHT (*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), *chrec_b = build_polynomial_chrec (CHREC_VARIABLE (*chrec_b),
integer_zero_node, convert (type, integer_zero_node),
CHREC_RIGHT (*chrec_b)); right_b);
return true; return true;
} }
......
...@@ -476,12 +476,12 @@ compute_overall_effect_of_inner_loop (struct loop *loop, tree evolution_fn) ...@@ -476,12 +476,12 @@ compute_overall_effect_of_inner_loop (struct loop *loop, tree evolution_fn)
else else
{ {
tree res; tree res;
tree type = chrec_type (nb_iter);
/* Number of iterations is off by one (the ssa name we /* Number of iterations is off by one (the ssa name we
analyze must be defined before the exit). */ analyze must be defined before the exit). */
nb_iter = chrec_fold_minus (chrec_type (nb_iter), nb_iter = chrec_fold_minus (type, nb_iter,
nb_iter, build_int_cst_type (type, 1));
build_int_cst_type (chrec_type (nb_iter), 1));
/* evolution_fn is the evolution function in LOOP. Get /* evolution_fn is the evolution function in LOOP. Get
its value in the nb_iter-th iteration. */ its value in the nb_iter-th iteration. */
...@@ -510,10 +510,8 @@ compute_overall_effect_of_inner_loop (struct loop *loop, tree evolution_fn) ...@@ -510,10 +510,8 @@ compute_overall_effect_of_inner_loop (struct loop *loop, tree evolution_fn)
bool bool
chrec_is_positive (tree chrec, bool *value) chrec_is_positive (tree chrec, bool *value)
{ {
bool value0, value1; bool value0, value1, value2;
bool value2; tree type, end_value, nb_iter;
tree end_value;
tree nb_iter;
switch (TREE_CODE (chrec)) switch (TREE_CODE (chrec))
{ {
...@@ -542,17 +540,14 @@ chrec_is_positive (tree chrec, bool *value) ...@@ -542,17 +540,14 @@ chrec_is_positive (tree chrec, bool *value)
if (chrec_contains_undetermined (nb_iter)) if (chrec_contains_undetermined (nb_iter))
return false; return false;
nb_iter = chrec_fold_minus type = chrec_type (nb_iter);
(chrec_type (nb_iter), nb_iter, nb_iter = chrec_fold_minus (type, nb_iter, build_int_cst (type, 1));
build_int_cst (chrec_type (nb_iter), 1));
#if 0 #if 0
/* TODO -- If the test is after the exit, we may decrease the number of /* TODO -- If the test is after the exit, we may decrease the number of
iterations by one. */ iterations by one. */
if (after_exit) if (after_exit)
nb_iter = chrec_fold_minus nb_iter = chrec_fold_minus (type, nb_iter, build_int_cst (type, 1));
(chrec_type (nb_iter), nb_iter,
build_int_cst (chrec_type (nb_iter), 1));
#endif #endif
end_value = chrec_apply (CHREC_VARIABLE (chrec), chrec, nb_iter); end_value = chrec_apply (CHREC_VARIABLE (chrec), chrec, nb_iter);
...@@ -900,8 +895,9 @@ static inline tree ...@@ -900,8 +895,9 @@ static inline tree
set_nb_iterations_in_loop (struct loop *loop, set_nb_iterations_in_loop (struct loop *loop,
tree res) tree res)
{ {
res = chrec_fold_plus (chrec_type (res), res, tree type = chrec_type (res);
build_int_cst_type (chrec_type (res), 1));
res = chrec_fold_plus (type, res, build_int_cst_type (type, 1));
/* FIXME HWI: However we want to store one iteration less than the /* FIXME HWI: However we want to store one iteration less than the
count of the loop in order to be compatible with the other 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 ...@@ -1958,6 +1954,7 @@ instantiate_parameters_1 (struct loop *loop, tree chrec, int flags, htab_t cache
tree res, op0, op1, op2; tree res, op0, op1, op2;
basic_block def_bb; basic_block def_bb;
struct loop *def_loop; struct loop *def_loop;
tree type = chrec_type (chrec);
/* Give up if the expression is larger than the MAX that we allow. */ /* Give up if the expression is larger than the MAX that we allow. */
if (size_expr++ > PARAM_VALUE (PARAM_SCEV_MAX_EXPR_SIZE)) 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 ...@@ -2070,7 +2067,11 @@ instantiate_parameters_1 (struct loop *loop, tree chrec, int flags, htab_t cache
if (TREE_OPERAND (chrec, 0) != op0 if (TREE_OPERAND (chrec, 0) != op0
|| TREE_OPERAND (chrec, 1) != op1) || 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; return chrec;
case MINUS_EXPR: case MINUS_EXPR:
...@@ -2086,7 +2087,11 @@ instantiate_parameters_1 (struct loop *loop, tree chrec, int flags, htab_t cache ...@@ -2086,7 +2087,11 @@ instantiate_parameters_1 (struct loop *loop, tree chrec, int flags, htab_t cache
if (TREE_OPERAND (chrec, 0) != op0 if (TREE_OPERAND (chrec, 0) != op0
|| TREE_OPERAND (chrec, 1) != op1) || 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; return chrec;
case MULT_EXPR: case MULT_EXPR:
...@@ -2102,7 +2107,11 @@ instantiate_parameters_1 (struct loop *loop, tree chrec, int flags, htab_t cache ...@@ -2102,7 +2107,11 @@ instantiate_parameters_1 (struct loop *loop, tree chrec, int flags, htab_t cache
if (TREE_OPERAND (chrec, 0) != op0 if (TREE_OPERAND (chrec, 0) != op0
|| TREE_OPERAND (chrec, 1) != op1) || 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; return chrec;
case NOP_EXPR: case NOP_EXPR:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment