summaryrefslogtreecommitdiff
path: root/gcc/tree-scalar-evolution.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-scalar-evolution.c')
-rw-r--r--gcc/tree-scalar-evolution.c19
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. */