3 ms·
That's a contrived example of inlining; now watch what happens when you provide more than just a trivial function which can be inlined; look at all the futzing
by Annatar 10y ago
That's a contrived example of inlining; now watch what happens when you provide more than just a trivial function which can be inlined; look at all the futzing it does with the stack:
https://godbolt.org/g/tjrKNO https://godbolt.org/g/tjrKNO
without explicit direction from humans, compilers can't generate code which calls subroutines or functions without using the stack at the very minimum, and that was my point.
And that's just GCC on intel; check out intel's compiler, it's even worse (click on "turn off intel syntax", and "compile to binary and disassemble the output"):
https://godbolt.org/g/IjGdAP https://godbolt.org/g/IjGdAP
...and if you try other processors as well, it just gets worse and worse:
https://godbolt.org/g/DZDLju https://godbolt.org/g/DZDLju
https://godbolt.org/g/s47tlR https://godbolt.org/g/s47tlR