rvalues -> ref (yup... again!)
kinke
noone at nowhere.com
Tue Mar 27 23:35:44 UTC 2018
On Tuesday, 27 March 2018 at 21:52:25 UTC, Rubn wrote:
> It happens with LDC too, not sure how it would be able to know
> to do any kind of optimization like that unless it was able to
> inline every single function called into one function and be
> able to do optimize it from there. I don't imagine that'll be
> likely though.
It does it in your code sample with `-O`, there's no call to bar
and the foo() by-value arg is memcpy'd to the global.
If you compile everything with LTO, your code and all 3rd-party
libs as well as druntime/Phobos, LLVM is able to optimize the
whole program as if it were inside a single gigantic 'object'
file in LLVM bitcode IR, and is thus indeed theoretically able to
inline *all* functions.
More information about the Digitalmars-d
mailing list