On the following testcase:

program test
  integer, parameter :: n = 25000
  integer :: i
  real, dimension(n) :: iener, dens, pres, temp, gamma, cs

  do i = 1, 30000
    call eos (iener, dens, pres, temp, gamma, cs, sheat, cgamma)
  end do

contains

  subroutine eos (iener, dens, pres, temp, gamma, cs, sheat, cgamma)
    real sheat, cgamma
    real, dimension(n) :: iener, dens, pres, temp, gamma, cs

    temp(:n) = iener(:n)/sheat
    pres(:n) = (cgamma - 1.0)*dens(:n)*iener(:n)
    gamma(:n) = cgamma
    cs(:n) = sqrt(cgamma*pres(:n)/dens(:n))
  end subroutine eos

end program test

(derived from the Polyhedron gas_dyn.f90 benchmark), the Intel compiler gains
50% execution speedup by inlining the subroutine when vectorization is enabled
(from 9.0s to 4.4s on my AMD64/linux, using option -ip in addition to -O3 -xW).
gfortran does inline the eos_ subroutine also, but it somehow doesn't use it
for better vectorization, and it stays at the same execution time (around 10s).


-- 
           Summary: Fortran testcase where inlining would be a huge gain
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fxcoudert at gcc dot gnu dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31066

Reply via email to