Inlined functions and their original bodies - bloat

Cecil Ward cecil at cecilward.com
Sun Jul 9 18:05:48 UTC 2023


On Sunday, 9 July 2023 at 18:04:13 UTC, Cecil Ward wrote:
> I have a program where the various routines are all marked 
> pragma( inline, true ). The compiler obeys this but the LDC and 
> GDC compilers still compile the function bodies even though the 
> bodies are not needed as they are supposed to be ‘private’ to 
> the module, explicitly marked as such, hoping that that is like 
> static in C. There are no pointers to the routines, so no need 
> for the bodies because of any indirect calls. Is there a way to 
> control this code bloat in LDC / GDC ? Using the godbolt 
> compiler explorer with LDC and GDC I can indeed see that the 
> code is being inlined. Does this count as a compiler 
> performance-type bug?

This is with full -O3 optimisation and -release / -frelease for 
LDC and GDC respectively.


More information about the Digitalmars-d-learn mailing list