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.