Happy 2011, everybody!
It seems -tailcallopt prevents tailcall optimization when both caller
and callee have ccc,
even when it is optimized without an option -tailcallopt.
Is it intended or misoptimized?
In X86ISelLowering.cpp:X86TargetLowering::IsEligibleForTailCallOptimization():
if (GuaranteedTailCallOpt) {
if (IsTailCallConvention(CalleeCC) && CCMatch)
return true;
return false;
}
I know -tailcallopt changes calling conversion of fastcc to callee-pop.
ps. I am tweaking tailcallopt on Win64.
...Takumi
On Jan 1, 2011, at 4:20 PM, NAKAMURA Takumi wrote:> Happy 2011, everybody! > > It seems -tailcallopt prevents tailcall optimization when both caller > and callee have ccc, > even when it is optimized without an option -tailcallopt.Sorry, I don't understand your question. What do you mean by both caller and callee have ccc? Evan> Is it intended or misoptimized? > > In X86ISelLowering.cpp:X86TargetLowering::IsEligibleForTailCallOptimization(): > > if (GuaranteedTailCallOpt) { > if (IsTailCallConvention(CalleeCC) && CCMatch) > return true; > return false; > } > > I know -tailcallopt changes calling conversion of fastcc to callee-pop. > > ps. I am tweaking tailcallopt on Win64. > > ...Takumi > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Hello Evan,
I am sorry for my poor question.
s/ccc/default calling conversion/g ;)
("ccc" should be accepted as calling conversion specifier)
When "-tailcallopt" is specified (GuaranteedTailCallOpt),
tailcall optimizer would not touch functions of default calling conversion.
; for example
define void @caller_c() nounwind {
entry:
tail call void @callee_c()
ret void
}
declare void @callee_c() nounwind
define fastcc void @caller_f() nounwind {
entry:
tail call fastcc void @callee_f()
ret void
}
declare fastcc void @callee_f() nounwind
On {i686|x86_64}-linux without -tailcallopt,
caller_c:
jmp callee_c # TAILCALL
caller_f:
jmp callee_f # TAILCALL
With -tailcallopt, (on x86-64. simila on i686 too)
caller_c:
pushq %rax
callq callee_c
popq %rax
ret
caller_f:
pushq %rax
popq %rax
jmp callee_f # TAILCALL
...Takumi
Reasonably Related Threads
- [LLVMdev] X86 -tailcallopt and C calling conversion
- [LLVMdev] Tail Call Optimization
- Setting llvm::TargetOptions::GuaranteedTailCallOpt in LTO Code Generation
- Setting llvm::TargetOptions::GuaranteedTailCallOpt in LTO Code Generation
- Setting llvm::TargetOptions::GuaranteedTailCallOpt in LTO Code Generation