diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-09-27 17:18:25 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-09-27 17:18:25 +0000 |
commit | f2df20268393f97674b2b02bfb4ce78a9442e129 (patch) | |
tree | 69c65bf4228b0815d726602917430e7ecd31d590 /gcc/unroll.c | |
parent | df2c7ecb54999c7d09b7d3fda550f66c8e46ccde (diff) | |
download | gcc-f2df20268393f97674b2b02bfb4ce78a9442e129.tar.gz |
PR optimization/12340
* loop.h (struct induction): Document the new semantics
of the 'same' field for bivs.
* unroll.c (biv_total_increment): Don't count the same
biv increment several times.
(loop_iterations) [GENERAL_INDUCT]: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71859 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/unroll.c')
-rw-r--r-- | gcc/unroll.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/unroll.c b/gcc/unroll.c index 084660ca11b..38659d461cb 100644 --- a/gcc/unroll.c +++ b/gcc/unroll.c @@ -2436,7 +2436,13 @@ biv_total_increment (const struct iv_class *bl) if (v->always_computable && v->mult_val == const1_rtx && ! v->maybe_multiple && SCALAR_INT_MODE_P (v->mode)) - result = fold_rtx_mult_add (result, const1_rtx, v->add_val, v->mode); + { + /* If we have already counted it, skip it. */ + if (v->same) + continue; + + result = fold_rtx_mult_add (result, const1_rtx, v->add_val, v->mode); + } else return 0; } @@ -3481,6 +3487,10 @@ loop_iterations (struct loop *loop) return 0; } + /* If we have already counted it, skip it. */ + if (biv_inc->same) + continue; + offset -= INTVAL (biv_inc->add_val); } } |