Zulip Chat Archive
Stream: general
Topic: Function inlining
Carbon (Nov 03 2024 at 00:24):
What is the difference between always_inline
, and inline
in function definitions?
Kyle Miller (Nov 03 2024 at 00:38):
It looks like the only difference is that one day inline
might be conditional on some sort of quota.
docs#Lean.Compiler.LCNF.Simp.inlineCandidate?
if decl.alwaysInlineAttr then return true
-- TODO: check inlining quota
if decl.inlineAttr || decl.inlineIfReduceAttr then return true
Eric Wieser (Nov 03 2024 at 00:59):
That sounds quite hard to implement correctly, since mismatching inline
attributes were the cause of a performance bug here
Henrik Böving (Nov 03 2024 at 11:12):
Kyle Miller said:
It looks like the only difference is that one day
inline
might be conditional on some sort of quota.docs#Lean.Compiler.LCNF.Simp.inlineCandidate?
if decl.alwaysInlineAttr then return true -- TODO: check inlining quota if decl.inlineAttr || decl.inlineIfReduceAttr then return true
Note that you are looking at new compiler code, this is not the logic that is currently implemented
Kyle Miller (Nov 03 2024 at 15:35):
Do you know what the current logic is @Henrik Böving ?
Henrik Böving (Nov 03 2024 at 15:36):
It's somewhere in the C++ part of the old compiler but I don't know by heart hwere
Last updated: May 02 2025 at 03:31 UTC