[LLVMdev] RFC: Tail call optimization X86

Arnold Schwaighofer arnold.schwaighofer at gmail.com
Tue Oct 2 02:27:51 PDT 2007


Hi all,

I changed the code that checks whether a tail call is really eligible  
for optimization so that it performs the check/fix in  
SelectionDAGISel.cpp:BuildSelectionDAG() as suggest by Evan. Also  
eliminated an error that caused the remaining failing test cases in  
the test-suite.

The results look very nice (on darwin x86, r42486).
The same number (46) of failing test cases on patched version and  
vanilla version. LCCBETA was enabled on both. I changed the LCCBETA  
option in Makefile.programs in the patched version to include the  
tail-call-opt flags so that the optimization code gets exercised.

ifeq ($(ARCH),x86)
LLCBETAOPTION := -regalloc=local -fast -tail-call-opt -tail-call-opt- 
align-stack

On 26 Sep 2007, at 02:26, Chris Lattner wrote:
>  I think enabling this as llcbeta for a few nights makes
> sense before turning it on by default.
>
> -Chris

What does turning on by default mean? Does that mean it is shown in  
llc -help or that it is performed every time (without requesting via  
the command line) when compiling?

I would not do the latter since tail call optimization clears the  
stack frame of the caller (sequence), possibly causing confusion when  
debugging also resulting code is probably not faster (since arguments  
are lowered to regular stack slot -where they would be if the call  
was a normal call - first and then moved to the real stack slot -  
onto the callers parameters. As noted in the source file this might  
be optimized in many cases by looking whether the actual parameters  
come from the caller function parameters and would be overwritten if  
they are not moved. In cases where they would not be overwritten they  
could be directly lowered to the real stack slot).

regards arnold


-------------- next part --------------
A non-text attachment was scrubbed...
Name: tailcall-r42525-src.patch
Type: application/octet-stream
Size: 60519 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20071002/da888d9c/attachment.obj>


More information about the llvm-dev mailing list