diff options
author | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-03-14 00:38:34 +0000 |
---|---|---|
committer | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-03-14 00:38:34 +0000 |
commit | a463eaead43052f98075eb210b931bd0e90b9249 (patch) | |
tree | bf5bf3bffd54164948533f0f4a35ee7c79aaffd7 /gcc/tree-scalar-evolution.c | |
parent | 8b36b557613fa479b70f834e7acc30dee19e737a (diff) | |
download | gcc-a463eaead43052f98075eb210b931bd0e90b9249.tar.gz |
PR tree-optimization/30730
PR tree-optimization/26900
* tree-ssa-loop-niter.c: Include gmp.h.
(bounds): New type.
(mpz_set_double_int, get_type_bounds, mpz_to_double_int,
split_to_var_and_offset, determine_value_range,
bound_difference_of_offsetted_base, refine_bounds_using_guard,
bound_difference, bounds_add, bounds_negate,
number_of_iterations_ne_max, dump_affine_iv): New functions.
(number_of_iterations_ne, number_of_iterations_lt_to_ne,
assert_loop_rolls_lt, assert_loop_rolls_le): Use bounds on the
difference of initial and final value of control iv to validate
results.
(number_of_iterations_cond): Add loop parameter. Determine bounds
on the difference of the extremes of the control iv. Add dumps.
(expand_simple_operations): Handle phi nodes.
(simplify_using_initial_conditions): Do not record used conditions.
(number_of_iterations_exit): Pass loop to number_of_iterations_cond.
Do not set additional_info.
(implies_nonnegative_p, implies_ge_p): Removed.
(derive_constant_upper_bound): Do not use parameter `additional'.
(record_estimate): Parameter `additional' removed. Parameter
`i_bound' added. Do not call derive_constant_upper_bound.
(record_nonwrapping_iv): Use derive_constant_upper_bound to
bound the number of iterations estimate.
(estimate_numbers_of_iterations_loop): Pass the estimate from
the number of iterations analysis to record_estimate.
* tree.h (multiple_of_p): Declare.
* tree-scalar-evolution.c (expression_expensive_p): Removed.
(scev_const_prop): Do not check expression_expensive_p.
* fold-const.c (multiple_of_p): Exported.
* double-int.c (double_int_mask): Exported.
* double-int.h (double_int_mask): Declare.
* tree-flow.h (struct tree_niter_desc): Removed additional_info
field. Added max field.
* gcc.dg/tree-ssa/loop-26.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122896 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-scalar-evolution.c')
-rw-r--r-- | gcc/tree-scalar-evolution.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c index f1914c3d51e..846d27414d5 100644 --- a/gcc/tree-scalar-evolution.c +++ b/gcc/tree-scalar-evolution.c @@ -2864,14 +2864,6 @@ scev_finalize (void) BITMAP_FREE (already_instantiated); } -/* Returns true if EXPR looks expensive. */ - -static bool -expression_expensive_p (tree expr) -{ - return force_expr_to_var_cost (expr) >= target_spill_cost; -} - /* Replace ssa names for that scev can prove they are constant by the appropriate constants. Also perform final value replacement in loops, in case the replacement expressions are cheap. @@ -2958,10 +2950,13 @@ scev_const_prop (void) continue; niter = number_of_latch_executions (loop); - if (niter == chrec_dont_know - /* If computing the number of iterations is expensive, it may be - better not to introduce computations involving it. */ - || expression_expensive_p (niter)) + /* We used to check here whether the computation of NITER is expensive, + and avoided final value elimination if that is the case. The problem + is that it is hard to evaluate whether the expression is too + expensive, as we do not know what optimization opportunities the + the elimination of the final value may reveal. Therefore, we now + eliminate the final values of induction variables unconditionally. */ + if (niter == chrec_dont_know) continue; /* Ensure that it is possible to insert new statements somewhere. */ |