Sure, that is what I meant, showing that f
and g
functions above produce the same llvm
code. What I wanted to stress is that that kind of optimization (non-heap allocations) and simplifications (elimination) can happen also in a Fortran code, even if one declares the variables explicitly. It is no different from Julia or other languages in that regards, but since one declares the variables, we can go trough life thinking that every variable necessarily corresponds to an allocation in Fortran (I have thought so for many years, until being exposed to these things when I started to use Julia).
(I think you missed my complete example there edit: sorry, I noticed that I ran llvm f(1)
twice… but the result is the same for g
)