This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Fortran: The Road Ahead.
- To: egcs at cygnus dot com
- Subject: Re: Fortran: The Road Ahead.
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Date: Sun, 7 Dec 97 19:46:00 +0100
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
- References: <27281.881513940@hurl.cygnus.com>
> > III. New loop optimisations.
> >
> > 1. Moving invariant conditionals out of loops.
> Compiler folks often refer to this as unswitching. Note
> that the conditional must be at the top of the loop to
> perform this kind of optimization.
(Sigh). OK, guys, I probably simplified too much. The
optimisation I really had in mind ran something like this:
Transform:
do i = 1, n
<body1>
if (lcond) then
<body2>
else
<body3>
endif
<body4>
enddo
into (variant I):
if (lcond) then
do i = 1, n
<body1>
<body2>
<body4>
enddo
else
do i = 1, n
<body1>
<body3>
<body4>
enddo
endif
or (variant II):
do i = 1, n
<body1>
enddo
if (lcond) then
do i = 1, n
<body2>
enddo
else
do i = 1, n
<body3>
enddo
endif
do i = 1, n
<body4>
enddo
It would be especially interesting to come up with a heuristic to
choose between variant I and variant II, *given the other
transformations I mentioned* :-)
Cheers,
Toon.