This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: How to express the fact that arguments don't escape?


Richard Guenther wrote:
2009/8/16 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>:
Richard Guenther wrote:
And this effect will only be positive on optimizations if you have like

 do i=1,10
    g(i)
    ... = function of i
    f(k)
    ... = function of i
  end do

where the load from i can be CSEd around the call to f (because it didn't
escape to g).  So I expect this to be a pretty rare case.  Note it doesn't
help
loop optimizations as i is still clobbered in unpredictable ways by g.
It's not allowed to be changed inside the loop, so if i is clobbered inside
g, the code is undefined.

In that case you can unconditionally omit the copy-back. For the correct variable of course. Which would then still be profitable (just if you for some reason require a copy-back it's likely not always profitable).

Ok, I've already finished the part that identifies the DO loop variable, so I should have a patch tonight.


Cheers,
- Tobi


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