How to express the fact that arguments don't escape?
Tobias Schlüter
tobias.schlueter@physik.uni-muenchen.de
Sat Aug 15 20:56:00 GMT 2009
Thomas Koenig wrote:
> On Sat, 2009-08-15 at 18:27 +0200, Tobias Schlüter wrote:
>> I'm a bit worried that this could pessimize code with very short
>> functions but lots of arguments, i.e. when the copying time becomes
>> comparable to the runtime.
>
> I don't think this will be a problem. SSA tends to generated quite a
> lot of intermediate variables anyway (just look at a typical dump for
> -fdump-tree-optimized), and all the unnecessary stores will be optimized
> away in the generated assembly. We shouldn't do this if we aren't
> optimizing, though.
>
> Richard, do you concur?
Well, the stores and copies are meaningful in this case:
I_2 = I
g(I_2)
I = I_2
The stores can't be optimized away. This means one additional load (I_2
= I) in the best case, and one more additional load and store (get I
from memory, store in I_2; get I_2 from memory, store in I) in the worst
case.
In other words, I'll have to try with some benchmarks.
Cheers,
- Tobi
More information about the Fortran
mailing list