public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* loop optimizations mark 6
@ 1998-01-22  4:12 Richard Henderson
  1998-01-23 14:48 ` John Carr
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 1998-01-22  4:12 UTC (permalink / raw)
  To: toon, egcs

Of note in this revision:

  1) init_alias_analysis in scan_loop, so that the alias code sees
     the new pseudo's we created in the inner loop.

  2) simplify_giv_expr looks through the movables searching for
     arithmetic to unify two invariant registers.

  3) express_from matches a few more patterns.


Number 1 is dreadfully important for Fortran.  I'm not sure how it
was missed before, but there we go.

Number 2 allows two arrays, either on the stack or in the same COMMON 
block to have their givs combined.  Cf

      subroutine foo
      common /bar/ a1(10), a2(10)
      do i = 1, 10
         a1(i) = 2*a2(i)
      end do
      return
      end

It also has affected (dare I say helped?) the situation with variable
sized arrays.  For the first time, our dear old friend resid does not
have a integer multiplication in either of its loops.  Things are still
a bit shakey here though -- some wierdness in the loop setup code 
creating three copies of N*8 in strange ways.


r~

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: loop optimizations mark 6
  1998-01-23 14:48 ` John Carr
@ 1998-01-23 11:15   ` Richard Henderson
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Henderson @ 1998-01-23 11:15 UTC (permalink / raw)
  To: John Carr; +Cc: egcs

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: loop optimizations mark 6
  1998-01-22  4:12 loop optimizations mark 6 Richard Henderson
@ 1998-01-23 14:48 ` John Carr
  1998-01-23 11:15   ` Richard Henderson
  0 siblings, 1 reply; 3+ messages in thread
From: John Carr @ 1998-01-23 14:48 UTC (permalink / raw)
  To: Richard Henderson; +Cc: toon, egcs

>   1) init_alias_analysis in scan_loop, so that the alias code sees
>      the new pseudo's we created in the inner loop.

That's what record_base_value is for.  Is it not working right?
Did I miss some places where it should have been called?


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-01-23 14:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-01-22  4:12 loop optimizations mark 6 Richard Henderson
1998-01-23 14:48 ` John Carr
1998-01-23 11:15   ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).