[patch, fortran] Function call optimization
Mikael Morin
mikael.morin@sfr.fr
Tue Mar 15 22:42:00 GMT 2011
On Tuesday 15 March 2011 20:19:03 Daniel Kraft wrote:
> BTW, what is the distinction between a PURE function and one that is not
> PURE? Only that the compiler is required to check certain things for
> PURE ones? If not, then there must be some kind of allowance for
> side-effects in some sense, it seems to me. (But I don't know the
> answer for sure.)
Well, the PURE ones can be factored _accross_ statements.
The question here is whether the IMPURE ones can be factored _within_ a
statement.
>
> Just my opinion, of course... Yours,
> Daniel
>
> PS: I'm also not really convinced that such an optimization would lead
> to speed-ups in real-world code. How common is it that function calls
> are repeated in cases where the result could be stored away and used
> multiple times? Honestly, I sometimes got the impression that some of
> the "front-end optimizations" gfortran does are more or less for
> technical cases that are not so important in real code anyway.
On second thought, maybe you're right; the speed-up / likeliness-to-break
ratio doesn't look so interesting after all, and selecting only
pure/implicitely pure functions for optimization would get rid of the weird
cases without (hopefully) being too restrictive on the candidates for
optimization.
Mikael
More information about the Fortran
mailing list