This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: loop optimizations mark 6
- To: John Carr <jfc at mit dot edu>
- Subject: Re: loop optimizations mark 6
- From: Richard Henderson <rth at cygnus dot com>
- Date: Fri, 23 Jan 1998 11:16:04 -0800
- Cc: egcs at cygnus dot com
- References: <19980122013536.50292@dot.cygnus.com> <199801231542.KAA04901@jfc.>
- Reply-To: Richard Henderson <rth at cygnus dot com>
On Fri, Jan 23, 1998 at 10:42:38AM -0500, John Carr wrote:
> That's what record_base_value is for. Is it not working right?
> Did I miss some places where it should have been called?
Ah hah. The only place in loop.c that I see record_base_value
is in emit_iv_add_mult, but there are many other places where
instructions are emitted, so I can only assume many places were
missed.
I have a test case for at least the one particular problem I
found. There is a reference to N (through a mem since it is
fortran) in the inner loop, and on the Alpha at least it was
not hoisted out, because the address was in a pseudo >
reg_known_value_size.
r~
subroutine resid(res,u,rhs,n)
implicit none
integer n
double precision res(n,n),rhs(n,n),u(n,n)
integer i,j
double precision h, h2i
h=1.d0/(n-1)
h2i=1.d0/(h*h)
do j = 2, n-1
do i = 2, n-1
res(i,j)=-h2i*(u(i+1,j)+u(i-1,j)+u(i,j+1)+u(i,j-1)-
, 4.d0*u(i,j))+rhs(i,j)
enddo
enddo
end