This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, fortran] PR 40628, front-end optimization pass


On 07/20/2010 03:19 AM, Jerry DeLisle wrote:
>>>> Thomas Koenig wrote:
>>>>> finally, here's the first attempt at a front-end optimization pass.
>>>>> Right now, it fixes PR 40626 and optimizes comparisons between
>>>>> variables
>>>>> (which only really is relevant for character comparisons). Many more
>>>>> things could (and should) be added over time.
> Why not start by just changing the filename optimize.c to passes.c and
> go with what you have now, then this can evolve further with time.

I concur and I like Jakub's idea. In general, avoiding function calls
(e.g. TRIM()) and avoiding the generation of temporaries helps a lot as
the ME has difficulties to optimize those way while the FE knows the
language constraints and has a more high-level view which facilitates
certain optimizations.

> One thing I would like to suggest is can you identify a real world
> application that benefits from this initial optimization pass?  Proof
> in the pudding so to speak, but not strictly necessary.  I am more
> curious then anything.

That the such code exists and that a real-world spends quite some time
with trim can be seen at the link of the PR. For many Fortran program,
it probably does not help much as the string processing part is small
(though if you go to 10000s of processes, a single-process config read
starts to matter), but in some cases (like memory tracing in this
example), it can matter a lot.

In case of the real-code program linked in the PR, "TRIM(a) == TRIM(b)"
was changed to "a == b" and the commit log was:

" I think I solved the performance hit when running profiling in memory.
The problem is that trim was being called 8 million times for the c60
test, while not being really necessary. So I got rid of it. Now trim is
only called 200 000 times ;)"

Cf. http://www.tddft.org/trac/octopus/changeset/5672  (octopus is an
electronic structure calculation program available under the GPL from
http://tddft.org/ )

Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]