mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-02 17:58:36 +00:00
Don't produce tail calls when the caller is x86_thiscallcc.
The callee will not pop the stack for us. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195467 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d29ed42abd
commit
9519b689c8
@ -3092,9 +3092,13 @@ X86TargetLowering::IsEligibleForTailCallOptimization(SDValue Callee,
|
||||
if (isCalleeStructRet || isCallerStructRet)
|
||||
return false;
|
||||
|
||||
// An stdcall caller is expected to clean up its arguments; the callee
|
||||
// isn't going to do that.
|
||||
if (!CCMatch && CallerCC == CallingConv::X86_StdCall)
|
||||
// An stdcall/thiscall caller is expected to clean up its arguments; the
|
||||
// callee isn't going to do that.
|
||||
// FIXME: this is more restrictive than needed. We could produce a tailcall
|
||||
// when the stack adjustment matches. For example, with a thiscall that takes
|
||||
// only one argument.
|
||||
if (!CCMatch && (CallerCC == CallingConv::X86_StdCall ||
|
||||
CallerCC == CallingConv::X86_ThisCall))
|
||||
return false;
|
||||
|
||||
// Do not sibcall optimize vararg calls unless all arguments are passed via
|
||||
|
@ -10,4 +10,12 @@ entry:
|
||||
ret void
|
||||
}
|
||||
|
||||
define x86_thiscallcc void @test2(%struct.I* %this, i32 %a) {
|
||||
; CHECK-LABEL: test2:
|
||||
; CHECK: calll _foo
|
||||
; CHECK: ret $4
|
||||
tail call void @foo()
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @foo()
|
||||
|
Loading…
Reference in New Issue
Block a user