Re:Building the Rust Compiler with GCC
by Rogach on Monday July 07, 2025 @01:52AM
(#44487178)
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?
[ Parent
| on HN ]
"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 inclined", or other attributes that instead influence the "should this be inclined" heuristic.
recursive 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.
Re:Building the Rust Compiler with GCC
by 1718627440 on Monday July 07, 2025 @09:02AM
(#44489957)
But not every recursive function can be inlined (without a secondary stack).