This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/31067] MINLOC should sometimes be inlined (gas_dyn is sooooo sloooow)
- From: "jb at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 May 2007 20:15:59 -0000
- Subject: [Bug fortran/31067] MINLOC should sometimes be inlined (gas_dyn is sooooo sloooow)
- References: <bug-31067-10259@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #16 from jb at gcc dot gnu dot org 2007-05-18 21:15 -------
The critical thing with inlining array intrinsics, IMHO is to give the
optimizer more data to work with allowing it to get rid of temp arrays, perform
loop fusion or fission etc. So with a trivial benchmark like #15, you don't see
any difference, except with potentially higher optimization for user code than
libgfortran. For example in gas_dyn/chozdt:
REAL, DIMENSION (NODES) :: DTEMP
!-----------------------------------------------
! Profile for gfortran 4.3:
! CPU_CLK_UNHALTED L2_CACHE_MISS
! samp %runtim samp %tot
! 59887 22.4783 1484 10.9828 : DTEMP = DX/(ABS(VEL) + SOUND)
! ifort 9.1 profile
! 40104 16.2034 1198 8.8166 : DTEMP = DX/(ABS(VEL) + SOUND)
DTEMP = DX/(ABS(VEL) + SOUND)
ISET = MINLOC (DTEMP)
DT = DTEMP(ISET(1))
If MINLOC were inlined, perhaps a sufficiently optimizer could convert this
into the equivalent
REAL :: DTEMPMIN
INTEGER :: i
DTEMPMIN = HUGE(1.0d0)
DO I = 1, NODES
DT = DX(I)/(ABS(VEL(I)+SOUND(I))
IF (DT < DTEMPMIN) THEN
DTEMPMIN = DT
END IF
END DO
DT = DTEMPMIN
i.e. avoid the temporary array entirely. Yes, I guess this is quite a lot to
ask.
--
jb at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jb at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31067