[LLVMdev] RFC: Tail call optimization X86

Evan Cheng evan.cheng at apple.com
Wed Oct 3 15:22:00 PDT 2007


On Oct 2, 2007, at 2:27 AM, Arnold Schwaighofer wrote:

> 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.

Ok. I'll review the patch soon. Thanks.

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

Please remove -regalloc=local -fast. We want to test this patch  
separately. Can you explain the advantages / disadvantages of -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?

The later.

>
>
> 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

Running it as llcbeta will hopefully help us identify the performance  
issues so we can fix them before it's turned on by default.

> 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).

Please add the potential optimizations (with concrete examples /  
assembly snippets) to README.txt under Target/X86. Thanks!

Evan

>
>
> regards arnold
>
>
> <tailcall-r42525- 
> src.patch>_______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list