critical-section icon indicating copy to clipboard operation
critical-section copied to clipboard

Critical section acquire and release functions cannot be inlined without LTO

Open FeldrinH opened this issue 6 months ago • 0 comments

It seems that without LTO, any critical section acquire and release functions are compiled as calls to _critical_section_1_0_acquire and _critical_section_1_0_release and never inlined. This is rather unfortunate, since these are often very small functions that would benefit quite a bit from inlining.

With LTO these calls do get inlined, but I'm not sure how much depending on LTO for inlining hinders optimization, given that most optimization passes run before LTO.

I'm not sure if anything can be done about this, but I wanted to at least post the issue so there is a public note of this limitation somewhere (as far as I know this is currently not documented anywhere).

FeldrinH avatar Aug 13 '25 02:08 FeldrinH