10 ms·
Sounds like attempting to always inline a recursive function should be an error instead. But it's probably undesirable to make that change because it would like
by Rogach 1y ago
Sounds like attempting to always inline a recursive function should be an error instead. But it's probably undesirable to make that change because it would likely break existing crates and thus backwards compatibility as well?
- dwattttt 1y ago"inline(always)" I expect matches Clang's "always_inline", and Clang's documentation makes what it does clearer: > Inlining heuristics are disabled and inlining is always attempted regardless of optimization level. So it should be interpreted as "always attempt to inline", as opposed to "this must be inlined", or other attributes that instead influence the "should this be inlined" heuristic. EDIT: as curious an attribute as it might be, I didn't mean to be talking about inclines
- j16sdiz 1y agorecursive function can be inline when unrolled. This is a valid optimization. Google "llvm inline recursion". It exists. It should works. Fibonacci is the standard test case.
- 1718627440 1y agoBut not every recursive function can be inlined (without a secondary stack).