<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<div><br></div><div><span class="Apple-style-span" style="font-family: Monaco; font-size: 10px; ">createTailCallEliminationPass()</span> is able to turn recursive </div><div>functions into loops when the functions are written</div><div>in tail recursive form. However, I'm unable to get it</div><div>to convert mutually recursive functions to run without</div><div>a growing stack. </div><div><br></div><div>For example (in pseudo code)-</div><div><br></div><div>define fact(n,result)</div><div> if n < 2</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>then result<br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>else fact(n-1,result *n)<br></div><div><br></div><div>is converted into a loop correctly. However the following </div><div>mutually recursive pair -</div><div><br></div><div>define even(n)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>if n == 0<br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>then true<br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>else odd(n-1)<br></div><div><br></div><div>define odd(n)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>if n==0<br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>then false<br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>else even(n-1)<br></div><div><br></div><div>doesn't get to run in constant stack space. </div><div>Is that possible with llvm?</div><div><br></div><div>-Srikumar</div></body></html>