[Fwd: question on optimizing calls to library functions]
Daniel Franke
franke.daniel@gmail.com
Wed Dec 10 17:03:00 GMT 2008
On Wednesday 10 December 2008 17:31:17 Richard Guenther wrote:
> So what you want is to tell the middle-end that the function result is
> only dependent on the memory reachable from its argument (remember, you
> pass in fortran array descriptors, right?) and its only side-effect is
> storing to reachable memory of a specific argument.
>
> If that is know the compiler can CSE the call given that it can prove the
> arguments are the same. If it would be implemented, of course.
This is what I assumed could be done, yes. If it's feasible, that's a
different question, but ...
> I don't know if CSEing matmul is useful though. For scalar functions (ok,
> again you have the pass-by-reference problem here) you should tell the
> compiler by making the functions const or pure.
... it could be worth a try. Especially as there a plenty of functions in
libgfortran that could benefit :)
Which brings us back to the initial question: how does one mark them as pure
or const? Are ATTR_PURE and friends the right way to go? Where, and how can or
should these attributes be applied?
These questions are probably quite basic, but this is uncharted land for me.
There be dragons, I expect.
Daniel
More information about the Fortran
mailing list