diff options
author | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-11 02:52:54 +0000 |
---|---|---|
committer | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-11 02:52:54 +0000 |
commit | 1e8e4a1db2e21c99c6db24b9927fe5a06f60075b (patch) | |
tree | ab4910e33839a441a5e0100c82084557764f3c6a /gcc/loop-iv.c | |
parent | 5921643ad6d393e4211c031f19acc67dbd497fcf (diff) | |
download | gcc-1e8e4a1db2e21c99c6db24b9927fe5a06f60075b.tar.gz |
PR rtl-optimization/16001
* loop-iv.c (iv_number_of_iterations): Prevent copy propagation in
niter_expr.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84486 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/loop-iv.c')
-rw-r--r-- | gcc/loop-iv.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c index 965359c5931..f390cdd487c 100644 --- a/gcc/loop-iv.c +++ b/gcc/loop-iv.c @@ -1967,6 +1967,7 @@ iv_number_of_iterations (struct loop *loop, rtx insn, rtx condition, unsigned HOST_WIDEST_INT s, size, d, inv; HOST_WIDEST_INT up, down, inc; int was_sharp = false; + rtx old_niter; /* The meaning of these assumptions is this: if !assumptions @@ -2366,6 +2367,8 @@ iv_number_of_iterations (struct loop *loop, rtx insn, rtx condition, desc->niter_expr = delta; } + old_niter = desc->niter_expr; + simplify_using_initial_values (loop, AND, &desc->assumptions); if (desc->assumptions && XEXP (desc->assumptions, 0) == const0_rtx) @@ -2408,8 +2411,19 @@ iv_number_of_iterations (struct loop *loop, rtx insn, rtx condition, desc->const_iter = true; desc->niter_max = desc->niter = val & GET_MODE_MASK (desc->mode); } - else if (!desc->niter_max) - desc->niter_max = determine_max_iter (desc); + else + { + if (!desc->niter_max) + desc->niter_max = determine_max_iter (desc); + + /* simplify_using_initial_values does a copy propagation on the registers + in the expression for the number of iterations. This prolongs life + ranges of registers and increases register pressure, and usually + brings no gain (and if it happens to do, the cse pass will take care + of it anyway). So prevent this behavior, unless it enabled us to + derive that the number of iterations is a constant. */ + desc->niter_expr = old_niter; + } return; |