[Bug fortran/30409] New: [fortran] missed optimization with pure function arguments
kargl at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Mon Jan 8 21:31:00 GMT 2007
The attached code demonstrates a missed optimization opportunity that
can have a severe impact on code. Here are the timings for the 2 loops
on 2 GHz pentium4-m processor.
laptop:kargl[208] gfc4x -o z -O2 a.f90
laptop:kargl[209] ./z
time 1: 5.0741002E-02
time 2: 31.28215
For a pure function the arguments are not changed during execution. Thus,
in the second loop, the 1/y can be hoisted out of the nested loops. Currently,
gfortran allocates/deallocates a temp array with every iteration on the
outer loop, and it does the 1/y array operation on every iteration.
--
Summary: [fortran] missed optimization with pure function
arguments
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kargl at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30409
More information about the Gcc-bugs
mailing list