http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48636
--- Comment #4 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-04-17 13:32:11 UTC --- (In reply to comment #3) > The second item is interesting - it would be cool if backend was able to work > out that the code is supposed to simplify after inlining. Either by itself or > by frontend hint. > Can you provide me very simple testcase for that I can look into how it looks > like in backend? Perhaps some kind of frontend hinting would work well here. Here is some sample code (extreme, I admit) which profits a lot from inlining: - Strides are known to be one when inlining (a common case, but you can never be sure if the user doesn't call a(1:5:2)) - Expensive setting up of, and reading from the array descriptor - Loops can be completely unrolled module foo implicit none contains subroutine bar(a,x) real, dimension(:,:), intent(in) :: a real, intent(out) :: x integer :: i,j x = 0 do j=1,ubound(a,2) do i=1,ubound(a,1) x = x + a(i,j)**2 end do end do end subroutine bar end module foo program main use foo implicit none real, dimension(2,3) :: a real :: x data a /1.0, 2.0, 3.0, -1.0, -2.0, -3.0/ call bar(a,x) print *,x end program main