[LLVMdev] Does LLVM optimize recursive call?

Matthieu Moy Matthieu.Moy at grenoble-inp.fr
Wed Oct 3 10:15:49 PDT 2012


Preston Briggs <preston.briggs at gmail.com> writes:

> Think about costs asymptotically; that's what matters. Calls and
> returns require constant time, just like addition and multiplication.

Constant time, but not necessarily constant memory.

Deep recursion will blow up your stack (AKA "segmentation fault" :-( )
if the compiler could not optimize it (tail recursion optimization).

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/



More information about the llvm-dev mailing list