From 771f882e18593bf51b526dc3cc75a41aaec2313c Mon Sep 17 00:00:00 2001 From: Zdenek Dvorak Date: Fri, 12 Dec 2008 21:32:47 +0100 Subject: re PR tree-optimization/32044 (final value replacement too aggressive for e.g. targets with no native div/mod insns) PR tree-optimization/32044 * tree-scalar-evolution.h (expression_expensive_p): Declare. * tree-scalar-evolution.c (expression_expensive_p): New function. (scev_const_prop): Avoid introducing expensive expressions. * tree-ssa-loop-ivopts.c (may_eliminate_iv): Ditto. * gcc.dg/pr34027-1.c: Change outcome. * gcc.dg/tree-ssa/pr32044.c: New test. From-SVN: r142719 --- gcc/tree-ssa-loop-ivopts.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gcc/tree-ssa-loop-ivopts.c') diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 683d7d4..2d36bec 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -3844,7 +3844,12 @@ may_eliminate_iv (struct ivopts_data *data, return false; cand_value_at (loop, cand, use->stmt, nit, &bnd); + *bound = aff_combination_to_tree (&bnd); + /* It is unlikely that computing the number of iterations using division + would be more profitable than keeping the original induction variable. */ + if (expression_expensive_p (*bound)) + return false; return true; } -- cgit v1.1