You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cmd/compile: not inlined closures can't inline inner closures #41988
The issue here is we don't currently support inlining functions that contain closures. We'd first need to inline callFn into callInt to be able to inline getInt into outer.
Escape analysis is a red herring here. Escape analysis runs after inlining and doesn't affect inlining decisions.
Activity
DmitriyMV commentedon Oct 15, 2020
The main problem here is that
getIntclosure escapes when it can be folded intoouter(even with call).mdempsky commentedon Oct 18, 2020
The issue here is we don't currently support inlining functions that contain closures. We'd first need to inline
callFnintocallIntto be able to inlinegetIntintoouter.Escape analysis is a red herring here. Escape analysis runs after inlining and doesn't affect inlining decisions.
mdempsky commentedon Jan 18, 2021
/cc @danscales , who's working on making functions that contain closures inlinable
danscales commentedon Jan 18, 2021
Yes, I will look at this bug, after I submit the base change that allows inlining of functions with closures.
DmitriyMV commentedon Aug 17, 2021
Still reproduces on 1.17:
danscales commentedon Aug 17, 2021
Thank you, will take a look if any improvement is possible for 1.18.
DmitriyMV commentedon Oct 12, 2024
Looks like it's fixed on Go 1.23 - there is now only two allocations for variable and for function literal.