Re: CALL_EXPR_MUST_TAIL_CALL and LLVM's musttail

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 08, 2021 at 04:17:33PM -0700, Jeff Law via Gcc-help wrote:
> On 12/7/2021 3:38 PM, Bradley Lucier via Gcc-help wrote:
> >So I've been investigating whether gcc's -foptimize-sibling-calls 
> >option (for which I've found very little documentation) might produce 
> >similar results.
> The option has been around for probably 20+ years at this point, you 
> just might not have been aware of it.  They try, but do not guarantee 
> tail call optimization.   They have all kinds of checks that might cause 
> any particular call site to be rejected for tail call elimination.  It's 
> enabled by default at O2 or higher.

(Including -Os.)

GCC will never not do a tail call if it knows any way to do it.  A very
low-tech way of checking if all your threaded code words got proper
tail calls is to simply look if there are any "return" instructions in
the generated machine code :-)


Segher



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux