Re: [patch, fortran] Function call optimization

2011-03-21 Thread Thomas Koenig
Hi Mikael, Here is the new version of the patch. Regression-tested. OK for trunk? OK this time. Thank you. Sende fortran/ChangeLog Sende fortran/dependency.c Sende fortran/frontend-passes.c Sende fortran/gfortran.h Sende fortran/invoke.texi Sende

Re: [patch, fortran] Function call optimization

2011-03-20 Thread Mikael Morin
> Here is the new version of the patch. Regression-tested. OK for trunk? OK this time. Thank you. Mikael

Re: [patch, fortran] Function call optimization

2011-03-20 Thread Thomas Koenig
Hi Mikael, - Array elementals: here it's hard to tell which one is faster; save function calls to a temporary and use the temporary or do multiple function calls every time (but without temporary). I have removed elementals for now. It would probably be best to create a scalar temporary varia

Re: [patch, fortran] Function call optimization

2011-03-19 Thread Mikael Morin
On Saturday 19 March 2011 19:59:56 Thomas Koenig wrote: > Am 19.03.2011 00:23, schrieb Tobias Burnus: > > I have not followed the discussion nor have I fully read the patch, but > > what's the reason for allowing ELEMENTAL functions? > > Here's an updated version of the patch, which removes the el

Re: [patch, fortran] Function call optimization

2011-03-19 Thread Thomas Koenig
Am 19.03.2011 00:23, schrieb Tobias Burnus: I have not followed the discussion nor have I fully read the patch, but what's the reason for allowing ELEMENTAL functions? Here's an updated version of the patch, which removes the elemental functions as well. I have also added an option which allo

Re: [patch, fortran] Function call optimization

2011-03-19 Thread N.M. Maclaren
On Mar 18 2011, Tobias Burnus wrote: Thomas Koenig wrote: + if (!(*e)->value.function.esym->attr.pure + && !(*e)->value.function.esym->attr.implicit_pure + && !(*e)->value.function.esym->attr.elemental) + return 0; I have not followed the discussion nor have I fully r

Re: [patch, fortran] Function call optimization

2011-03-18 Thread Tobias Burnus
Thomas Koenig wrote: + if (!(*e)->value.function.esym->attr.pure + && !(*e)->value.function.esym->attr.implicit_pure + && !(*e)->value.function.esym->attr.elemental) + return 0; I have not followed the discussion nor have I fully read the patch, but what's the reason f

Re: [patch, fortran] Function call optimization

2011-03-16 Thread Thomas Koenig
Am 15.03.2011 23:42, schrieb Mikael Morin: 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 res

[patch, fortran] Function call optimization

2011-03-14 Thread Thomas Koenig
Hello world, the attached patch is a front-end optimization which replaces multiple calls to a function with identical argument lists with an assignment to a temporary variable, and then uses that variable in the original expression. AFAIK, this is permitted by the Fortran standard because s