[PATCH] Fortran/PR31593 Speed up some loops
Tobias Schlüter
tobias.schlueter@physik.uni-muenchen.de
Sat Aug 15 18:51:00 GMT 2009
Hi,
we have a special case to deal with loops with step +-1. The code
generated in this case uses the do variable also as the loop counter.
This saves some arithmetic, but has the disadvantage that if the do
variable is used as an argument to a procedure, the compiler will have
to assume that it changed all over the place, and therefore this can
produce slower code.
In the PR, comment #23, is a testcase where the attached simple patch,
which reintroduces the separation between loop count and do variable,
while still saving some arithmetic, creates a 10% benefit. I ran the
polyhedron testsuite, but with good faith I can only say that the patch
is performance neutral. This may be because I used -funroll-loops where
the loop count is treated separately anyway.
Tested on i386-darwin, and I also checked that I can run the polyhedron
benchmarks on i686-linux successfully with it.
Ok for the trunk?
Cheers,
- Tobi
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: better_loops.diff.txt
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20090815/97f408fb/attachment.txt>
More information about the Fortran
mailing list