This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] for PR16001
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 21 Jun 2004 21:14:22 +0200
- Subject: [patch] for PR16001
Hello,
this PR is caused by the fact that we prolong life range of register
ax in loop unrolling (more precisely, wherever we use the expression
for the number of iterations), which prevents ax to be used in reload.
Extending the lifetime of registers is not somehow great idea anyway
(since it increases register pressure), so this patch prevents the copy
propagation to occur.
Bootstrapped & regtested on i686.
Zdenek
PR rtl-optimization/16001
* loop-iv.c (iv_number_of_iterations): Prevent copy propagation in
niter_expr.
Index: loop-iv.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/loop-iv.c,v
retrieving revision 1.1.4.11
diff -c -3 -p -r1.1.4.11 loop-iv.c
*** loop-iv.c 27 May 2004 14:32:49 -0000 1.1.4.11
--- loop-iv.c 21 Jun 2004 16:29:32 -0000
*************** iv_number_of_iterations (struct loop *lo
*** 1925,1930 ****
--- 1925,1931 ----
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
*************** iv_number_of_iterations (struct loop *lo
*** 2324,2329 ****
--- 2325,2332 ----
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)
*************** iv_number_of_iterations (struct loop *lo
*** 2366,2373 ****
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);
return;
--- 2369,2387 ----
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);
!
! /* 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;