[LLVMdev] Broke my tail (call)

Jon Harrop jon at ffconsultancy.com
Tue Feb 24 09:42:31 PST 2009


On Tuesday 24 February 2009 14:54:12 Arnold Schwaighofer wrote:
> Whether it will be more efficient i can't answer off hand. Sorry. But
> probably not  because the code generated should be quite similar.
>
> For the sret version the move of the result is performed before the return.
>   store { i8*, i8* } %15, { i8*, i8* }* %19
>   ret i32 0
>
> For the struct return version this would be performed as part of
> moving the result from the result registers to whatever virtual
> register is expecting the result. If the register allocator decides to
> merge the virtual register with the result registers than no further
> move is needed.
> %2 = tail call fastcc { { i8*, i8* }*, i8* } @init({ { i8*, i8*}*,
> i8*} %0, i32 %1)
>
> Note that if you have a series of sequential recursive tail calls this
> move will only performed once (at the bottom of the recursion,
> respectively when the recursion returns) so it's impact on performance
> should be minimal.

Hmm, that makes it sound as though the moves between a tail call and the 
following return are redundant?

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



More information about the llvm-dev mailing list