[llvm-commits] [PATCH] Fix tail calls (indirect or large-code-model): PR5729

Jon Harrop jon at ffconsultancy.com
Sat Jan 9 23:57:22 PST 2010


On Saturday 09 January 2010 19:05:45 you wrote:
> Committed as r93065.
>
> Your Mandelbrot test seems to work now. Let me know what's still broken.

Awesome, thanks!

All tests now pass with standalone compilation using "llc" and not "opt" on 
both x86 and x86-64.

Optimizing with "opt -std-compile-opts" generates working code that honors the 
tail calls marked by HLVM but optimizing with "opt -tailcallelim 
-std-compile-opts" still generates broken code that segfaults on both x86 and 
x86-64. IIRC, that causes opt to mark all calls as tail calls so presumably 
LLVM is intolerant of that.

With JIT compilation, both x86 and x86-64 are giving lots of wrong answers but 
only x86 segfaults (on the hash table test). If TCO is disabled in HLVM, so 
tail calls are not marked "tail" for LLVM, then the tests that do not stack 
overflow do generate the correct results with JIT compilation. So this looks 
like a JIT-specific TCO bug in LLVM.

I just tried "llc -code-model=large" when doing standalone compilation on 
x86-64 and it does not reproduce the erroneous results that I'm seeing with 
JIT compilation.

HTH.

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e



More information about the llvm-commits mailing list