This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/30409] New: [fortran] missed optimization with pure function arguments
- From: "kargl at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Jan 2007 21:31:13 -0000
- Subject: [Bug fortran/30409] New: [fortran] missed optimization with pure function arguments
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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