public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/108665] New: Depenency checking: Run-time loop reversal instead of creating a temporary
@ 2023-02-03 21:47 tkoenig at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: tkoenig at gcc dot gnu.org @ 2023-02-03 21:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108665

            Bug ID: 108665
           Summary: Depenency checking: Run-time loop reversal instead of
                    creating a temporary
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tkoenig at gcc dot gnu.org
  Target Milestone: ---

In the Fortran front end, we could sometimes reverse loops at runtime if
dependency analysis shows that either a forward or a backward loop would have
no dependencies.

Example code:

module x
  implicit none
contains
  subroutine foo(a,i,j,n)
    integer, intent(in) :: i, j, n
    real, dimension(:), intent(inout) :: a
    a(i:i+n-1) = a(j:j+n-1) + 10.
  end subroutine foo
  subroutine bar(a,i,j,n)
    real, dimension(:), intent(inout) :: a
    integer,intent(in) :: i, j, n
    integer :: k
    if (i <= j) then
       do k=0, n-1, 1
          a(i+k) = a(j+k) + 10.
       end do
    else
       do k=n-1,0,-1
          a(i+k) = a(j+k) + 10.   
       end do
    end if
  end subroutine bar
end module x

where we create a temporary in foo.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-03 21:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-03 21:47 [Bug fortran/108665] New: Depenency checking: Run-time loop reversal instead of creating a temporary tkoenig at gcc dot gnu.org

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).