[Bug fortran/85531] Implement some loop fusion in the Fortran front end
tkoenig at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Apr 26 08:20:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85531
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Can you provide a testcase that can be compiled?
--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Here it is. The internal writes are there just to confuse the
optimizer.
module x
implicit none
contains
subroutine foo(a,b,c, n)
integer, intent(in) :: n
double precision, dimension(n), intent(in) :: a
double precision, dimension(n), intent(out) :: b,c
b = a
c = a
end subroutine foo
subroutine bar(a,b,c,n)
integer, intent(in) :: n
double precision, dimension(n), intent(in) :: a
double precision, dimension(n), intent(out) :: b,c
integer :: i
do concurrent (i=1:n)
b(i) = a(i)
c(i) = a(i)
end do
end subroutine bar
end module x
program main
use x
implicit none
double precision, dimension(:), allocatable :: a, b, c
integer, parameter :: n = 10**7
double precision :: t1, t2
character(len=80) :: line, line2
integer :: i
allocate (a(n), b(n), c(n))
call random_number(a)
line = '20'
call cpu_time(t1)
call foo(a,b,c,n)
call cpu_time(t2)
print *,t2-t1
read (unit=line,fmt=*) i
write (unit=line2, fmt=*) b(i),c(i)
line = '20'
call cpu_time(t1)
call bar(a,b,c,n)
call cpu_time(t2)
print *,t2-t1
read (unit=line,fmt=*) i
write (unit=line2, fmt=*) b(i),c(i)
end program main
More information about the Gcc-bugs
mailing list