diff options
author | Zdenek Dvorak <ook@ucw.cz> | 2008-12-12 21:32:47 +0100 |
---|---|---|
committer | Zdenek Dvorak <rakdver@gcc.gnu.org> | 2008-12-12 20:32:47 +0000 |
commit | 771f882e18593bf51b526dc3cc75a41aaec2313c (patch) | |
tree | d2bf855f278b353dce85dfa95de900d9e0e0ca37 /gcc/tree-ssa-loop-ivopts.c | |
parent | 9c877fcc00d1510fd4a6e0d109609522f6e108e1 (diff) | |
download | gcc-771f882e18593bf51b526dc3cc75a41aaec2313c.zip gcc-771f882e18593bf51b526dc3cc75a41aaec2313c.tar.gz gcc-771f882e18593bf51b526dc3cc75a41aaec2313c.tar.bz2 |
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
Diffstat (limited to 'gcc/tree-ssa-loop-ivopts.c')
-rw-r--r-- | gcc/tree-ssa-loop-ivopts.c | 5 |
1 files changed, 5 insertions, 0 deletions
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; } |