<div dir="auto"><div><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">Hairy Pixels via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>> schrieb am Fr., 24. Jan. 2025, 02:17:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div dir="ltr">Is the compiler actually able to inline functions which are used from a unit? When a unit is used it’s compiled to a .o file and linked so the compiler doesn’t have access to the source code anymore and thus can’t inline I would think.</div><div dir="ltr"><br></div><div dir="ltr">I write this because I’ve recently learned of link-time optimizations (LTO) from LLVM where modules are compiled to bitcode which can be linked together and inlined. It’s probably much slower than using precompiled .o files but good for release builds. Without that I don’t see how the compiler can inline any code called from units, which includes the whole RTL!</div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">When a function has inlining enabled (either explicit with the inline directive or implicit through AutoInline optimization) then in addition to generating its code to the object file (for direct calls) the node tree is stored in the PPU. And this node tree is then used for inlining the function.</div><div dir="auto"><br></div><div dir="auto">So the compiler correctly handles inlining of precompiled code. We're not stupid after all... </div><div dir="auto"><br></div><div dir="auto">Regards,</div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>