------- Comment #9 from rguenth at gcc dot gnu dot org  2010-05-16 10:30 -------
It makes sense to do this in the frontend.  The worst thing is when the
frontend
creates array temporaries - those are really really hard to get rid of in the
middle-end.

There are basically two (or maybe two and a half) ways to this and similar
problems.

 1) Do as much dependence analysis in the frontend as possible and create the
remaining necessary temporaries there

 2) Delay creation of all temporaries until somewhen in the middle-end

 2.5) Mark the generated temporaries somehow to make them easier accessible
to later middle-end optimizations

I once was working on the necessary infrastructure to do 2) (the so-called
middle-end array expressions).  This work has been pushed back on my
TODO list again and again (and recently I discovered some cases that it
might not be able to handle) - simply due to lack of time (and lack of
knowledge of the Fortran frontend which would be the only (or at least major)
consumer).

I do not think 2.5) is the proper way out of the issue, though probably
it won't hurt (but I didn't think a lot about it nor do I have a proposal
on how to do it).

So I think 1) indeed makes sense.  At the moment the frontend is the only
one that can avoid generating temporaries.

Note that Jakub had the useful suggestion of emitting versioned code from
the frontend.  Basically when the frontend knows that an array temporary
might not be necessary emit two versions of the loop guarded with
a proper runtime condition.  One with and one without temporaries.
This also has the chance that the middle-end will figure out that one
of the cases is not necessary.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36928

Reply via email to